mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
Fix init compatibility with Windows backend
This commit is contained in:
parent
ad5d2d742d
commit
97bf077581
@ -10,6 +10,7 @@ import sys,time
|
||||
import usb.core
|
||||
import usb.util
|
||||
import pydfu
|
||||
import platform
|
||||
from array import array
|
||||
from PIL import Image
|
||||
|
||||
@ -54,9 +55,11 @@ def init():
|
||||
if __dev is None:
|
||||
raise ValueError('__device not found')
|
||||
|
||||
# detach kernel driver
|
||||
if __dev.is_kernel_driver_active(__INTERFACE):
|
||||
__dev.detach_kernel_driver(__INTERFACE)
|
||||
# Windows backend doesn't support this
|
||||
if (platform.system() !='Windows'):
|
||||
# detach kernel driver
|
||||
if __dev.is_kernel_driver_active(__INTERFACE):
|
||||
__dev.detach_kernel_driver(__INTERFACE)
|
||||
|
||||
# claim __INTERFACE
|
||||
usb.util.claim_interface(__dev, __INTERFACE)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user