summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Wu <lekensteyn@gmail.com>2013-08-22 23:19:34 +0200
committerMartin Pitt <martinpitt@gnome.org>2013-09-03 08:31:28 +0200
commite1ed283930afe4cfcbea39cc8e1938f5bf5c32c7 (patch)
tree16f02828dd250f79fd46f963d8e849972bbb26e1
parent84a9b525be9d9f3ccda2638d70b1d6ba0313eb85 (diff)
hidpp: retry when read or g_poll is interrupted
Signed-off-by: Peter Wu <lekensteyn@gmail.com>
-rw-r--r--src/linux/hidpp-device.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/linux/hidpp-device.c b/src/linux/hidpp-device.c
index c0e7c4b..e6e2ba7 100644
--- a/src/linux/hidpp-device.c
+++ b/src/linux/hidpp-device.c
@@ -368,6 +368,9 @@ hidpp_device_cmd (HidppDevice *device,
for (;;) {
wrote = g_poll (poll, G_N_ELEMENTS(poll), remaining_time);
if (wrote < 0) {
+ if (errno == EINTR)
+ continue;
+
g_set_error (error, 1, 0,
"Failed to read from device: %s",
g_strerror (errno));
@@ -382,6 +385,9 @@ hidpp_device_cmd (HidppDevice *device,
wrote = read (priv->fd, &read_msg, sizeof (*response));
if (wrote <= 0) {
+ if (wrote == -1 && errno == EINTR)
+ continue;
+
g_set_error (error, 1, 0,
"Unable to read response from device: %s",
g_strerror (errno));