Skip to content

Commit

Permalink
Fix python library on Windows (#523)
Browse files Browse the repository at this point in the history
On Windows, setAutoDetachKernelDriver is not supported (http://libusb.sourceforge.net/api-1.0/group__libusb__dev.html#ga5e0cc1d666097e915748593effdc634a) and causes libusb to get stuck (simple try-catch is not working). This prevents any issues when running both at native windows python and cygwined python...
  • Loading branch information
bkralik committed May 2, 2020
1 parent 0a123b1 commit c2bea78
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion python/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import time
import traceback
import subprocess
import sys
from .dfu import PandaDFU
from .esptool import ESPROM, CesantaFlasher # noqa: F401
from .flash_release import flash_release # noqa: F401
Expand Down Expand Up @@ -187,7 +188,8 @@ def connect(self, claim=True, wait=False):
self.bootstub = device.getProductID() == 0xddee
self.legacy = (device.getbcdDevice() != 0x2300)
self._handle = device.open()
self._handle.setAutoDetachKernelDriver(True)
if not sys.platform in ["win32", "cygwin", "msys"]:
self._handle.setAutoDetachKernelDriver(True)
if claim:
self._handle.claimInterface(0)
#self._handle.setInterfaceAltSetting(0, 0) #Issue in USB stack
Expand Down

0 comments on commit c2bea78

Please sign in to comment.