]> git.zerfleddert.de Git - hmcfgusb/blobdiff - hmcfgusb.c
only wake the device up when the timeout really expired
[hmcfgusb] / hmcfgusb.c
index d8a442f690a04bba9d368c4c4340b54311e2e64b..0857a4b3634f5ac9dee153d051c8074a0b298a5c 100644 (file)
@@ -393,6 +393,7 @@ int hmcfgusb_poll(struct hmcfgusb_dev *dev, int timeout)
 {
        struct timeval tv;
        int usb_event = 0;
+       int timed_out = 0;
        int i;
        int n;
        int fd_n;
@@ -430,6 +431,7 @@ int hmcfgusb_poll(struct hmcfgusb_dev *dev, int timeout)
                        return -1;
                } else if (n == 0) {
                        usb_event = 1;
+                       timed_out = 1;
                } else {
                        for (fd_n = 0; fd_n < dev->n_pfd; fd_n++) {
                                if (dev->pfd[fd_n].revents) {
@@ -461,6 +463,9 @@ int hmcfgusb_poll(struct hmcfgusb_dev *dev, int timeout)
                errno = quit;
        }
 
+       if (timed_out)
+               errno = ETIMEDOUT;
+
        return -1;
 }
 
Impressum, Datenschutz