1
0
mirror of git://projects.qi-hardware.com/ben-wpan.git synced 2025-04-21 12:27:27 +03:00

tools/: add timeout_ms argument to atrf_rx

This commit is contained in:
Werner Almesberger
2013-02-12 16:19:09 -03:00
parent 125cc6ad9f
commit 8ac87a3fa1
6 changed files with 18 additions and 14 deletions

View File

@@ -297,7 +297,7 @@ void atusb_rx_mode(void *handle, int on)
}
int atusb_rx(void *handle, void *buf, int size, uint8_t *lqi)
int atusb_rx(void *handle, void *buf, int size, int timeout_ms, uint8_t *lqi)
{
struct atusb_dsc *dsc = handle;
uint8_t len;
@@ -309,7 +309,9 @@ int atusb_rx(void *handle, void *buf, int size, uint8_t *lqi)
* read of size one followed by the full read. Therefore, we just do
* a maximum-sized read and hope that we don't split packets.
*/
res = usb_bulk_read(dsc->dev, 1, (char *) tmp, sizeof(tmp), 0);
res = usb_bulk_read(dsc->dev, 1, (char *) tmp, sizeof(tmp), timeout_ms);
if (res == -ETIMEDOUT)
return 0;
if (res < 0) {
fprintf(stderr, "usb_bulk_read: %d\n", res);
dsc->error = 1;