laforge has uploaded this change for review. (
https://gerrit.osmocom.org/c/osmo-e1d/+/26819 )
Change subject: usb: Print failed USB isochronous packets
......................................................................
usb: Print failed USB isochronous packets
Change-Id: Ib6fcf46be40d47817632ccae4e742d6cf7340cda
---
M src/usb.c
1 file changed, 28 insertions(+), 5 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-e1d refs/changes/19/26819/1
diff --git a/src/usb.c b/src/usb.c
index d5107bc..2ccb3ac 100644
--- a/src/usb.c
+++ b/src/usb.c
@@ -173,6 +173,18 @@
// USB flow
// ---------------------------------------------------------------------------
+/* strings for enum libusb_transfer_status */
+static const struct value_string libusb_status_str[] = {
+ { LIBUSB_TRANSFER_COMPLETED, "COMPLETED" },
+ { LIBUSB_TRANSFER_ERROR, "ERROR" },
+ { LIBUSB_TRANSFER_TIMED_OUT, "TIMED_OUT" },
+ { LIBUSB_TRANSFER_CANCELLED, "CANCELLED" },
+ { LIBUSB_TRANSFER_STALL, "STALL" },
+ { LIBUSB_TRANSFER_NO_DEVICE, "NO_DEVICE" },
+ { LIBUSB_TRANSFER_OVERFLOW, "OVERFLOW" },
+ { 0, NULL }
+};
+
static void LIBUSB_CALL
_e1uf_xfr(struct libusb_transfer *xfr)
{
@@ -184,18 +196,29 @@
/* FIXME: Check transfer status ? Error handling ? */
+
if (flow->ep & 0x80) {
for (j=0; j<flow->ppx; j++) {
+ struct libusb_iso_packet_descriptor *iso_pd = &xfr->iso_packet_desc[j];
+ if (iso_pd->status != LIBUSB_TRANSFER_COMPLETED) {
+ LOGPLI(flow->line, DE1D, LOGL_ERROR, "IN EP %02x ISO packet %d failed with
status %s\n",
+ flow->ep, j, get_value_string(libusb_status_str, iso_pd->status));
+ }
flow->cb(flow,
libusb_get_iso_packet_buffer_simple(xfr, j),
- (xfr->iso_packet_desc[j].status == LIBUSB_TRANSFER_COMPLETED) ?
- xfr->iso_packet_desc[j].actual_length : -1
+ (iso_pd->status == LIBUSB_TRANSFER_COMPLETED) ? iso_pd->actual_length : -1
);
- len += (xfr->iso_packet_desc[j].length = flow->size);
+ len += (iso_pd->length = flow->size);
}
} else {
- for (j=0; j<flow->ppx; j++)
- len += (xfr->iso_packet_desc[j].length = flow->cb(flow,
&xfr->buffer[len], flow->size));
+ for (j=0; j<flow->ppx; j++) {
+ struct libusb_iso_packet_descriptor *iso_pd = &xfr->iso_packet_desc[j];
+ if (iso_pd->status != LIBUSB_TRANSFER_COMPLETED) {
+ LOGPLI(flow->line, DE1D, LOGL_ERROR, "OUT EP %02x ISO packet %d failed with
status %s\n",
+ flow->ep, j, get_value_string(libusb_status_str, iso_pd->status));
+ }
+ len += (iso_pd->length = flow->cb(flow, &xfr->buffer[len],
flow->size));
+ }
}
libusb_fill_iso_transfer(xfr, id->devh, flow->ep,
--
To view, visit
https://gerrit.osmocom.org/c/osmo-e1d/+/26819
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-e1d
Gerrit-Branch: master
Gerrit-Change-Id: Ib6fcf46be40d47817632ccae4e742d6cf7340cda
Gerrit-Change-Number: 26819
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-MessageType: newchange