Skip to content

Commit

Permalink
Usb reset: Detach kernel driver
Browse files Browse the repository at this point in the history
  • Loading branch information
ma1co committed Mar 14, 2016
1 parent 76a0ae2 commit 5b18d6f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pmca/usb/driver/libusb.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,12 @@ def _findEndpoint(self, type, direction):
raise Exception('No endpoint found')

def reset(self):
if self.dev.backend.__module__ == 'usb.backend.libusb1':
try:
if self.dev.is_kernel_driver_active(0):
self.dev.detach_kernel_driver(0)
except NotImplementedError:
pass
if self.dev._ctx.backend.__module__ == 'usb.backend.libusb1':
self.dev.reset()

def read(self, length):
Expand Down

0 comments on commit 5b18d6f

Please sign in to comment.