Rewrite of initialization and deinitialization functions
Original code iterates through every possible descriptor in nested loops and tries to do initialization every iteration without considered what are those descriptors for nor stopping when interface is finally claimed. It has following problems: 1. It iterates through all configurations, but explicitly resets a device configuration to 1 every iteration. 2. It never configures a possibly shared device even it is currently unconfigured. 3. It treats alternative settings as independent interfaces and iterates through them while implicitly setting alternative setting to 0. 4. It can claim several interfaces but uses only the last one. 5. It doesn't track claimed interfaces' number and always deinitializes interface 0. This in fact works for a device with single configuration, single interface and no alternative settings, like most of the supported devices (except G510), but it is fundamentally incorrect. Therefore as part of migration to libusb 1.0 I've rewritten the initialization procedure in a more linear way. First it selects a configuration, which is 1 in most cases. Next it iterates through descriptors in this configuration to find a single compatible interface. Only after that it resets the device and claims the interface.
This commit is contained in:
1 parent
bd4495ec01
commit
0408478701
2 files changed
+284
-180
No files matched your search
Vendored
+1
-1
@@ -3,7 +3,7 @@ libg15 (1.3.0~svn324-2) unstable; urgency=medium
|
||||
* Migrate from legacy libusb-0.1 to libusb-1.0 (closes: bug#810409,
|
||||
bug#611649).
|
||||
|
||||
-- Alexander Ponyatykh <lazyranma@gmail.com> Sun, 17 Nov 2019 14:29:55 +0300
|
||||
-- Alexander Ponyatykh <lazyranma@gmail.com> Mon, 18 Nov 2019 02:44:19 +0300
|
||||
|
||||
libg15 (1.3.0~svn324-1) unstable; urgency=medium
|
||||
|
||||
|
||||
Reference in new issue
Block a user