Fix USB usage in tool/

This commit is contained in:
NIIBE Yutaka 2016-06-01 09:49:28 +09:00
parent 907d8c7a8e
commit f882acc1b4
3 changed files with 6 additions and 10 deletions

View File

@ -1,5 +1,11 @@
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.
(ccid_thread): Call ccid_notify_slot_change at
interface_reset and EV_CARD_CHANGE.

View File

@ -68,7 +68,6 @@ class gnuk_token(object):
raise ValueError("Wrong interface sub class")
self.__devhandle = device.open()
self.__devhandle.claimInterface(interface)
self.__devhandle.setAltInterface(0)
self.__intf = interface.interfaceNumber
self.__alt = interface.alternateSetting
@ -473,7 +472,6 @@ class regnual(object):
raise ValueError("Wrong interface class")
self.__devhandle = dev.open()
self.__devhandle.claimInterface(intf)
self.__devhandle.setAltInterface(0)
def mem_info(self):
mem = self.__devhandle.controlMsg(requestType = 0xc0, request = 0,

View File

@ -146,15 +146,7 @@ class stlinkv2(object):
if intf.interfaceClass != 0xff: # Vendor specific
raise ValueError("Wrong interface class.", intf.interfaceClass)
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.setAltInterface(0) # This was not good for libusb-win32 with wrong arg intf, new correct value 0 would be OK
def shutdown(self):
self.__devhandle.releaseInterface()