mirror of
https://github.com/Lekensteyn/lglaf.git
synced 2024-11-23 07:38:15 -05:00
lglaf.py: Fix "Resource busy" error
Detach kernel driver (cdc_acm) to avoid this error: usb.core.USBError: [Errno 16] Resource busy Deliberately do not call attach_kernel_driver for the detached devices, it is likely that the user runs lglaf multiple times. The user can unplug and re-insert their device if they want to re-attach the kernel driver.
This commit is contained in:
parent
f2792e6374
commit
688e0f3d17
1 changed files with 4 additions and 0 deletions
4
lglaf.py
4
lglaf.py
|
@ -215,6 +215,10 @@ class USBCommunication(Communication):
|
|||
"has a kernel driver claimed the interface?")
|
||||
raise e
|
||||
for intf in cfg:
|
||||
if self.usbdev.is_kernel_driver_active(intf.bInterfaceNumber):
|
||||
_logger.debug("Detaching kernel driver for intf %d",
|
||||
intf.bInterfaceNumber)
|
||||
self.usbdev.detach_kernel_driver(intf.bInterfaceNumber)
|
||||
if self._match_interface(intf):
|
||||
self._set_interface(intf)
|
||||
assert self.ep_in
|
||||
|
|
Loading…
Reference in a new issue