diff options
author | Keith Packard <keithp@keithp.com> | 2015-05-19 10:14:43 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2015-05-19 10:14:43 -0700 |
commit | b67e6ae8ce34ef119da96b442776bb3d78b4f874 (patch) | |
tree | de6284b5dae4399f6372392787fa723f60b3c882 /ao-tools/lib/cc-usb.c | |
parent | 2b57158737f85c7009658b3e923c66794f01bbdf (diff) |
ao-dump-up: Add --wait option to make testing µPusb easier
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 <keithp@keithp.com>
Diffstat (limited to 'ao-tools/lib/cc-usb.c')
-rw-r--r-- | ao-tools/lib/cc-usb.c | 4 |
1 files changed, 3 insertions, 1 deletions
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, |