From f882acc1b4ad7656b1d5820d424484ef41e77129 Mon Sep 17 00:00:00 2001 From: NIIBE Yutaka Date: Wed, 1 Jun 2016 09:49:28 +0900 Subject: [PATCH] Fix USB usage in tool/ --- ChangeLog | 6 ++++++ tool/gnuk_token.py | 2 -- tool/stlinkv2.py | 8 -------- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 76bd48f..520f81d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2016-06-01 Niibe Yutaka + * 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. diff --git a/tool/gnuk_token.py b/tool/gnuk_token.py index ad3ce9c..a6280f5 100644 --- a/tool/gnuk_token.py +++ b/tool/gnuk_token.py @@ -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, diff --git a/tool/stlinkv2.py b/tool/stlinkv2.py index 651ee87..a169ff5 100755 --- a/tool/stlinkv2.py +++ b/tool/stlinkv2.py @@ -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()