libusb doesn't always return str

This commit is contained in:
Firmware Batman 2017-05-01 20:39:02 -07:00
parent 2969e509c7
commit 421e5df270
1 changed files with 2 additions and 2 deletions

View File

@ -95,12 +95,12 @@ class Panda(object):
pass
def get_serial(self):
dat = self.handle.controlRead(usb1.TYPE_VENDOR | usb1.RECIPIENT_DEVICE, 0xd0, 0, 0, 0x20)
dat = str(self.handle.controlRead(usb1.TYPE_VENDOR | usb1.RECIPIENT_DEVICE, 0xd0, 0, 0, 0x20))
assert dat[0x1c:] == hashlib.sha1(dat[0:0x1c]).digest()[0:4]
return [dat[0:0x10], dat[0x10:0x10+10]]
def get_secret(self):
dat = self.handle.controlRead(usb1.TYPE_VENDOR | usb1.RECIPIENT_DEVICE, 0xd0, 1, 0, 0x10)
dat = str(self.handle.controlRead(usb1.TYPE_VENDOR | usb1.RECIPIENT_DEVICE, 0xd0, 1, 0, 0x10))
return dat.encode("hex")
# ******************* configuration *******************