Fix init compatibility with Windows backend

This commit is contained in:
iabdalkader 2014-11-02 16:16:42 +02:00
parent ad5d2d742d
commit 97bf077581

View File

@ -10,6 +10,7 @@ import sys,time
import usb.core import usb.core
import usb.util import usb.util
import pydfu import pydfu
import platform
from array import array from array import array
from PIL import Image from PIL import Image
@ -54,6 +55,8 @@ def init():
if __dev is None: if __dev is None:
raise ValueError('__device not found') raise ValueError('__device not found')
# Windows backend doesn't support this
if (platform.system() !='Windows'):
# detach kernel driver # detach kernel driver
if __dev.is_kernel_driver_active(__INTERFACE): if __dev.is_kernel_driver_active(__INTERFACE):
__dev.detach_kernel_driver(__INTERFACE) __dev.detach_kernel_driver(__INTERFACE)