Skip to content

Commit

Permalink
Merge pull request #84 from google/gbg/78
Browse files Browse the repository at this point in the history
use libusb auto-detach feature
  • Loading branch information
barbibulle committed Nov 27, 2022
2 parents b437bd8 + 9e5a85b commit a739fc7
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions bumble/transport/usb.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,14 +414,13 @@ def find_endpoints(device):

device = found.open()

# Detach the kernel driver if supported and needed
# Auto-detach the kernel driver if supported
if usb1.hasCapability(usb1.CAP_SUPPORTS_DETACH_KERNEL_DRIVER):
try:
if device.kernelDriverActive(interface):
logger.debug("detaching kernel driver")
device.detachKernelDriver(interface)
except usb1.USBError:
pass
logger.debug('auto-detaching kernel driver')
device.setAutoDetachKernelDriver(True)
except usb1.USBError as error:
logger.warning(f'unable to auto-detach kernel driver: {error}')

# Set the configuration if needed
try:
Expand Down

0 comments on commit a739fc7

Please sign in to comment.