From b67e6ae8ce34ef119da96b442776bb3d78b4f874 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 19 May 2015 10:14:43 -0700 Subject: ao-dump-up: Add --wait option to make testing µPusb easier MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The --wait option hangs around until a suitable device appears, so that you can test a pile of µPusb devices without needing to constantly interact with the command line. Signed-off-by: Keith Packard --- ao-tools/lib/cc-usb.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'ao-tools/lib/cc-usb.c') diff --git a/ao-tools/lib/cc-usb.c b/ao-tools/lib/cc-usb.c index 1a4dc7a1..1e023c7e 100644 --- a/ao-tools/lib/cc-usb.c +++ b/ao-tools/lib/cc-usb.c @@ -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, -- cgit v1.2.3