]> git.zerfleddert.de Git - hmcfgusb/blobdiff - hmland.c
only wake the device up when the timeout really expired
[hmcfgusb] / hmland.c
index c50022c8225effc7a8814e50930bddc1f10578f4..32a1cdf16cbf8c13a7f77bd4fa4037cb19eb60a5 100644 (file)
--- a/hmland.c
+++ b/hmland.c
@@ -478,11 +478,18 @@ static int comm(int fd_in, int fd_out, int master_socket, int flags)
                        }
                } else if (fd == -1) {
                        if (errno) {
-                               perror("hmcfgusb_poll");
-                               quit = 1;
-                       } else {
-                               /* periodically wakeup the device */
-                               hmcfgusb_send_null_frame(dev, 1);
+                               if (errno != ETIMEDOUT) {
+                                       perror("hmcfgusb_poll");
+                                       quit = 1;
+                               } else {
+                                       /* periodically wakeup the device */
+                                       hmcfgusb_send_null_frame(dev, 1);
+                                       if (wait_for_h) {
+                                               memset(out, 0, sizeof(out));
+                                               out[0] = 'K';
+                                               hmcfgusb_send(dev, out, sizeof(out), 1);
+                                       }
+                               }
                        }
                }
        }
Impressum, Datenschutz