forked from commaai/panda
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathread_winusb_descriptors.py
29 lines (23 loc) · 1.05 KB
/
read_winusb_descriptors.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/env python
from panda import Panda
from hexdump import hexdump
DEBUG = False
if __name__ == "__main__":
p = Panda()
len = p._handle.controlRead(Panda.REQUEST_IN, 0x06, 3 << 8 | 238, 0, 1)
print 'Microsoft OS String Descriptor'
dat = p._handle.controlRead(Panda.REQUEST_IN, 0x06, 3 << 8 | 238, 0, len[0])
if DEBUG: print 'LEN: {}'.format(hex(len[0]))
hexdump("".join(map(chr, dat)))
ms_vendor_code = dat[16]
if DEBUG: print 'MS_VENDOR_CODE: {}'.format(hex(len[0]))
print '\nMicrosoft Compatible ID Feature Descriptor'
len = p._handle.controlRead(Panda.REQUEST_IN, ms_vendor_code, 0, 4, 1)
if DEBUG: print 'LEN: {}'.format(hex(len[0]))
dat = p._handle.controlRead(Panda.REQUEST_IN, ms_vendor_code, 0, 4, len[0])
hexdump("".join(map(chr, dat)))
print '\nMicrosoft Extended Properties Feature Descriptor'
len = p._handle.controlRead(Panda.REQUEST_IN, ms_vendor_code, 0, 5, 1)
if DEBUG: print 'LEN: {}'.format(hex(len[0]))
dat = p._handle.controlRead(Panda.REQUEST_IN, ms_vendor_code, 0, 5, len[0])
hexdump("".join(map(chr, dat)))