Fix USB usage in tool/
This commit is contained in:
@@ -1,5 +1,11 @@
|
|||||||
2016-06-01 Niibe Yutaka <gniibe@fsij.org>
|
2016-06-01 Niibe Yutaka <gniibe@fsij.org>
|
||||||
|
|
||||||
|
* tool/stlinkv2.py (stlinkv2.__init__): Don't
|
||||||
|
call setConfiguration.
|
||||||
|
|
||||||
|
* tool/gnuk_token.py (gnuk_token, regnual): Don't
|
||||||
|
call setAltInterface, it's not needed.
|
||||||
|
|
||||||
* src/usb-ccid.c (ccid_notify_slot_change): New.
|
* src/usb-ccid.c (ccid_notify_slot_change): New.
|
||||||
(ccid_thread): Call ccid_notify_slot_change at
|
(ccid_thread): Call ccid_notify_slot_change at
|
||||||
interface_reset and EV_CARD_CHANGE.
|
interface_reset and EV_CARD_CHANGE.
|
||||||
|
|||||||
@@ -68,7 +68,6 @@ class gnuk_token(object):
|
|||||||
raise ValueError("Wrong interface sub class")
|
raise ValueError("Wrong interface sub class")
|
||||||
self.__devhandle = device.open()
|
self.__devhandle = device.open()
|
||||||
self.__devhandle.claimInterface(interface)
|
self.__devhandle.claimInterface(interface)
|
||||||
self.__devhandle.setAltInterface(0)
|
|
||||||
|
|
||||||
self.__intf = interface.interfaceNumber
|
self.__intf = interface.interfaceNumber
|
||||||
self.__alt = interface.alternateSetting
|
self.__alt = interface.alternateSetting
|
||||||
@@ -473,7 +472,6 @@ class regnual(object):
|
|||||||
raise ValueError("Wrong interface class")
|
raise ValueError("Wrong interface class")
|
||||||
self.__devhandle = dev.open()
|
self.__devhandle = dev.open()
|
||||||
self.__devhandle.claimInterface(intf)
|
self.__devhandle.claimInterface(intf)
|
||||||
self.__devhandle.setAltInterface(0)
|
|
||||||
|
|
||||||
def mem_info(self):
|
def mem_info(self):
|
||||||
mem = self.__devhandle.controlMsg(requestType = 0xc0, request = 0,
|
mem = self.__devhandle.controlMsg(requestType = 0xc0, request = 0,
|
||||||
|
|||||||
@@ -146,15 +146,7 @@ class stlinkv2(object):
|
|||||||
if intf.interfaceClass != 0xff: # Vendor specific
|
if intf.interfaceClass != 0xff: # Vendor specific
|
||||||
raise ValueError("Wrong interface class.", intf.interfaceClass)
|
raise ValueError("Wrong interface class.", intf.interfaceClass)
|
||||||
self.__devhandle = dev.open()
|
self.__devhandle = dev.open()
|
||||||
# ST-Link/V2-1 has other interfaces
|
|
||||||
# Some other processes or kernel would use it
|
|
||||||
# So, write access to configuration causes error
|
|
||||||
try:
|
|
||||||
self.__devhandle.setConfiguration(conf.value)
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
self.__devhandle.claimInterface(intf.interfaceNumber)
|
self.__devhandle.claimInterface(intf.interfaceNumber)
|
||||||
# self.__devhandle.setAltInterface(0) # This was not good for libusb-win32 with wrong arg intf, new correct value 0 would be OK
|
|
||||||
|
|
||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
self.__devhandle.releaseInterface()
|
self.__devhandle.releaseInterface()
|
||||||
|
|||||||
Reference in New Issue
Block a user