hidpp: retry when read or g_poll is interrupted

Signed-off-by: Peter Wu <lekensteyn@gmail.com>
This commit is contained in:
Peter Wu 2013-08-22 23:19:34 +02:00 committed by Martin Pitt
parent 84a9b525be
commit e1ed283930

View file

@ -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));