mirror of
https://gitlab.freedesktop.org/upower/upower.git
synced 2026-04-21 18:10:51 +02:00
hidpp: retry when read or g_poll is interrupted
Signed-off-by: Peter Wu <lekensteyn@gmail.com>
This commit is contained in:
parent
84a9b525be
commit
e1ed283930
1 changed files with 6 additions and 0 deletions
|
|
@ -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));
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue