Skip to content

Commit c2bea78

Browse files
authored
Fix python library on Windows (#523)
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...
1 parent 0a123b1 commit c2bea78

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

python/__init__.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import time
1010
import traceback
1111
import subprocess
12+
import sys
1213
from .dfu import PandaDFU
1314
from .esptool import ESPROM, CesantaFlasher # noqa: F401
1415
from .flash_release import flash_release # noqa: F401
@@ -187,7 +188,8 @@ def connect(self, claim=True, wait=False):
187188
self.bootstub = device.getProductID() == 0xddee
188189
self.legacy = (device.getbcdDevice() != 0x2300)
189190
self._handle = device.open()
190-
self._handle.setAutoDetachKernelDriver(True)
191+
if not sys.platform in ["win32", "cygwin", "msys"]:
192+
self._handle.setAutoDetachKernelDriver(True)
191193
if claim:
192194
self._handle.claimInterface(0)
193195
#self._handle.setInterfaceAltSetting(0, 0) #Issue in USB stack

0 commit comments

Comments
 (0)