aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Markgraf <steve@steve-m.de>2020-01-26 20:52:24 +0100
committerSteve Markgraf <steve@steve-m.de>2020-01-26 20:52:24 +0100
commitf05c961455f2c9aabce71ec3d9592199b07c47da (patch)
treea13608ef1088769a661bf93c0f6cd744d2a2191a
parenta9f3771eb6ad4f9afb98d346dc6c54a1812d6e73 (diff)
downloadosmo-fl2k-f05c961455f2c9aabce71ec3d9592199b07c47da.tar.gz
osmo-fl2k-f05c961455f2c9aabce71ec3d9592199b07c47da.tar.bz2
osmo-fl2k-f05c961455f2c9aabce71ec3d9592199b07c47da.zip
lib: fall back to iface 1 in case iface 0 altsetting 1 fails
Some people on the mailing list reported that with older kernels setting interface 0 altsetting 1 does not work, fall back to the old behavior in this case for now, while still investigating the root cause of this problem.
-rw-r--r--src/libosmo-fl2k.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/libosmo-fl2k.c b/src/libosmo-fl2k.c
index 7478893..9ebe130 100644
--- a/src/libosmo-fl2k.c
+++ b/src/libosmo-fl2k.c
@@ -447,8 +447,13 @@ int fl2k_open(fl2k_dev_t **out_dev, uint32_t index)
r = libusb_set_interface_alt_setting(dev->devh, 0, 1);
if (r < 0) {
- fprintf(stderr, "Error enabling IF 0 altsetting 1: %d\n", r);
- goto err;
+ fprintf(stderr, "Failed to switch interface 0 to "
+ "altsetting 1, trying to use interface 1\n");
+
+ r = libusb_claim_interface(dev->devh, 1);
+ if (r < 0) {
+ fprintf(stderr, "Could not claim interface 1: %d\n", r);
+ }
}
r = fl2k_init_device(dev);