]> git.zerfleddert.de Git - hmcfgusb/commitdiff
do not report errors when sending of the wakeup-frame fails
authorMichael Gernoth <michael@gernoth.net>
Sat, 13 Jul 2013 13:52:21 +0000 (15:52 +0200)
committerMichael Gernoth <michael@gernoth.net>
Sat, 13 Jul 2013 13:52:21 +0000 (15:52 +0200)
hmcfgusb.c
hmcfgusb.h
hmland.c
hmsniff.c

index 05f16bed4f10a1b2284b2a98b230cca0896b5da7..825b3132a3bbc660d37ef6a41259fbc7b785d6e7 100644 (file)
@@ -142,14 +142,14 @@ static libusb_device_handle *hmcfgusb_find() {
        return NULL;
 }
 
-int hmcfgusb_send_null_frame(struct hmcfgusb_dev *usbdev)
+int hmcfgusb_send_null_frame(struct hmcfgusb_dev *usbdev, int silent)
 {
        int err;
        int cnt;
 
        err = libusb_interrupt_transfer(usbdev->usb_devh, EP_OUT, NULL, 0, &cnt, USB_TIMEOUT);
-       if (err) {
-               fprintf(stderr, "Can't send data: %s\n", usb_strerror(err));
+       if (err && (!silent)) {
+               fprintf(stderr, "Can't send null frame: %s\n", usb_strerror(err));
                return 0;
        }
 
@@ -176,7 +176,7 @@ int hmcfgusb_send(struct hmcfgusb_dev *usbdev, unsigned char* send_data, int len
        }
 
        if (done) {
-               if (!hmcfgusb_send_null_frame(usbdev)) {
+               if (!hmcfgusb_send_null_frame(usbdev, 0)) {
                        return 0;
                }
        }
index e50f831459900996aeca2ea4629ee8d3de0c6d3e..df6d1c1717c525cdf05ae97641fff53985b58ac2 100644 (file)
@@ -32,7 +32,7 @@ struct hmcfgusb_dev {
 };
 
 int hmcfgusb_send(struct hmcfgusb_dev *usbdev, unsigned char* send_data, int len, int done);
-int hmcfgusb_send_null_frame(struct hmcfgusb_dev *usbdev);
+int hmcfgusb_send_null_frame(struct hmcfgusb_dev *usbdev, int silent);
 struct hmcfgusb_dev *hmcfgusb_init(hmcfgusb_cb_fn cb, void *data);
 int hmcfgusb_add_pfd(struct hmcfgusb_dev *dev, int fd, short events);
 int hmcfgusb_poll(struct hmcfgusb_dev *dev, int timeout);
index a9d9670186f8dc522b1bc772b3a1db689f0d3267..c50022c8225effc7a8814e50930bddc1f10578f4 100644 (file)
--- a/hmland.c
+++ b/hmland.c
@@ -455,7 +455,7 @@ static int comm(int fd_in, int fd_out, int master_socket, int flags)
        memset(out, 0, sizeof(out));
        out[0] = 'K';
        wait_for_h = 1;
-       hmcfgusb_send_null_frame(dev);
+       hmcfgusb_send_null_frame(dev, 1);
        hmcfgusb_send(dev, out, sizeof(out), 1);
 
        while(!quit) {
@@ -482,7 +482,7 @@ static int comm(int fd_in, int fd_out, int master_socket, int flags)
                                quit = 1;
                        } else {
                                /* periodically wakeup the device */
-                               hmcfgusb_send_null_frame(dev);
+                               hmcfgusb_send_null_frame(dev, 1);
                        }
                }
        }
index 837f4e01e4f209d88d10efbefb0aa0dc52a93b8b..1936d5bd0d53dbd306cb983084bf3d1cb5dc4070 100644 (file)
--- a/hmsniff.c
+++ b/hmsniff.c
@@ -188,7 +188,7 @@ int main(int argc, char **argv)
                }
                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) {
@@ -210,7 +210,7 @@ int main(int argc, char **argv)
                                        break;
                                } else {
                                        /* periodically wakeup the device */
-                                       hmcfgusb_send_null_frame(dev);
+                                       hmcfgusb_send_null_frame(dev, 1);
                                }
                        }
                }
Impressum, Datenschutz