diff options
authorKévin Redon <kredon@sysmocom.de>2018-08-02 17:48:58 +0200
committerKévin Redon <kredon@sysmocom.de>2018-08-04 11:16:15 +0200
commit04ccb770fd4527f3b0fa5a7c9404143bb9c9bbd1 (patch)
parent910e6830b9635ff01830ebbe14e674aca4704ba8 (diff)
remsim: fix USB hanging USB transfer
After a couple of seconds of USB data exchange between remsim and cardem, the USB transfer hangs. On host side (remsim) I can see the USB BULK IN request. On device side (cardem) I see that data has been submitted and "sent" over USB, but on wireshark with USBmon I don't see the corresponding USB BULK IN response. When exiting remsim or just after powering of qmod (causing an error in remsim) the USB BULK IN is show in wireshark. Thus it must have been in a buffer, but not read by libusb_bulk_transfer. By shortening the timeout a new libusb_bulk_transfer is made more frequently, and the data gets read successfully. T;his change also fixes the URB data display. Change-Id: I1d124a41cc90893506933f6d76dc7331e52a74f9
1 files changed, 2 insertions, 2 deletions
diff --git a/host/simtrace2-remsim.c b/host/simtrace2-remsim.c
index 52c5051..9a681b4 100644
--- a/host/simtrace2-remsim.c
+++ b/host/simtrace2-remsim.c
@@ -536,7 +536,7 @@ static void run_mainloop(struct cardem_inst *ci)
/* read data from SIMtrace2 device (local or via USB) */
if (transp->udp_fd < 0) {
rc = libusb_bulk_transfer(transp->usb_devh, transp->usb_ep.in,
- buf, sizeof(buf), &xfer_len, 100000);
+ buf, sizeof(buf), &xfer_len, 100);
if (rc < 0 && rc != LIBUSB_ERROR_TIMEOUT &&
@@ -553,7 +553,7 @@ static void run_mainloop(struct cardem_inst *ci)
/* dispatch any incoming data */
if (xfer_len > 0) {
- printf("URB: %s\n", osmo_hexdump(buf, rc));
+ printf("URB: %s\n", osmo_hexdump(buf, xfer_len));
process_usb_msg(ci, buf, xfer_len);
byte_count += xfer_len;