# HG changeset patch # User Daniel O'Connor # Date 1610076701 -37800 # Node ID 19045ad9f5f572c282f6f314e6e86f3489723b91 # Parent 91b476ebc0f2a80367bc9e808e7f73b526946505 Make it more tolerant if we can't read strings. Probably unnecessary, was due to cro acting weird. diff -r 91b476ebc0f2 -r 19045ad9f5f5 usb488.py --- a/usb488.py Tue Dec 08 14:00:45 2020 +1030 +++ b/usb488.py Fri Jan 08 14:01:41 2021 +1030 @@ -135,7 +135,7 @@ break if not found: raise BaseException("Could not find a suitable USB device") - + # Open the device and claim the USB interface that supports the spec handle = dev.open() handle.setConfiguration(dev.configurations[confidx].value) @@ -145,9 +145,18 @@ self.handle = handle # Get some info for humans - self.vendname = handle.getString(dev.iManufacturer, 1024) - self.prodname = handle.getString(dev.iProduct, 1024) - self.serial = handle.getString(dev.iSerialNumber, 1024) + try: + self.vendname = handle.getString(dev.iManufacturer, 1024) + except ValueError: + self.vendname = None + try: + self.prodname = handle.getString(dev.iProduct, 1024) + except ValueError: + self.prodname = None + try: + self.serial = handle.getString(dev.iSerialNumber, 1024) + except ValueError: + self.serial = None # Determine the endpoints for each operation type self.intrep = self.bulkinep = self.bulkoutep = None