Version 1.0.9.
[gnuk/neug.git] / tool / neug_upgrade.py
index 2538f6b..fc43b8a 100755 (executable)
@@ -47,12 +47,7 @@ class regnual(object):
         if intf.interfaceClass != 0xff:
             raise ValueError("Wrong interface class")
         self.__devhandle = dev.open()
-        try:
-            self.__devhandle.setConfiguration(conf)
-        except:
-            pass
         self.__devhandle.claimInterface(intf)
-        self.__devhandle.setAltInterface(intf)
 
     def mem_info(self):
         mem = self.__devhandle.controlMsg(requestType = 0xc0, request = 0,
@@ -158,8 +153,6 @@ class neug(object):
         if interface.interfaceSubClass != COM_SUBCLASS:
             raise ValueError("Wrong interface sub class")
         self.__devhandle = device.open()
-        # self.__devhandle.claimInterface(interface)
-        # self.__devhandle.setAltInterface(interface)
 
         self.__intf = interface.interfaceNumber
         self.__alt = interface.alternateSetting
@@ -311,8 +304,8 @@ def main(wait_e, passwd, data_regnual, data_upgrade):
     com = None
     #
     reg = None
-    while not reg:
-        print("Wait %d seconds..." % wait_e)
+    while reg == None:
+        print("Wait {} second{}...".format(wait_e, 's' if wait_e > 1 else ''))
         time.sleep(wait_e)
         for dev in gnuk_devices_by_vidpid():
             try:
@@ -333,7 +326,7 @@ def main(wait_e, passwd, data_regnual, data_upgrade):
 
 
 # This should be event driven, not guessing some period.
-DEFAULT_WAIT_FOR_REENUMERATION=10
+DEFAULT_WAIT_FOR_REENUMERATION=1
 
 if __name__ == '__main__':
     passwd = None