mirror of https://github.com/commaai/panda.git
libusb doesn't always return str
This commit is contained in:
parent
2969e509c7
commit
421e5df270
|
@ -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 *******************
|
||||
|
|
Loading…
Reference in New Issue