]> cvs.zerfleddert.de Git - hmcfgusb/blobdiff - hmsniff.c
only wake the device up when the timeout really expired
[hmcfgusb] / hmsniff.c
index 837f4e01e4f209d88d10efbefb0aa0dc52a93b8b..ee148006a87a3add07d80ca3c3ba2168da583022 100644 (file)
--- a/hmsniff.c
+++ b/hmsniff.c
@@ -188,7 +188,7 @@ int main(int argc, char **argv)
                }
                printf("HM-CFG-USB opened!\n");
 
                }
                printf("HM-CFG-USB opened!\n");
 
-               hmcfgusb_send_null_frame(dev);
+               hmcfgusb_send_null_frame(dev, 1);
                hmcfgusb_send(dev, (unsigned char*)"K", 1, 1);
 
                while(!quit) {
                hmcfgusb_send(dev, (unsigned char*)"K", 1, 1);
 
                while(!quit) {
@@ -206,11 +206,13 @@ int main(int argc, char **argv)
                                continue;
                        } else if (fd == -1) {
                                if (errno) {
                                continue;
                        } else if (fd == -1) {
                                if (errno) {
-                                       perror("hmcfgusb_poll");
-                                       break;
-                               } else {
-                                       /* periodically wakeup the device */
-                                       hmcfgusb_send_null_frame(dev);
+                                       if (errno != ETIMEDOUT) {
+                                               perror("hmcfgusb_poll");
+                                               break;
+                                       } else {
+                                               /* periodically wakeup the device */
+                                               hmcfgusb_send_null_frame(dev, 1);
+                                       }
                                }
                        }
                }
                                }
                        }
                }
Impressum, Datenschutz