From f05c961455f2c9aabce71ec3d9592199b07c47da Mon Sep 17 00:00:00 2001 From: Steve Markgraf Date: Sun, 26 Jan 2020 20:52:24 +0100 Subject: [PATCH] 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. --- src/libosmo-fl2k.c | 9 +++++++-- 1 file 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);