ao-dump-up: Add --wait option to make testing ĀµPusb easier
[fw/altos] / ao-tools / lib / cc-usb.c
index 1a4dc7a1163f7460bdf139422be70d72ed44d35c..1e023c7ebe8f7b37e99eeef7b044d294a5f531dd 100644 (file)
@@ -207,8 +207,10 @@ _cc_usb_sync(struct cc_usb *cc, int wait_for_input, int write_timeout)
                                        write(2, cc->in_buf, cc->in_count);
                                        cc->in_count = 0;
                                }
-                       } else if (ret < 0)
+                       } else if (ret <= 0) {
                                perror("read");
+                               return -1;
+                       }
                }
                if (fds.revents & POLLOUT) {
                        ret = write(cc->fd, cc->out_buf,