aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHarald Welte <laforge@osmocom.org>2022-11-01 18:24:29 +0100
committerHarald Welte <laforge@osmocom.org>2022-11-01 18:24:29 +0100
commit75331976392a65b71e4c59facda5fe30d904dc4c (patch)
tree2111a6c1510044566b90a99b8ce072b702425394 /src
parentcfe7ab300e5ce34d5588eccc42584328137a639a (diff)
usb.c: Bail out of e1-tracer doesn't accept set_configuration(2)
This likely means it's not an e1-tracer after all, or it's an old firmware that doesn't yet expose the e1d-compatible USB configuration. Related: OS#5734 Change-Id: If5a9bc20084d84885d5d97b4f982e94801612d24
Diffstat (limited to 'src')
-rw-r--r--src/usb.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/usb.c b/src/usb.c
index dc89bb0..35e1894 100644
--- a/src/usb.c
+++ b/src/usb.c
@@ -876,8 +876,13 @@ _e1_usb_open_device(struct e1_daemon *e1d, struct libusb_device *dev, bool is_tr
}
/* we have prior knowledge that the e1-tracer firmware configuration 2 is the e1d compatible mode. */
- if (is_tracer)
- libusb_set_configuration(devh, 2);
+ if (is_tracer) {
+ if (libusb_set_configuration(devh, 2) != LIBUSB_SUCCESS) {
+ LOGP(DE1D, LOGL_ERROR, "Cannot set configuration 2 of e1-tracer device. Maybe too old firmware?\n");
+ libusb_close(devh);
+ return -EIO;
+ }
+ }
INIT_LLIST_HEAD(&intf_data->ctrl_inprogress);