]> cvs.zerfleddert.de Git - hmcfgusb/commitdiff
always show timing warning, not only when debugging is enabled
authorMichael Gernoth <michael@gernoth.net>
Sun, 7 Jul 2013 20:38:11 +0000 (22:38 +0200)
committerMichael Gernoth <michael@gernoth.net>
Sun, 7 Jul 2013 20:38:11 +0000 (22:38 +0200)
hmcfgusb.c
hmland.c
hmsniff.c

index 5939dd61cd7ba9cc345f1aa9b74343ab72c21c3f..77f977f9442b61dae3d7fcef496ed94e5e996eff 100644 (file)
@@ -183,8 +183,7 @@ int hmcfgusb_send(struct hmcfgusb_dev *usbdev, unsigned char* send_data, int len
        msec = ((tv_end.tv_sec-tv_start.tv_sec)*1000)+((tv_end.tv_usec-tv_start.tv_usec)/1000);
 
        if (msec > 100) {
-               if (debug)
-                       fprintf(stderr, "usb-transfer took more than 100ms (%dms), this can lead to timing problems!\n", msec);
+               fprintf(stderr, "usb-transfer took more than 100ms (%dms), this can lead to timing problems!\n", msec);
        } else if (debug) {
                fprintf(stderr, "usb-transfer took %dms!\n", msec);
        }
index 15b46ab7a5c4b0dbfd2404a55fd2f14b393c95ea..f963e2b4b785ebb0da94c2657e12b687de27810f 100644 (file)
--- a/hmland.c
+++ b/hmland.c
@@ -359,6 +359,7 @@ static int comm(int fd_in, int fd_out, int master_socket, int flags)
 
        memset(out, 0, sizeof(out));
        out[0] = 'K';
+       hmcfgusb_send_null_frame(dev);
        hmcfgusb_send(dev, out, sizeof(out), 1);
 
        while(!quit) {
@@ -558,7 +559,7 @@ static int socket_server(char *iface, int port, int flags)
                                        (client_addr & 0x0000ff00) >> 8,
                                        (client_addr & 0x000000ff));
                }
-
+               sleep(1);
        }
 
        return EXIT_SUCCESS;
index e8424533009813c0f47fc8d0cd3ee4020a6c96a5..837f4e01e4f209d88d10efbefb0aa0dc52a93b8b 100644 (file)
--- a/hmsniff.c
+++ b/hmsniff.c
@@ -188,6 +188,7 @@ int main(int argc, char **argv)
                }
                printf("HM-CFG-USB opened!\n");
 
+               hmcfgusb_send_null_frame(dev);
                hmcfgusb_send(dev, (unsigned char*)"K", 1, 1);
 
                while(!quit) {
@@ -199,7 +200,7 @@ int main(int argc, char **argv)
                                rdata.wrong_hmid = 0;
                                hmcfgusb_send(dev, (unsigned char*)"K", 1, 1);
                        }
-                       fd = hmcfgusb_poll(dev, 10);
+                       fd = hmcfgusb_poll(dev, 1);
                        if (fd >= 0) {
                                fprintf(stderr, "activity on unknown fd %d!\n", fd);
                                continue;
@@ -207,6 +208,9 @@ int main(int argc, char **argv)
                                if (errno) {
                                        perror("hmcfgusb_poll");
                                        break;
+                               } else {
+                                       /* periodically wakeup the device */
+                                       hmcfgusb_send_null_frame(dev);
                                }
                        }
                }
Impressum, Datenschutz