support on device dongle secret

master
George Hotz 2017-04-28 17:49:55 -07:00
parent b3fa6f529f
commit 36ab1def6d
2 changed files with 11 additions and 2 deletions

View File

@ -554,8 +554,13 @@ int __usb_cb_control_msg(USB_Setup_TypeDef *setup, uint8_t *resp, int hardwired)
case 0xd0:
// fetch serial number
#ifdef PANDA
memcpy(resp, 0x1fff79e0, 0x20);
resp_len = 0x20;
if (setup->b.wValue.w == 1) {
memcpy(resp, 0x1fff79c0, 0x10);
resp_len = 0x10;
} else {
memcpy(resp, 0x1fff79e0, 0x20);
resp_len = 0x20;
}
#endif
break;
case 0xd1:

View File

@ -93,6 +93,10 @@ class Panda(object):
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)
return dat.encode("hex")
# ******************* configuration *******************
def set_gmlan(self, on):