Closed alex-dewar closed 5 years ago
Will probably be harder than I first thought. After fixing dictionary name changes (mostly `d.serial_number to d['sn']), this traceback is printed:
Traceback (most recent call last):
File "c:\users\user\code\term2\chipwhisperer\software\chipwhisperer\hardware\naeusb\naeusb.py", line 295, in txrx
response = self.open(serial_number=payload)
File "c:\users\user\code\term2\chipwhisperer\software\chipwhisperer\hardware\naeusb\naeusb.py", line 316, in open
snlist = [d['sn'] + " (" + d['product']+ ")\n" for d in devlist]
File "c:\users\user\code\term2\chipwhisperer\software\chipwhisperer\hardware\naeusb\naeusb.py", line 316, in <listcomp>
snlist = [d['sn'] + " (" + d['product']+ ")\n" for d in devlist]
File "c:\users\user\appdata\local\programs\python\python37-32\lib\site-packages\pyusb-1.0.2-py3.7.egg\usb\core.py", line 1098, in __getitem__
return Configuration(self, index)
File "c:\users\user\appdata\local\programs\python\python37-32\lib\site-packages\pyusb-1.0.2-py3.7.egg\usb\core.py", line 586, in __init__
configuration
File "c:\users\user\appdata\local\programs\python\python37-32\lib\site-packages\pyusb-1.0.2-py3.7.egg\usb\backend\libusb0.py", line 456, in get_configuration_descriptor
if config >= dev.descriptor.bNumConfigurations:
TypeError: '>=' not supported between instances of 'str' and 'int'
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-1-8285344a4613> in <module>
1 import chipwhisperer as cw
----> 2 scope = cw.scope(sn="44203120484d39433130353232323035")
3 #target = cw.target(scope)
c:\users\user\code\term2\chipwhisperer\software\chipwhisperer\__init__.py in scope(type, sn)
121 """
122 scope = type()
--> 123 scope.con(sn)
124 return scope
125
c:\users\user\code\term2\chipwhisperer\software\chipwhisperer\capture\scopes\base.py in con(self, sn)
60 for channel in self.channels:
61 channel.register()
---> 62 if self._con(sn):
63 self.connectStatus.setValue(True)
64
c:\users\user\code\term2\chipwhisperer\software\chipwhisperer\capture\scopes\OpenADC.py in _con(self, sn)
125 def _con(self, sn=None):
126 if self.scopetype is not None:
--> 127 self.scopetype.con(sn)
128
129 # TODO Fix this hack
c:\users\user\code\term2\chipwhisperer\software\chipwhisperer\capture\scopes\openadc_interface\naeusbchip.py in con(self, sn)
86 else:
87 sn = None
---> 88 found_id = self.dev.con(idProduct=nae_products, serial_number=sn)
89 except (IOError, ValueError):
90 raise Warning('Could not connect to "%s". It may have been disconnected, is in an error state, or is being used by another tool.' % self.getName())
c:\users\user\code\term2\chipwhisperer\software\chipwhisperer\capture\scopes\cwhardware\ChipWhispererLite.py in con(self, *args, **kwargs)
49
50 def con(self, *args, **kwargs):
---> 51 return self._cwusb.con(*args, **kwargs)
52
53 def dis(self):
c:\users\user\code\term2\chipwhisperer\software\chipwhisperer\hardware\naeusb\naeusb.py in con(self, idProduct, connect_to_first, serial_number)
572 raise Warning("Found multiple potential USB devices. Please specify device to use. Possible S/Ns:\n" + snlist)
573
--> 574 self.usbseralizer.open(dev['sn'])
575 foundId = dev['pid']
576
c:\users\user\code\term2\chipwhisperer\software\chipwhisperer\hardware\naeusb\naeusb.py in open(self, serial_number)
154 """Opens USB device"""
155 cmdpacket = self.make_cmd(self.OPEN, serial_number)
--> 156 return self.process_rx(self.txrx(tx=cmdpacket))
157
158 def close(self, serial_number):
c:\users\user\code\term2\chipwhisperer\software\chipwhisperer\hardware\naeusb\naeusb.py in process_rx(self, inp)
147
148 if resp == self.ERROR:
--> 149 raise payload
150
151 return payload
TypeError: '>=' not supported between instances of 'str' and 'int'
The above error seems to have been caused by unnecessary changes in naeusb.py. Commit 7e6135f75c23e5b5dff300076e8ffce12e6a756f adds support for multiple OpenADC scopes (Nano not yet supported).
Nano support added by df75fa067d26c26ee2c1812b659c1ff5467d6229
The patch that allows multiple ChipWhisperers to be connected hasn't been moved over to CW5. This shouldn't be too hard, could probably just add an optional serial number argument to
cw.scope
that gets passed down through to the actual connection method.The important bit (that actually connects stuff is): https://github.com/newaetech/chipwhisperer/blob/7d1711cd994daf4ac133c0155654d6e277353759/software/chipwhisperer/capture/scopes/openadc_interface/naeusbchip.py#L68-L87