1
0
mirror of git://projects.qi-hardware.com/ben-wpan.git synced 2024-07-01 03:18:54 +03:00

tools/lib/atusb-common.c (atusb_tx): wait for and receive the TX completion

This commit is contained in:
Werner Almesberger 2011-07-13 15:03:28 -03:00
parent eeeb5599f8
commit 8f8c4140ac

View File

@ -341,6 +341,7 @@ int atusb_rx(void *handle, void *buf, int size, uint8_t *lqi)
void atusb_tx(void *handle, const void *buf, int size)
{
struct atusb_dsc *dsc = handle;
uint8_t tmp;
int res;
if (dsc->error)
@ -352,6 +353,14 @@ void atusb_tx(void *handle, const void *buf, int size)
fprintf(stderr, "ATUSB_TX: %d\n", res);
dsc->error = 1;
}
res = usb_bulk_read(dsc->dev, 1, (char *) &tmp, 1, 0);
if (res < 0) {
fprintf(stderr, "usb_bulk_read: %d\n", res);
dsc->error = 1;
return 0;
}
if (tmp)
fprintf(stderr, "atusb_tx: ACK is non-zero 0x%02x\n", tmp);
}