def led_mask(dev, mask): _bulkRead, bulkWrite, _controlRead, _controlWrite = usb_wraps(dev) mask = led_s2i.get(mask, mask) if mask < 0 or mask > 7: raise ValueError("Bad mask") bulkWrite("0x02, \x0C" + chr(mask))
def cmd_3B(dev): _bulkRead, bulkWrite, _controlRead, _controlWrite = usb_wraps(dev) bulkWrite(0x02, "\x3B\x0C\x22\x00\xC0\x40\x00\x3B\x0E\x22\x00\xC0\x00\x00\x3B\x1A" \ "\x22\x00\xC0\x18\x00" )
def read_adc(dev): bulkRead, bulkWrite, _controlRead, _controlWrite = usb_wraps(dev) print 'WARNING: best guess' for reg in (0x01, 0x10, 0x05, 0x15, 0x0C, 0x09, 0x14): print '0x%02X' % reg for i in xrange(3): buff = bulk2(dev, "\x19" + chr(reg) + "\x00", target=2, truncate=True) b = struct.unpack('<H', buff)[0] print ' 0x%04X (%0.3f V)' % (b, scalars[reg] * b)
def load_fx2(dev): _bulkRead, _bulkWrite, _controlRead, controlWrite = usb_wraps(dev) # hold fx2 in reset # Generated from packet 129/130 controlWrite(0x40, 0xA0, 0xE600, 0x0000, "\x01") time.sleep(0.005) #print 'return' #return ''' Load firmware What is the difference between 0xB0 and 0xA0 requests? odd phase shift -rw-r--r-- 1 root root 1023 Apr 22 22:11 p131.bin -rw-r--r-- 1 root root 1023 Apr 22 22:11 p133.bin -rw-r--r-- 1 root root 1023 Apr 22 22:11 p135.bin -rw-r--r-- 1 root root 1000 Apr 22 22:11 p137.bin ''' # Generated from packet 131/132 #open('p131.bin', 'w').write(p131) controlWrite(0x40, 0xA0, 0x0000, 0x0000, bp1410_fw_fx2.p131) # odd...why are they writing the serial number out? # Generated from packet 133/134 #open('p133.bin', 'w').write(p133) controlWrite(0x40, 0xA0, 0x03FF, 0x0000, bp1410_fw_fx2.p133) # Generated from packet 135/136 #open('p135.bin', 'w').write(p135) controlWrite(0x40, 0xA0, 0x07FE, 0x0000, bp1410_fw_fx2.p135) # Generated from packet 137/138 #open('p137.bin', 'w').write(p137) controlWrite(0x40, 0xA0, 0x0BFD, 0x0000, bp1410_fw_fx2.p137) time.sleep(0.003) # Generated from packet 139/140 # release fx2 reset, resetting mcu controlWrite(0x40, 0xA0, 0xE600, 0x0000, "\x00")
def cleanup_adc(dev): _bulkRead, bulkWrite, _controlRead, _controlWrite = usb_wraps(dev) # Generated from packet 1220/1221 bulkWrite(0x02, "\x50\x1A\x00\x00\x00") # Generated from packet 1222/1223 buff = bulk2(dev, "\x66\xB9\x00\x00\xB2\x02\xFB\xFF\x25\x44\x11\x00\x00\x66\xB9\x00" "\x00\xB2\x02\xFB\xFF\x25\x44\x11\x00\x00", target=2, truncate=True) validate_read("\x83\x00", buff, "packet 1224/1225") # Generated from packet 1226/1227 buff = bulk2(dev, "\x02", target=6, truncate=True) validate_read("\x84\x00\x50\x01\x09\x00", buff, "packet 1228/1229") # Generated from packet 1230/1231 buff = bulk2(dev, "\x57\x83\x00", target=2, truncate=True) validate_read("\x00\x00", buff, "packet 1232/1233") # Generated from packet 1234/1235 led_mask(dev, 0x04)
def cleanup_adc(dev): _bulkRead, bulkWrite, _controlRead, _controlWrite = usb_wraps(dev) # Generated from packet 1220/1221 bulkWrite(0x02, "\x50\x1A\x00\x00\x00") # Generated from packet 1222/1223 buff = bulk2( dev, "\x66\xB9\x00\x00\xB2\x02\xFB\xFF\x25\x44\x11\x00\x00\x66\xB9\x00" "\x00\xB2\x02\xFB\xFF\x25\x44\x11\x00\x00", target=2, truncate=True) validate_read("\x83\x00", buff, "packet 1224/1225") # Generated from packet 1226/1227 buff = bulk2(dev, "\x02", target=6, truncate=True) validate_read("\x84\x00\x50\x01\x09\x00", buff, "packet 1228/1229") # Generated from packet 1230/1231 buff = bulk2(dev, "\x57\x83\x00", target=2, truncate=True) validate_read("\x00\x00", buff, "packet 1232/1233") # Generated from packet 1234/1235 led_mask(dev, 0x04)
def boot_cold(dev): bulkRead, bulkWrite, controlRead, _controlWrite = usb_wraps(dev) # Generated from packet 70/71 buff = bulk2( dev, "\x43\x19\x00\x00\x00\x3B\x66\x1B\x00\x00\xFE\xFF\x3B\x64\x1B\x00" "\x00\xFE\xFF\x00", target=2) validate_read("\xA4\x06", buff, "packet 72/73") # Generated from packet 74/75 cmd_01(dev) # Atomic # cmd_01 state: 0x80 => 0x81 # Generated from packet 78/79 bulkWrite(0x02, cmd_43_mk("\x00") + cmd_11_mk()) # Generated from packet 80/85 bulkWrite(0x02, bp1410_fw_sn.p223) # Generated from packet 81/86 bulkWrite(0x02, bp1410_fw_sn.p224) # Generated from packet 82/87 bulkWrite(0x02, bp1410_fw_sn.p225) # Generated from packet 83/88 bulkWrite(0x02, bp1410_fw_sn.p226) # Generated from packet 84/89 bulkWrite(0x02, bp1410_fw_sn.p227) # Generated from packet 90/91 buff = bulk2(dev, "\x5A", target=1) validate_read("\x80", buff, "packet 92/93") cmd_01(dev) # temp # Atomic # cmd_01 state: 0x81 => 0x82 # Generated from packet 94/95 bulkWrite(0x02, "\x11\x10\x00") # Generated from packet 96/97 bulkWrite( 0x02, "\xEA\xCC\x64\x01\x00\x08\x00\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x3F") # Generated from packet 98/99 buff = bulk2(dev, "\xA6", target=1) validate_read("\x81", buff, "packet 100/101") cmd_01(dev) # temp # Atomic # cmd_01 state: 0x82 => 0x83 # Generated from packet 102/103 bulkWrite(0x02, "\x11\x4E\x00") # Generated from packet 104/105 bulkWrite( 0x02, "\xE8\x00\x00\x00\x00\xFA\x5A\x83\xEA\x05\x81\xEA\x00\x00\x01\x00" "\x81\xFA\x00\x00\x01\x00\x74\x1F\xBB\x00\x00\x00\x00\xB9\x00\x00" "\x01\x00\x66\x8B\x02\x66\x89\x83\x00\x00\x01\x00\x83\xC2\x02\x83" "\xC3\x02\x83\xE9\x02\x75\xEB\x8C\xC8\x50\xB8\xF0\xFF\x01\x00\x50" "\x0F\x20\xC0\x0D\x00\x00\x00\x60\x0F\x22\xC0\x0F\x09\xC3") # Generated from packet 106/107 buff = bulk2(dev, "\xDB", target=1) validate_read("\x82", buff, "packet 108/109") cmd_01(dev) # temp # cmd_01 state: 0x83 => 0x80. Length 129 => 133 # Generated from packet 110/111 buff = bulk2(dev, "\x82", target=1) validate_read("\x16", buff, "packet 112/113") # Generated from packet 114/115 cmd_01(dev)
def replay(dev): bulkRead, bulkWrite, controlRead, controlWrite = usb_wraps(dev) ''' cmd_01 ''' # Generated from packet 169/170 # ... # Generated from packet 179/180 load_fx2(dev) # Generated from packet 50/51 # None (0xB0) buff = controlRead(0xC0, 0xB0, 0x0000, 0x0000, 4096) # NOTE:: req max 4096 but got 3 validate_read("\x00\x00\x00", buff, "packet 50/51") # Generated from packet 55/56 # None (0xB0) buff = controlRead(0xC0, 0xB0, 0x0000, 0x0000, 4096) # NOTE:: req max 4096 but got 3 validate_read("\x00\x00\x00", buff, "packet 55/56") # Generated from packet 57/58 buff = bulkRead(0x86, 0x0200) # NOTE:: req max 512 but got 4 validate_read("\x08\x16\x01\x00", buff, "packet 57/58") # Generated from packet 62/63 # None (0xB0) buff = controlRead(0xC0, 0xB0, 0x0000, 0x0000, 4096) # NOTE:: req max 4096 but got 3 validate_read("\x00\x00\x00", buff, "packet 62/63") # Generated from packet 64/65 buff = bulkRead(0x86, 0x0200) # NOTE:: req max 512 but got 4 validate_read("\x08\x16\x01\x00", buff, "packet 64/65") # Generated from packet 66/67 buff = cmd_01(dev) # Seems to be okay if we always do this although its only sometimes needed glitch_154 = True # All of these are the same except for the state byte # maybe varies depending if SM installed if len(buff) == 129: print 'Cold boot' state = ord(buff[0x13]) if state != 0x80: print ' WARNING: state: 0x%02X. Interrupted load?' % state # 70-117 boot_cold(dev) elif len(buff) == 133: print 'Warm boot' # 70-76 boot_warm(dev) # elif buff == r01_glitch_154: # print 'Warm boot (glitch)' # glitch_154 = True # # 70-76 # boot_warm(dev) else: raise Exception("Bad warm/cold response") # Packets going forward are from cold boot since its more canonical / clean # warm -40 packet (ie 120 cold => 80 warm) sn_read(dev) cmd_01(dev) # temp # Generated from packet 122/123 buff = bulk2( dev, "\x14\x38\x25\x00\x00\x04\x00\x90\x32\x90\x00\xA7\x02\x1F\x00\x14" "\x40\x25\x00\x00\x01\x00\x3C\x36\x0E\x01", target=0x20) validate_read( "\x14\x00\x54\x41\x38\x34\x56\x4C\x56\x5F\x46\x58\x34\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x3E" "\x2C", buff, "packet 124/125") cmd_01(dev) # temp # Generated from packet 126/127 gpio_readi(dev) cmd_01(dev) # temp # Generated from packet 130/131 gpio_readi(dev) # Generated from packet 134/135 sm_read(dev) # Generated from packet 138/139 cmd_01(dev) # Generated from packet 142/143 bulkWrite(0x02, "\x43\x19\x00\x00\x00") # Generated from packet 144/145 bulkWrite(0x02, "\x20\x01\x00\x0C\x04") # Generated from packet 146/147 bulkWrite(0x02, "\x41\x00\x00") # Generated from packet 148/149 # cmd_01[0x17]: 0x00 => 0x09 # warm: als state 0x83 => 0x80, 0x15: 0x30 => 0x00, 016: 0x01 => 0x00 buff = bulk2(dev, "\x10\x80\x02", target=6) validate_read("\x80\x00\x00\x00\x09\x00", buff, "packet 150/151") # Generated from packet 152/153 buff = bulk2(dev, "\x45\x01\x00\x00\x31\x00\x06", target=0x64) validate_read( "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" "\xFF\xFF\xFF\xFF\xFF", buff, "packet 154/155") # Generated from packet 156/157 cmd_49(dev) # Generated from packet 160/161 gpio_readi(dev) # Generated from packet 164/165 gpio_readi(dev) # Generated from packet 168/169 sm_read(dev) # Generated from packet 172/173 bulkWrite( 0x02, "\x3B\x0C\x22\x00\xC0\x30\x00\x3B\x0E\x22\x00\xC0\x00\x00\x3B\x1A" "\x22\x00\xC0\x18\x00") cmd_01(dev) # temp # Generated from packet 174/175 buff = bulk2(dev, "\x4A\x03\x00\x00\x00", target=2) validate_read("\x03\x00", buff, "packet 176/177") # Atomic # Generated from packet 178/179 bulkWrite(0x02, "\x4C\x00\x02") # Generated from packet 180/181 # None (0xB2) controlWrite(0x40, 0xB2, 0x0000, 0x0000, "") # Atomic # cmd_01 state: 0x80 => 0x81 # Generated from packet 182/183 cmd_50(dev, "\x45\x00") # Generated from packet 184/185 # FIXME: size field unexpected buff = bulk2( dev, "\xE9\x03\x00\x00\x00\x90\x00\x00\xE9\x03\x00\x00\x00\x90\x01\x10" "\xE9\x03\x00\x00\x00\x90\x00\x00\xE9\x03\x00\x00\x00\x90\x01\x80" "\xE9\x02\x00\x00\x00\x90\x00\xE9\x04\x00\x00\x00\x00\x00\x00\x00" "\xE9\x03\x00\x00\x00\x90\x00\x00\x66\xB9\x00\x00\xB2\x00\xFB\xFF" "\x25\x44\x11\x00\x00", target=2) validate_read("\x80\x00", buff, "packet 186/187") # cmd_01[0x15]: 0x00 => 0x50 # Generated from packet 188/189 cmd_02(dev, "\x81\x00\x50\x00\x09\x00", "packet 190/191") # Atomic # cmd_01 state: 0x81 => 0x82 # Generated from packet 192/193 cmd_50(dev, "\xC0\x00") # Generated from packet 194/195 buff = bulk2( dev, "\x66\xB8\x01\x2D\x81\xE3\xFF\xFF\x00\x00\x66\xBB\x18\x00\x66\xC7" "\x05\x30\x40\x00\xC0\xF0\xFF\x89\xD9\xC1\xE1\x02\x66\xC7\x81\x02" "\x00\x00\x00\xF0\xFF\x66\x03\x05\xE4\x46\x00\x00\x66\x89\x05\x90" "\x40\x00\xC0\x89\xDA\x81\xCA\x00\x80\x00\x00\x66\x89\x15\x50\x40" "\x00\xC0\xC6\x05\x14\x22\x00\xC0\x7B\x81\xCA\x00\x40\x00\x00\x66" "\x89\x15\x50\x40\x00\xC0\x89\xD9\x66\xC1\xE1\x02\x66\x89\x81\x00" "\x00\x00\x00\x66\x2B\x05\xE4\x46\x00\x00\xC6\x05\x14\x22\x00\xC0" "\xBB\x81\xCB\x00\x80\x00\x00\x66\x89\x1D\x50\x40\x00\xC0\x89\xC2" "\x81\xE2\x07\x00\x00\x00\x03\xD2\x81\xCA\x01\x00\x00\x00\x89\xD9" "\x81\xE1\x03\x00\x00\x00\xD3\xE2\xD3\xE2\xD3\xE2\xD3\xE2\xD3\xE2" "\xC1\xE2\x0A\x89\xD9\x81\xE1\xFC\x03\x00\x00\x09\xCA\x88\x82\x00" "\x00\x00\x40\x66\xB9\x00\x00\xB2\x00\xFB\xFF\x25\x44\x11\x00\x00", target=2) validate_read("\x81\x00", buff, "packet 196/197") # cmd_01: 0x15: 0x50 => 0x01. 0x16: 0x00 => 0x01 # Generated from packet 198/199 cmd_02(dev, "\x82\x00\x10\x01\x09\x00", "packet 200/201") if glitch_154: buff = bulk2( dev, "\x08\x20\x09\x20\x0A\x20\x0B\x20\x57\x81\x00\x0C\x04\x30", target=2) validate_read("\x04\x00", buff, "packet 204/205") else: # Think this clears the red light # Generated from packet 202/203 buff = bulk2( dev, "\x04\x72\x05\x73\x06\x2E\x07\x70\x08\x75\x09\x73\x0A\x68\x0B\x28" "\x57\x81\x00\x0C\x04\x30", target=2) validate_read("\x04\x00", buff, "packet 204/205") # Generated from packet 206/207 buff = bulk2( dev, "\x3B\x0C\x22\x00\xC0\x30\x00\x3B\x0E\x22\x00\xC0\x00\x00\x3B\x1A" "\x22\x00\xC0\x18\x00\x0E\x01", target=0x20) validate_read( "\x14\x00\x54\x41\x38\x34\x56\x4C\x56\x5F\x46\x58\x34\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x3E" "\x2C", buff, "packet 208/209") # Generated from packet 210/211 gpio_readi(dev) # Generated from packet 214/215 gpio_readi(dev) # Generated from packet 218/219 sm_read(dev) # Atomic # cmd_01 state: 0x82 => 0x83 # Generated from packet 222/223 bulkWrite(0x02, "\x48\x00\x20\x00\x00\x50\x12\x00\x00\x00") # Generated from packet 224/225 buff = bulk2( dev, "\x00\x00\x00\x00\x04\x00\x08\x00\x0C\x00\x10\x00\x14\x00\x18\x00" "\x1C\x00", target=2) validate_read("\x82\x00", buff, "packet 226/227") # Generated from packet 228/229 cmd_02(dev, "\x83\x00\x30\x01\x09\x00", "packet 230/231") # cmd_01: 0x15: 0x10 => 0x30 # Generated from packet 232/233 buff = bulk2( dev, "\x1D\x10\x01\x09\x00\x00\x00\x15\x60\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x1C\x00\x00\x48\x00\x12\xAA", target=1) validate_read("\xAB", buff, "packet 234/235") # Generated from packet 236/237 gpio_readi(dev) cmd_01(dev) # temp
def replay(dev, fw, cont=True, blank=True): bulkRead, bulkWrite, controlRead, controlWrite = usb_wraps(dev) # Generated by uvusbreplay 0.1 # uvusbreplay copyright 2011 John McMaster <*****@*****.**> # cmd: /home/mcmaster/bin/usbrply --packet-numbers --no-setup --comment --fx2 --packet-numbers -j cap/2015-10-11/i87c51_13_write_cont_id_blank_v2_ff.cap # FIXME: size? read.replay1(dev, cont) # Generated from packet 363/364 cmd_57s(dev, '\x8C', "\x00\x00") # Generated from packet 367/368 cmd_50(dev, "\x18\x00") # Generated from packet 369/370 buff = bulk2(dev, "\x66\xB8\x01\x2D\x66\x89\x05\x06\x00\x09\x00\x66\xB9\x00\x00\xB2" \ "\x00\xFB\xFF\x25\x44\x11\x00\x00" , target=0x02) validate_read("\x8F\x00", buff, "packet W: 369/370, R: 371/372") # Generated from packet 373/374 buff = bulk2(dev, "\x02", target=0x06) validate_read("\x90\x00\xB0\x5D\x09\x00", buff, "packet W: 373/374, R: 375/376") # Generated from packet 377/378 buff = bulk2(dev, "\x57\x8F\x00\x57\x89\x00", target=0x02) validate_read("\x00\x00", buff, "packet W: 377/378, R: 379/380") # Generated from packet 381/382 cmd_50(dev, "\x0A\x06") # Generated from packet 383/384 buff = bulk2(dev, write_fw.p383, target=0x02) validate_read("\x90\x00", buff, "packet W: 383/384, R: 385/386") # Generated from packet 387/388 buff = bulk2(dev, "\x02", target=0x06) validate_read("\x91\x00\xC0\x63\x09\x00", buff, "packet W: 387/388, R: 389/390") # Generated from packet 391/392 if blank: print 'Blank checking' tstart = time.time() buff = bulk2(dev, "\x08\x00\x57\x90\x00", target=0x02) tend = time.time() print 'Blank test took %0.3f sec' % (tend - tstart, ) if buff == "\x00\x00": print 'Blank: pass' elif buff == "\x01\x00": raise NotBlank('Blank: fail') else: hexdump(buff) raise Exception("Unknown blank status") # Generated from packet 395/396 cmd_57s(dev, '\x8C', "\x00\x00") # Generated from packet 399/400 cmd_50(dev, "\x18\x00") # Generated from packet 401/402 buff = bulk2(dev, "\x66\xB8\x01\x32\x66\x89\x05\x06\x00\x09\x00\x66\xB9\x00\x00\xB2" \ "\x00\xFB\xFF\x25\x44\x11\x00\x00" , target=0x02) validate_read("\x91\x00", buff, "packet W: 401/402, R: 403/404") # Generated from packet 405/406 buff = bulk2(dev, "\x02", target=0x06) validate_read("\x92\x00\xE0\x63\x09\x00", buff, "packet W: 405/406, R: 407/408") # Generated from packet 409/410 buff = bulk2(dev, "\x57\x91\x00\x57\x89\x00", target=0x02) validate_read("\x00\x00", buff, "packet W: 409/410, R: 411/412") # Generated from packet 413/414 cmd_50(dev, "\x9F\x09") # Generated from packet 415/416 buff = bulk2(dev, write_fw.p415, target=0x02) validate_read("\x92\x00", buff, "packet W: 415/416, R: 417/418") # Generated from packet 419/420 buff = bulk2(dev, "\x02", target=0x06) validate_read("\x93\x00\x80\x6D\x09\x00", buff, "packet W: 419/420, R: 421/422") # Generated from packet 423/424 buff = bulk2(dev, "\x57\x92\x00", target=0x01) validate_read("\x62", buff, "packet W: 423/424, R: 425/426") # Generated from packet 427/428 # NOTE: prefix 0x18 buff = bulk86(dev, target=0x01, prefix=0x18) validate_read("\x0B", buff, "packet 427/428") # Generated from packet 429/430 fw_w(dev, fw, verbose=True) # Generated from packet 513/514 cmd_57s(dev, '\x8C', "\x00\x00") # Generated from packet 517/518 cmd_50(dev, "\x18\x00") # Generated from packet 519/520 buff = bulk2(dev, "\x66\xB8\x01\x2D\x66\x89\x05\x06\x00\x09\x00\x66\xB9\x00\x00\xB2" \ "\x00\xFB\xFF\x25\x44\x11\x00\x00" , target=0x02) validate_read("\x93\x00", buff, "packet W: 519/520, R: 521/522") # Generated from packet 523/524 buff = bulk2(dev, "\x02", target=0x06) validate_read("\x94\x00\xA0\x6D\x09\x00", buff, "packet W: 523/524, R: 525/526") # Generated from packet 527/528 buff = bulk2(dev, "\x57\x93\x00\x57\x89\x00", target=0x02) validate_read("\x00\x00", buff, "packet W: 527/528, R: 529/530") # Generated from packet 531/532 cmd_50(dev, "\xE0\x08") # Generated from packet 533/534 buff = bulk2(dev, write_fw.p533, target=0x02) validate_read("\x94\x00", buff, "packet W: 533/534, R: 535/536") # Generated from packet 537/538 buff = bulk2(dev, "\x02", target=0x06) validate_read("\x95\x00\x80\x76\x09\x00", buff, "packet W: 537/538, R: 539/540") # Generated from packet 541/542 cmd_57_94(dev) # Generated from packet 547/548 fw_w(dev, fw) # Generated from packet 631/632 cmd_57s(dev, '\x8C', "\x00\x00") # Generated from packet 635/636 cmd_50(dev, "\x18\x00") # Generated from packet 637/638 buff = bulk2(dev, "\x66\xB8\x01\x37\x66\x89\x05\x06\x00\x09\x00\x66\xB9\x00\x00\xB2" \ "\x00\xFB\xFF\x25\x44\x11\x00\x00" , target=0x02) validate_read("\x95\x00", buff, "packet W: 637/638, R: 639/640") # Generated from packet 641/642 buff = bulk2(dev, "\x02", target=0x06) validate_read("\x96\x00\xA0\x76\x09\x00", buff, "packet W: 641/642, R: 643/644") # Generated from packet 645/646 buff = bulk2(dev, "\x57\x95\x00\x57\x89\x00", target=0x02) validate_read("\x00\x00", buff, "packet W: 645/646, R: 647/648") # Generated from packet 649/650 cmd_57_94(dev) # Generated from packet 655/656 fw_w(dev, fw) # Generated from packet 739/740 cmd_57s(dev, '\x8C', "\x00\x00") # Generated from packet 743/744 cmd_50(dev, "\x0D\x00") # Generated from packet 745/746 buff = bulk2(dev, "\x66\xB9\x00\x00\xB2\x00\xFB\xFF\x25\x44\x11\x00\x00", target=0x02) validate_read("\x96\x00", buff, "packet W: 745/746, R: 747/748") # Generated from packet 749/750 buff = bulk2(dev, "\x02", target=0x06) validate_read("\x97\x00\xB0\x76\x09\x00", buff, "packet W: 749/750, R: 751/752") # Generated from packet 753/754 cmd_57_50(dev, "\x96", "\x1A\x00") # Generated from packet 755/756 buff = bulk2(dev, "\x66\xB9\x00\x00\xB2\x02\xFB\xFF\x25\x44\x11\x00\x00\x66\xB9\x00" \ "\x00\xB2\x02\xFB\xFF\x25\x44\x11\x00\x00" , target=0x02) validate_read("\x97\x00", buff, "packet W: 755/756, R: 757/758") # Generated from packet 759/760 buff = bulk2(dev, "\x02", target=0x06) validate_read("\x98\x00\xD0\x76\x09\x00", buff, "packet W: 759/760, R: 761/762") # Generated from packet 763/764 buff = bulk2(dev, "\x57\x97\x00", target=0x02) validate_read("\x00\x00", buff, "packet W: 763/764, R: 765/766") # Generated from packet 767/768 led_mask_30(dev, "pass") # Generated from packet 771/772 gpio_readi(dev) # Generated from packet 775/776 gpio_readi(dev) # Generated from packet 779/780 sm_info22(dev) # Generated from packet 783/784 sm_info24(dev) # Generated from packet 787/788 sm_read(dev) # Generated from packet 791/792 cmd_49(dev) # Generated from packet 795/796 sm_read(dev) # Generated from packet 799/800 sm_insert(dev) # Generated from packet 803/804 sm_info10(dev)
def cmd_09(dev): _bulkRead, bulkWrite, _controlRead, _controlWrite = usb_wraps(dev) bulkWrite(0x02, "\x09\x10\x57\x81\x00")
def replay1(dev, cont=True): _bulkRead, bulkWrite, controlRead, controlWrite = usb_wraps(dev) # Atomic # Generated from packet 11/12 buff = controlRead(0xC0, 0xB0, 0x0000, 0x0000, 4096) # Req: 4096, got: 3 validate_read("\x00\x00\x00", buff, "packet 11/12") # Generated from packet 13/14 buff = bulk86(dev, target=0x01) validate_read("\x16", buff, "packet 13/14") # Generated from packet 15/16 cmd_01(dev) # NOTE:: req max 512 but got 136 # Generated from packet 19/20 buff = bulk2(dev, "\x43\x19\x10\x00\x00\x3B\x7E\x25\x00\x00\xFE\xFF\x3B\x7C\x25\x00" \ "\x00\xFE\xFF\x00" , target=0x02) validate_read("\xA4\x06", buff, "packet W: 19/20, R: 21/22") # Generated from packet 23/24 cmd_01(dev) # Generated from packet 27/28 sn_read(dev) # NOTE:: req max 512 but got 35 # Generated from packet 31/32 buff = bulk2(dev, "\x14\x38\x25\x00\x00\x04\x00\x90\x32\x90\x00\xA7\x02\x1F\x00\x14" \ "\x40\x25\x00\x00\x01\x00\x3C\x36\x0E\x01" , target=0x20) validate_read( "\x14\x00\x54\x41\x38\x34\x56\x4C\x56\x5F\x46\x58\x34\x00\x00\x00" \ "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x3E\x2C" , buff, "packet W: 31/32, R: 33/34") sm_info1(dev) # Generated from packet 55/56 cmd_01(dev) # NOTE:: req max 512 but got 136 # Generated from packet 59/60 cmd_43(dev, "\x10") # Generated from packet 61/62 bulkWrite(0x02, cmd_20_mk() + cmd_0C_mk()) # Generated from packet 63/64 cmd_41(dev) # Generated from packet 65/66 cmd_10(dev) sm_read(dev) ''' validate_read( "\x11\x00\x53\x4D\x34\x38\x44\x00\x00\x00\x00\x00\x00\x00\x5D\xF4" \ "\x39\xFF\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x62\x6C" , buff, "packet W: 69/70, R: 71/72") ''' sm_insert(dev) # Generated from packet 77/78 cmd_45(dev) # Generated from packet 81/82 cmd_49(dev) sm_info1(dev) sm_insert(dev) # Generated from packet 117/118 sm_info10(dev) # Generated from packet 121/122 cmd_3B(dev) cmd_4A(dev) # NOTE:: req max 512 but got 5 # Generated from packet 127/128 cmd_4C(dev) # Generated from packet 129/130 # None (0xB2) buff = controlWrite(0x40, 0xB2, 0x0000, 0x0000, "") # Atomic # Generated from packet 131/132 cmd_50(dev, "\x5D\x00") # Generated from packet 133/134 buff = bulk2(dev, "\xE9\x03\x00\x00\x00\x90\x00\x00\xE9\x03\x00\x00\x00\x90\x01\x10" \ "\xE9\x03\x00\x00\x00\x90\x00\x00\xE9\x03\x00\x00\x00\x90\x01\x80" \ "\xE9\x02\x00\x00\x00\x90\x00\xE9\x04\x00\x00\x00\x00\x00\x00\x00" \ "\xE9\x03\x00\x00\x00\x90\x00\x00\xE9\x03\x00\x00\x00\x90\x00\x00" \ "\xE9\x03\x00\x00\x00\x90\x00\x00\xE9\x03\x00\x00\x00\x90\x00\x00" \ "\x66\xB9\x00\x00\xB2\x00\xFB\xFF\x25\x44\x11\x00\x00" , target=0x02) validate_read("\x80\x00", buff, "packet W: 133/134, R: 135/136") # Generated from packet 137/138 cmd_02(dev, "\x81\x00\x60\x00\x09\x00", "packet W: 137/138, R: 139/140") # Atomic # Generated from packet 141/142 cmd_50(dev, "\xC0\x00") # Generated from packet 143/144 buff = bulk2(dev, "\x66\xB8\x01\x2D\x81\xE3\xFF\xFF\x00\x00\x66\xBB\x18\x00\x66\xC7" \ "\x05\x30\x40\x00\xC0\xF0\xFF\x89\xD9\xC1\xE1\x02\x66\xC7\x81\x02" \ "\x00\x00\x00\xF0\xFF\x66\x03\x05\xE4\x46\x00\x00\x66\x89\x05\x90" \ "\x40\x00\xC0\x89\xDA\x81\xCA\x00\x80\x00\x00\x66\x89\x15\x50\x40" \ "\x00\xC0\xC6\x05\x14\x22\x00\xC0\x7B\x81\xCA\x00\x40\x00\x00\x66" \ "\x89\x15\x50\x40\x00\xC0\x89\xD9\x66\xC1\xE1\x02\x66\x89\x81\x00" \ "\x00\x00\x00\x66\x2B\x05\xE4\x46\x00\x00\xC6\x05\x14\x22\x00\xC0" \ "\xBB\x81\xCB\x00\x80\x00\x00\x66\x89\x1D\x50\x40\x00\xC0\x89\xC2" \ "\x81\xE2\x07\x00\x00\x00\x03\xD2\x81\xCA\x01\x00\x00\x00\x89\xD9" \ "\x81\xE1\x03\x00\x00\x00\xD3\xE2\xD3\xE2\xD3\xE2\xD3\xE2\xD3\xE2" \ "\xC1\xE2\x0A\x89\xD9\x81\xE1\xFC\x03\x00\x00\x09\xCA\x88\x82\x00" \ "\x00\x00\x40\x66\xB9\x00\x00\xB2\x00\xFB\xFF\x25\x44\x11\x00\x00" , target=0x02) validate_read("\x81\x00", buff, "packet W: 143/144, R: 145/146") # Generated from packet 147/148 cmd_02(dev, "\x82\x00\x20\x01\x09\x00", "packet W: 147/148, R: 149/150") # Generated from packet 151/152 cmd_09(dev) # Generated from packet 153/154 cmd_02(dev, "\x82\x00\x20\x01\x09\x00", "packet W: 153/154, R: 155/156") # added sm_insert(dev) print 'Going active' led_mask_30(dev, 'active') # Atomic # Generated from packet 161/162 cmd_50(dev, "\x18\x00") # Generated from packet 163/164 buff = bulk2(dev, "\x66\xB8\x01\x32\x66\x89\x05\x06\x00\x09\x00\x66\xB9\x00\x00\xB2" \ "\x00\xFB\xFF\x25\x44\x11\x00\x00" , target=0x02) validate_read("\x82\x00", buff, "packet W: 163/164, R: 165/166") # Generated from packet 167/168 cmd_02(dev, "\x83\x00\x40\x01\x09\x00", "packet W: 167/168, R: 169/170") # Generated from packet 171/172 buff = bulk2(dev, "\x57\x82\x00\x20\x01\x00\x2B\x3B\x0C\x22\x00\xC0\x40\x00\x3B\x0E" \ "\x22\x00\xC0\x00\x00\x3B\x1A\x22\x00\xC0\x18\x00\x0E\x01" , target=0x20) validate_read( "\x14\x00\x54\x41\x38\x34\x56\x4C\x56\x5F\x46\x58\x34\x00\x00\x00" \ "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x3E\x2C" , buff, "packet W: 171/172, R: 173/174") sm_info0(dev) # Generated from packet 195/196 buff = bulk2(dev, "\x48\x00\x10\x82\x02", target=0x06) validate_read("\x82\x00\x20\x01\x09\x00", buff, "packet W: 195/196, R: 197/198") # Generated from packet 199/200 bulkWrite(0x02, cmd_20_mk() + cmd_50_mk("\x7D\x02")) # Generated from packet 201/202 buff = bulk2(dev, read_fw.p201, target=0x02) validate_read("\x82\x00", buff, "packet W: 201/202, R: 203/204") # Generated from packet 205/206 cmd_02(dev, "\x83\x00\xA0\x03\x09\x00", "packet W: 205/206, R: 207/208") # Atomic # Generated from packet 209/210 cmd_57_50(dev, "\x82", "\x1D\x00") # Generated from packet 211/212 buff = bulk2(dev, "\xC7\x05\x74\x46\x00\x00\x0B\x00\x00\x00\xFF\x15\x38\x11\x00\x00" \ "\x66\xB9\x00\x00\xB2\x00\xFB\xFF\x25\x44\x11\x00\x00" , target=0x02) validate_read("\x83\x00", buff, "packet W: 211/212, R: 213/214") # Generated from packet 215/216 cmd_02(dev, "\x84\x00\xC0\x03\x09\x00", "packet W: 215/216, R: 217/218") # Atomic ''' Seems these must be done together Increments socket insertion count ''' # Generated from packet 219/220 cmd_57_50(dev, "\x83", "\x18\x3A") # p221.bin: DOS executable (COM) # Generated from packet 221/222 buff = bulk2(dev, read_fw.p221, target=0x02) validate_read("\x84\x00", buff, "packet W: 221/222, R: 223/224") # Generated from packet 225/226 cmd_02(dev, "\x85\x00\xE0\x3D\x09\x00", "packet W: 225/226, R: 227/228") # Generated from packet 229/230 bulkWrite(0x02, "\x57\x84\x00\xF0\xFF\xFF\x0F\xF0\xFF\xFF\x00\x00\x00\x00\x00\x00" \ "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" \ "\x00\x00\x00\x00\xF0\x0F\x00\x00\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" \ "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" ) # Atomic # Generated from packet 231/232 cmd_50(dev, "\xDE\x03") # Generated from packet 233/234 buff = bulk2(dev, read_fw.p233, target=0x02) validate_read("\x85\x00", buff, "packet W: 233/234, R: 235/236") # Generated from packet 237/238 cmd_02(dev, "\x86\x00\xC0\x41\x09\x00", "packet W: 237/238, R: 239/240") # The actual continuity check if cont: # Generated from packet 241/242 # Takes about 0.05 sec on pass but 0.52 sec on fail tstart = time.time() buff = cmd_57s(dev, "\x85", None, "cmd_57") tend = time.time() print 'Continuity test took %0.3f sec' % (tend - tstart,) hexdump(buff, label='Continuity', indent=' ') # Chip inserted if buff == "\x01": print 'Continuity OK' # Chip removed elif buff == ("\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" \ "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"): raise ContFail('Continuity complete failure (part not inserted?)') # Inserting chip while running # I'm guessing its telling me which pins failed # Lets bend a pin and verify else: raise ContFail('Continuity partial failure (dirty contacts? Inserted wrong?)') # Atomic with following operation # Generated from packet 245/246 cmd_50(dev, "\x62\x00") # Generated from packet 247/248 buff = bulk2(dev, "\x00\x00\x3C\x00\x38\x00\x34\x00\x30\x00\x3D\x00\x39\x00\x35\x00" \ "\x31\x00\x3E\x00\x3A\x00\x36\x00\x32\x00\x3F\x00\x3B\x00\x37\x00" \ "\x33\x00\x1E\x00\x1A\x00\x16\x00\x00\x00\x02\x00\x06\x00\x0A\x00" \ "\x0E\x00\x23\x00\x27\x00\x2B\x00\x2F\x00\x22\x00\x26\x00\x2A\x00" \ "\x2E\x00\x21\x00\x25\x00\x29\x00\x2D\x00\x20\x00\x24\x00\x28\x00" \ "\x1C\x00\x00\x00\x04\x00\x08\x00\x0C\x00\x10\x00\x14\x00\x18\x00" \ "\x1C\x00" , target=0x02) validate_read("\x86\x00", buff, "packet W: 247/248, R: 249/250") # Generated from packet 251/252 cmd_02(dev, "\x87\x00\x30\x42\x09\x00", "packet W: 251/252, R: 253/254") # Atomic with next # Generated from packet 255/256 bulkWrite(0x02, "\x1D\xC0\x41\x09\x00\x28\x00\x15\x60\x00\x00\x00\x00\x00\x00\x00" \ "\x00\x00\x01\x00\x00\x00\x1C\x30\x00\x00\x00\x08\x00\x00\x00\x48" \ "\x00\x50\x71\x09\x00\x00") # Generated from packet 257/258 buff = bulk2(dev, read_fw.p257, target=0x02) validate_read("\x87\x00", buff, "packet W: 257/258, R: 259/260") # Generated from packet 261/262 cmd_02(dev, "\x88\x00\xB0\x4B\x09\x00", "packet W: 261/262, R: 263/264") # Generated from packet 265/266 cmd_57s(dev, "\x87", "\x00\x00", "cmd_57") # Atomic # Generated from packet 269/270 cmd_50(dev, "\x17\x00") # Generated from packet 271/272 buff = bulk2(dev, "\xC7\x05\x2C\x00\x09\x00\x24\x04\x00\x00\x66\xB9\x00\x00\xB2\x00" \ "\xFB\xFF\x25\x44\x11\x00\x00" , target=0x02) validate_read("\x88\x00", buff, "packet W: 271/272, R: 273/274") # Generated from packet 275/276 cmd_02(dev, "\x89\x00\xD0\x4B\x09\x00", "packet W: 275/276, R: 277/278") # Atomic # Generated from packet 279/280 cmd_57_50(dev, "\x88", "\x32\x07") # Generated from packet 281/282 buff = bulk2(dev, read_fw.p281, target=0x02) validate_read("\x89\x00", buff, "packet W: 281/282, R: 283/284") # Generated from packet 285/286 cmd_02(dev, "\x8A\x00\x10\x53\x09\x00", "packet W: 285/286, R: 287/288") # Generated from packet 289/290 cmd_57s(dev, '\x89', "\x00\x00") # Atomic # Generated from packet 293/294 cmd_50(dev, "\x3D\x03") # Generated from packet 295/296 buff = bulk2(dev, read_fw.p295, target=0x02) validate_read("\x8A\x00", buff, "packet W: 295/296, R: 297/298") # Generated from packet 299/300 cmd_02(dev, "\x8B\x00\x50\x56\x09\x00", "packet W: 299/300, R: 301/302") # Generated from packet 303/304 cmd_57s(dev, "\x8A", "\x89\x00") # Atomic # Generated from packet 307/308 cmd_50(dev, "\x1D\x00") # Generated from packet 309/310 buff = bulk2(dev, "\x66\x8B\x0D\x1A\x24\x00\x00\xB2\x02\xFB\xFF\x25\x44\x11\x00\x00" \ "\x66\xB9\x00\x00\xB2\x02\xFB\xFF\x25\x44\x11\x00\x00" , target=0x02) validate_read("\x8B\x00", buff, "packet W: 309/310, R: 311/312") # Generated from packet 313/314 cmd_02(dev, "\x8C\x00\x70\x56\x09\x00", "packet W: 313/314, R: 315/316") # Generated from packet 317/318 # Bad part returns \x59\x00 but otherwise can be read # (with partially corrupt bit pattern) if cont: buff = cmd_57s(dev, "\x8B", None) if buff == "\x59\x00": raise Exception("Failed 0x8B health check") else: validate_read("\x58\x00", buff, "") # Atomic # Generated from packet 321/322 cmd_50(dev, "\xF8\x04") # Generated from packet 323/324 buff = bulk2(dev, read_fw.p323, target=0x02) validate_read("\x8C\x00", buff, "packet W: 323/324, R: 325/326") # Generated from packet 327/328 cmd_02(dev, "\x8D\x00\x70\x5B\x09\x00", "packet W: 327/328, R: 329/330") # Generated from packet 331/332 cmd_57s(dev, '\x8C', "\x00\x00") # Atomic # Generated from packet 335/336 cmd_50(dev, "\x18\x00") # Generated from packet 337/338 buff = bulk2(dev, "\x66\xB8\x01\x32\x66\x89\x05\x06\x00\x09\x00\x66\xB9\x00\x00\xB2" \ "\x00\xFB\xFF\x25\x44\x11\x00\x00" , target=0x02) validate_read("\x8D\x00", buff, "packet W: 337/338, R: 339/340") # Generated from packet 341/342 cmd_02(dev, "\x8E\x00\x90\x5B\x09\x00", "packet W: 341/342, R: 343/344") # Generated from packet 345/346 cmd_57s(dev, "\x8D\x89", "\x00\x00") # Atomic # Generated from packet 349/350 cmd_50(dev, "\xFA\x01") # Generated from packet 351/352 buff = bulk2(dev, read_fw.p351, target=0x02) validate_read("\x8E\x00", buff, "packet W: 351/352, R: 353/354") # Generated from packet 355/356 cmd_02(dev, "\x8F\x00\x90\x5D\x09\x00", "packet W: 355/356, R: 357/358") # Generated from packet 323/324 cmd_08(dev, "\x8E") # Generated from packet 363/364 cmd_57s(dev, '\x8C', "\x00\x00")
def cmd_50(dev, cmd): _bulkRead, bulkWrite, _controlRead, _controlWrite = usb_wraps(dev) # No reply bulkWrite(0x02, cmd_50_mk(cmd))
def cmd_4C(dev): _bulkRead, bulkWrite, _controlRead, _controlWrite = usb_wraps(dev) bulkWrite(0x02, "\x4C\x00\x02")
def cmd_43(dev, cmd): _bulkRead, bulkWrite, _controlRead, _controlWrite = usb_wraps(dev) # "\x43\x19\x00\x00\x00" # "\x43\x19\x10\x00\x00" bulkWrite(0x02, cmd_43_mk(cmd))
def replay_setup(dev): bulkRead, bulkWrite, controlRead, controlWrite = usb_wraps(dev) # Verified that control request allows bulk to be read # Generated from packet 281/282 # None (0xB0) buff = controlRead(0xC0, 0xB0, 0x0000, 0x0000, 4096) # NOTE:: req max 4096 but got 3 validate_read("\x00\x00\x00", buff, "packet 281/282") buff = bulk86(dev, target=1) validate_read("\x16", buff, "packet 283/284") # Generated from packet 285/286 buff = bulk2(dev, "\x01", target=0x85) validate_readv(( "\x84\xA4\x06\x02\x00\x26\x00\x43\x00\xC0\x03\x00\x08\x10\x24" "\x00\x00\x30\x00\x83\x00\x30\x01\x09\x00\xC0\x00\x00\x00\x09\x00" "\x08\x00\xFF\x00\xC4\x1E\x00\x00\xCC\x1E\x00\x00\xB4\x46\x00\x00" "\xD0\x1E\x00\x00\xC0\x1E\x01\x00\xB0\x1E\x01\x00\x00\x00\x30\x55" "\x01\x00\x00\x00\x00\x00\x02\x00\x80\x01\xD0\x01\x02\x00\x01\x00" "\x00\x00\x56\x10\x00\x00\xA0\x25\x00\x00\x84\x25\x00\x00\x00\x00" "\x01\x00\x7C\x25\x00\x00\x7E\x25\x00\x00\x80\x25\x00\x00\x74\x46" "\x00\x00\x38\x11\x00\x00\x3C\x11\x00\x00\x40\x11\x00\x00\x44\x11" "\x00\x00\xC0\x1E\x00\x00", "\x84\xA4\x06\x02\x00\x26\x00\x43\x00\xC0\x03\x00\x08\x10\x24\x00" \ "\x00\x30\x00\x83\x00\x30\x01\x09\x00\xC0\x00\x00\x00\x09\x00\x08" \ "\x00\xFF\x00\xC4\x1E\x00\x00\xCC\x1E\x00\x00\xB4\x46\x00\x00\xD0" \ "\x1E\x00\x00\xC0\x1E\x01\x00\xB0\x1E\x01\x00\x00\x00\x30\x55\x01" \ "\x00\x00\x00\x00\x00\x02\x00\x80\x01\xC0\x01\x02\x00\x01\x00\x00" \ "\x00\x56\x10\x00\x00\xA0\x25\x00\x00\x84\x25\x00\x00\x00\x00\x01" \ "\x00\x7C\x25\x00\x00\x7E\x25\x00\x00\x80\x25\x00\x00\x74\x46\x00" \ "\x00\x38\x11\x00\x00\x3C\x11\x00\x00\x40\x11\x00\x00\x44\x11\x00" \ "\x00\xC0\x1E\x00\x00"), buff, "packet 287/288") # Generated from packet 289/290 buff = bulk2( dev, "\x43\x19\x00\x00\x00\x3B\x7E\x25\x00\x00\xFE\xFF\x3B\x7C\x25\x00" "\x00\xFE\xFF\x00", target=2) validate_read("\xA4\x06", buff, "packet 291/292") # Generated from packet 293/294 buff = bulk2(dev, "\x01", target=0x85) validate_readv(( "\x84\xA4\x06\x02\x00\x26\x00\x43\x00\xC0\x03\x00\x08\x10\x24" "\x00\x00\x30\x00\x83\x00\x30\x01\x09\x00\xC0\x00\x00\x00\x09\x00" "\x08\x00\xFF\x00\xC4\x1E\x00\x00\xCC\x1E\x00\x00\xB4\x46\x00\x00" "\xD0\x1E\x00\x00\xC0\x1E\x01\x00\xB0\x1E\x01\x00\x00\x00\x30\x55" "\x01\x00\x00\x00\x00\x00\x02\x00\x80\x01\xD0\x01\x02\x00\x01\x00" "\x00\x00\x56\x10\x00\x00\xA0\x25\x00\x00\x84\x25\x00\x00\x00\x00" "\x01\x00\x7C\x25\x00\x00\x7E\x25\x00\x00\x80\x25\x00\x00\x74\x46" "\x00\x00\x38\x11\x00\x00\x3C\x11\x00\x00\x40\x11\x00\x00\x44\x11" "\x00\x00\xC0\x1E\x00\x00", "\x84\xA4\x06\x02\x00\x26\x00\x43\x00\xC0\x03\x00\x08\x10\x24\x00" \ "\x00\x30\x00\x83\x00\x30\x01\x09\x00\xC0\x00\x00\x00\x09\x00\x08" \ "\x00\xFF\x00\xC4\x1E\x00\x00\xCC\x1E\x00\x00\xB4\x46\x00\x00\xD0" \ "\x1E\x00\x00\xC0\x1E\x01\x00\xB0\x1E\x01\x00\x00\x00\x30\x55\x01" \ "\x00\x00\x00\x00\x00\x02\x00\x80\x01\xC0\x01\x02\x00\x01\x00\x00" \ "\x00\x56\x10\x00\x00\xA0\x25\x00\x00\x84\x25\x00\x00\x00\x00\x01" \ "\x00\x7C\x25\x00\x00\x7E\x25\x00\x00\x80\x25\x00\x00\x74\x46\x00" \ "\x00\x38\x11\x00\x00\x3C\x11\x00\x00\x40\x11\x00\x00\x44\x11\x00" \ "\x00\xC0\x1E\x00\x00" ), buff, "packet 295/296") # Generated from packet 297/298 buff = bulk2(dev, "\x0E\x00", target=0x20) validate_read( "\x3A\x00\x90\x32\xA7\x02\x2A\x86\x01\x95\x3C\x36\x90\x00\x1F" "\x00\x01\x00\xD6\x05\x01\x00\x72\x24\x22\x39\x00\x00\x00\x00\x27" "\x1F", buff, "packet 299/300") # Generated from packet 301/302 buff = bulk2( dev, "\x14\x38\x25\x00\x00\x04\x00\x90\x32\x90\x00\xA7\x02\x1F\x00\x14" "\x40\x25\x00\x00\x01\x00\x3C\x36\x0E\x01", target=0x20) validate_read( "\x14\x00\x54\x41\x38\x34\x56\x4C\x56\x5F\x46\x58\x34\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x3E" "\x2C", buff, "packet 303/304") # Generated from packet 305/306 gpio_readi(dev) # Generated from packet 309/310 gpio_readi(dev) # Generated from packet 313/314 sm_read(dev) # Generated from packet 317/318 buff = bulk2(dev, "\x01", target=0x85) validate_readv(( "\x84\xA4\x06\x02\x00\x26\x00\x43\x00\xC0\x03\x00\x08\x10\x24" "\x00\x00\x30\x00\x83\x00\x30\x01\x09\x00\xC0\x00\x00\x00\x09\x00" "\x08\x00\xFF\x00\xC4\x1E\x00\x00\xCC\x1E\x00\x00\xB4\x46\x00\x00" "\xD0\x1E\x00\x00\xC0\x1E\x01\x00\xB0\x1E\x01\x00\x00\x00\x30\x55" "\x01\x00\x00\x00\x00\x00\x02\x00\x80\x01\xD0\x01\x02\x00\x01\x00" "\x00\x00\x56\x10\x00\x00\xA0\x25\x00\x00\x84\x25\x00\x00\x00\x00" "\x01\x00\x7C\x25\x00\x00\x7E\x25\x00\x00\x80\x25\x00\x00\x74\x46" "\x00\x00\x38\x11\x00\x00\x3C\x11\x00\x00\x40\x11\x00\x00\x44\x11" "\x00\x00\xC0\x1E\x00\x00", # SM "\x84\xA4\x06\x02\x00\x26\x00\x43\x00\xC0\x03\x00\x08\x10\x24\x00" \ "\x00\x30\x00\x83\x00\x30\x01\x09\x00\xC0\x00\x00\x00\x09\x00\x08" \ "\x00\xFF\x00\xC4\x1E\x00\x00\xCC\x1E\x00\x00\xB4\x46\x00\x00\xD0" \ "\x1E\x00\x00\xC0\x1E\x01\x00\xB0\x1E\x01\x00\x00\x00\x30\x55\x01" \ "\x00\x00\x00\x00\x00\x02\x00\x80\x01\xC0\x01\x02\x00\x01\x00\x00" \ "\x00\x56\x10\x00\x00\xA0\x25\x00\x00\x84\x25\x00\x00\x00\x00\x01" \ "\x00\x7C\x25\x00\x00\x7E\x25\x00\x00\x80\x25\x00\x00\x74\x46\x00" \ "\x00\x38\x11\x00\x00\x3C\x11\x00\x00\x40\x11\x00\x00\x44\x11\x00" \ "\x00\xC0\x1E\x00\x00" ), buff, "packet 319/320") # Generated from packet 321/322 bulkWrite(0x02, "\x43\x19\x00\x00\x00") # Generated from packet 323/324 bulkWrite(0x02, "\x20\x01\x00\x0C\x04") # Generated from packet 325/326 bulkWrite(0x02, "\x41\x00\x00") # Generated from packet 327/328 buff = bulk2(dev, "\x10\x80\x02", target=6) validate_read("\x80\x00\x00\x00\x09\x00", buff, "packet 329/330") # Generated from packet 331/332 buff = bulk2(dev, "\x45\x01\x00\x00\x31\x00\x06", target=0x64) validate_read( "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" "\xFF\xFF\xFF\xFF\xFF", buff, "packet 333/334") # Generated from packet 335/336 buff = bulk2(dev, "\x49", target=2) validate_read("\x0F\x00", buff, "packet 337/338") # Generated from packet 339/340 gpio_readi(dev) # Generated from packet 343/344 gpio_readi(dev) ''' For kicks tried: bulk2(dev, "\x0E\x01", target=0x20) 00000000 14 00 54 41 38 34 56 4C 56 5F 46 58 34 00 00 00 |..TA84VLV_FX4...| TA84VLV_FX4 Is this some sort of special FX4 socket configuration? Looks like an EEPROM read maybe just reading some random memory buffer though ''' # Generated from packet 347/348 sm_read(dev) # Generated from packet 351/352 bulkWrite( 0x02, "\x3B\x0C\x22\x00\xC0\x40\x00\x3B\x0E\x22\x00\xC0\x00\x00\x3B\x1A" "\x22\x00\xC0\x18\x00") # Generated from packet 353/354 buff = bulk2(dev, "\x4A\x03\x00\x00\x00", target=2) validate_read("\x03\x00", buff, "packet 355/356") # Generated from packet 357/358 bulkWrite(0x02, "\x4C\x00\x02") # Generated from packet 359/360 # None (0xB2) controlWrite(0x40, 0xB2, 0x0000, 0x0000, "") # Generated from packet 361/362 bulkWrite(0x02, "\x50\x45\x00\x00\x00") # Generated from packet 363/364 buff = bulk2( dev, "\xE9\x03\x00\x00\x00\x90\x00\x00\xE9\x03\x00\x00\x00\x90\x01\x10" "\xE9\x03\x00\x00\x00\x90\x00\x00\xE9\x03\x00\x00\x00\x90\x01\x80" "\xE9\x02\x00\x00\x00\x90\x00\xE9\x04\x00\x00\x00\x00\x00\x00\x00" "\xE9\x03\x00\x00\x00\x90\x00\x00\x66\xB9\x00\x00\xB2\x00\xFB\xFF" "\x25\x44\x11\x00\x00", target=2, truncate=True) validate_read("\x80\x00", buff, "packet 365/366") # Generated from packet 367/368 buff = bulk2(dev, "\x02", target=6, truncate=True) validate_read("\x81\x00\x50\x00\x09\x00", buff, "packet 369/370") # Generated from packet 371/372 bulkWrite(0x02, "\x50\xC0\x00\x00\x00") # Generated from packet 373/374 buff = bulk2( dev, "\x66\xB8\x01\x2D\x81\xE3\xFF\xFF\x00\x00\x66\xBB\x18\x00\x66\xC7" "\x05\x30\x40\x00\xC0\xF0\xFF\x89\xD9\xC1\xE1\x02\x66\xC7\x81\x02" "\x00\x00\x00\xF0\xFF\x66\x03\x05\xE4\x46\x00\x00\x66\x89\x05\x90" "\x40\x00\xC0\x89\xDA\x81\xCA\x00\x80\x00\x00\x66\x89\x15\x50\x40" "\x00\xC0\xC6\x05\x14\x22\x00\xC0\x7B\x81\xCA\x00\x40\x00\x00\x66" "\x89\x15\x50\x40\x00\xC0\x89\xD9\x66\xC1\xE1\x02\x66\x89\x81\x00" "\x00\x00\x00\x66\x2B\x05\xE4\x46\x00\x00\xC6\x05\x14\x22\x00\xC0" "\xBB\x81\xCB\x00\x80\x00\x00\x66\x89\x1D\x50\x40\x00\xC0\x89\xC2" "\x81\xE2\x07\x00\x00\x00\x03\xD2\x81\xCA\x01\x00\x00\x00\x89\xD9" "\x81\xE1\x03\x00\x00\x00\xD3\xE2\xD3\xE2\xD3\xE2\xD3\xE2\xD3\xE2" "\xC1\xE2\x0A\x89\xD9\x81\xE1\xFC\x03\x00\x00\x09\xCA\x88\x82\x00" "\x00\x00\x40\x66\xB9\x00\x00\xB2\x00\xFB\xFF\x25\x44\x11\x00\x00", target=2, truncate=True) validate_read("\x81\x00", buff, "packet 375/376") # Generated from packet 377/378 buff = bulk2(dev, "\x02", target=6, truncate=True) validate_read("\x82\x00\x10\x01\x09\x00", buff, "packet 379/380") # Generated from packet 381/382 buff = bulk2( dev, "\x04\x63\x05\x72\x06\x69\x07\x70\x08\x74\x09\x20\x0A\x74\x0B\x79" "\x57\x81\x00\x0C\x02\x30", target=2, truncate=True) validate_read("\x02\x00", buff, "packet 383/384") # When paired with below looping fails on average maybe about 3 iterations # (about 1 - 8 observed) # 31/71 bit changes # Generated from packet 385/386 buff = bulk2( dev, "\x20\x01\x00\x2B\x3B\x0C\x22\x00\xC0\x40\x00\x3B\x0E\x22\x00\xC0" "\x00\x00\x3B\x1A\x22\x00\xC0\x18\x00\x0E\x01", target=0x20, truncate=True) validate_read( "\x14\x00\x54\x41\x38\x34\x56\x4C\x56\x5F\x46\x58\x34\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x3E" "\x2C", buff, "packet 387/388") # 30k iterations by itself and always passes # Generated from packet 389/390 gpio_readi(dev) # Generated from packet 393/394 gpio_readi(dev) # Generated from packet 397/398 sm_read(dev) # Generated from packet 401/402 bulkWrite(0x02, "\x48\x00\x20\x00\x00\x50\x12\x00\x00\x00") # Generated from packet 403/404 buff = bulk2( dev, "\x00\x00\x00\x00\x04\x00\x08\x00\x0C\x00\x10\x00\x14\x00\x18\x00" "\x1C\x00", target=2, truncate=True) validate_read("\x82\x00", buff, "packet 405/406") # Generated from packet 407/408 buff = bulk2(dev, "\x02", target=6, truncate=True) validate_read("\x83\x00\x30\x01\x09\x00", buff, "packet 409/410") # Generated from packet 411/412 buff = bulk2( dev, "\x1D\x10\x01\x09\x00\x00\x00\x15\x60\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x1C\x00\x00\x48\x00\x12\xAA", target=1, truncate=True) validate_read("\xAB", buff, "packet 413/414")
def cmd_20(dev): _bulkRead, bulkWrite, controlRead, controlWrite = usb_wraps(dev) # No reply bulkWrite(0x02, cmd_20_mk())
def bulk2(dev, cmd, target=None, donef=None, prefix=None): _bulkRead, bulkWrite, _controlRead, _controlWrite = usb_wraps(dev) bulkWrite(0x02, cmd) return bulk86(dev, target=target, donef=donef, prefix=prefix)
def replay(dev, fw, cont=True, blank=True): bulkRead, bulkWrite, controlRead, controlWrite = usb_wraps(dev) # Generated by uvusbreplay 0.1 # uvusbreplay copyright 2011 John McMaster <*****@*****.**> # cmd: /home/mcmaster/bin/usbrply --packet-numbers --no-setup --comment --fx2 --packet-numbers -j cap/2015-10-11/i87c51_13_write_cont_id_blank_v2_ff.cap # FIXME: size? read.replay1(dev, cont) # Generated from packet 363/364 cmd_57s(dev, '\x8C', "\x00\x00") # Generated from packet 367/368 cmd_50(dev, "\x18\x00") # Generated from packet 369/370 buff = bulk2(dev, "\x66\xB8\x01\x2D\x66\x89\x05\x06\x00\x09\x00\x66\xB9\x00\x00\xB2" \ "\x00\xFB\xFF\x25\x44\x11\x00\x00" , target=0x02) validate_read("\x8F\x00", buff, "packet W: 369/370, R: 371/372") # Generated from packet 373/374 buff = bulk2(dev, "\x02", target=0x06) validate_read("\x90\x00\xB0\x5D\x09\x00", buff, "packet W: 373/374, R: 375/376") # Generated from packet 377/378 buff = bulk2(dev, "\x57\x8F\x00\x57\x89\x00", target=0x02) validate_read("\x00\x00", buff, "packet W: 377/378, R: 379/380") # Generated from packet 381/382 cmd_50(dev, "\x0A\x06") # Generated from packet 383/384 buff = bulk2(dev, write_fw.p383, target=0x02) validate_read("\x90\x00", buff, "packet W: 383/384, R: 385/386") # Generated from packet 387/388 buff = bulk2(dev, "\x02", target=0x06) validate_read("\x91\x00\xC0\x63\x09\x00", buff, "packet W: 387/388, R: 389/390") # Generated from packet 391/392 if blank: print 'Blank checking' tstart = time.time() buff = bulk2(dev, "\x08\x00\x57\x90\x00", target=0x02) tend = time.time() print 'Blank test took %0.3f sec' % (tend - tstart,) if buff == "\x00\x00": print 'Blank: pass' elif buff == "\x01\x00": raise NotBlank('Blank: fail') else: hexdump(buff) raise Exception("Unknown blank status") # Generated from packet 395/396 cmd_57s(dev, '\x8C', "\x00\x00") # Generated from packet 399/400 cmd_50(dev, "\x18\x00") # Generated from packet 401/402 buff = bulk2(dev, "\x66\xB8\x01\x32\x66\x89\x05\x06\x00\x09\x00\x66\xB9\x00\x00\xB2" \ "\x00\xFB\xFF\x25\x44\x11\x00\x00" , target=0x02) validate_read("\x91\x00", buff, "packet W: 401/402, R: 403/404") # Generated from packet 405/406 buff = bulk2(dev, "\x02", target=0x06) validate_read("\x92\x00\xE0\x63\x09\x00", buff, "packet W: 405/406, R: 407/408") # Generated from packet 409/410 buff = bulk2(dev, "\x57\x91\x00\x57\x89\x00", target=0x02) validate_read("\x00\x00", buff, "packet W: 409/410, R: 411/412") # Generated from packet 413/414 cmd_50(dev, "\x9F\x09") # Generated from packet 415/416 buff = bulk2(dev, write_fw.p415, target=0x02) validate_read("\x92\x00", buff, "packet W: 415/416, R: 417/418") # Generated from packet 419/420 buff = bulk2(dev, "\x02", target=0x06) validate_read("\x93\x00\x80\x6D\x09\x00", buff, "packet W: 419/420, R: 421/422") # Generated from packet 423/424 buff = bulk2(dev, "\x57\x92\x00", target=0x01) validate_read("\x62", buff, "packet W: 423/424, R: 425/426") # Generated from packet 427/428 # NOTE: prefix 0x18 buff = bulk86(dev, target=0x01, prefix=0x18) validate_read("\x0B", buff, "packet 427/428") # Generated from packet 429/430 fw_w(dev, fw, verbose=True) # Generated from packet 513/514 cmd_57s(dev, '\x8C', "\x00\x00") # Generated from packet 517/518 cmd_50(dev, "\x18\x00") # Generated from packet 519/520 buff = bulk2(dev, "\x66\xB8\x01\x2D\x66\x89\x05\x06\x00\x09\x00\x66\xB9\x00\x00\xB2" \ "\x00\xFB\xFF\x25\x44\x11\x00\x00" , target=0x02) validate_read("\x93\x00", buff, "packet W: 519/520, R: 521/522") # Generated from packet 523/524 buff = bulk2(dev, "\x02", target=0x06) validate_read("\x94\x00\xA0\x6D\x09\x00", buff, "packet W: 523/524, R: 525/526") # Generated from packet 527/528 buff = bulk2(dev, "\x57\x93\x00\x57\x89\x00", target=0x02) validate_read("\x00\x00", buff, "packet W: 527/528, R: 529/530") # Generated from packet 531/532 cmd_50(dev, "\xE0\x08") # Generated from packet 533/534 buff = bulk2(dev, write_fw.p533, target=0x02) validate_read("\x94\x00", buff, "packet W: 533/534, R: 535/536") # Generated from packet 537/538 buff = bulk2(dev, "\x02", target=0x06) validate_read("\x95\x00\x80\x76\x09\x00", buff, "packet W: 537/538, R: 539/540") # Generated from packet 541/542 cmd_57_94(dev) # Generated from packet 547/548 fw_w(dev, fw) # Generated from packet 631/632 cmd_57s(dev, '\x8C', "\x00\x00") # Generated from packet 635/636 cmd_50(dev, "\x18\x00") # Generated from packet 637/638 buff = bulk2(dev, "\x66\xB8\x01\x37\x66\x89\x05\x06\x00\x09\x00\x66\xB9\x00\x00\xB2" \ "\x00\xFB\xFF\x25\x44\x11\x00\x00" , target=0x02) validate_read("\x95\x00", buff, "packet W: 637/638, R: 639/640") # Generated from packet 641/642 buff = bulk2(dev, "\x02", target=0x06) validate_read("\x96\x00\xA0\x76\x09\x00", buff, "packet W: 641/642, R: 643/644") # Generated from packet 645/646 buff = bulk2(dev, "\x57\x95\x00\x57\x89\x00", target=0x02) validate_read("\x00\x00", buff, "packet W: 645/646, R: 647/648") # Generated from packet 649/650 cmd_57_94(dev) # Generated from packet 655/656 fw_w(dev, fw) # Generated from packet 739/740 cmd_57s(dev, '\x8C', "\x00\x00") # Generated from packet 743/744 cmd_50(dev, "\x0D\x00") # Generated from packet 745/746 buff = bulk2(dev, "\x66\xB9\x00\x00\xB2\x00\xFB\xFF\x25\x44\x11\x00\x00", target=0x02) validate_read("\x96\x00", buff, "packet W: 745/746, R: 747/748") # Generated from packet 749/750 buff = bulk2(dev, "\x02", target=0x06) validate_read("\x97\x00\xB0\x76\x09\x00", buff, "packet W: 749/750, R: 751/752") # Generated from packet 753/754 cmd_57_50(dev, "\x96", "\x1A\x00") # Generated from packet 755/756 buff = bulk2(dev, "\x66\xB9\x00\x00\xB2\x02\xFB\xFF\x25\x44\x11\x00\x00\x66\xB9\x00" \ "\x00\xB2\x02\xFB\xFF\x25\x44\x11\x00\x00" , target=0x02) validate_read("\x97\x00", buff, "packet W: 755/756, R: 757/758") # Generated from packet 759/760 buff = bulk2(dev, "\x02", target=0x06) validate_read("\x98\x00\xD0\x76\x09\x00", buff, "packet W: 759/760, R: 761/762") # Generated from packet 763/764 buff = bulk2(dev, "\x57\x97\x00", target=0x02) validate_read("\x00\x00", buff, "packet W: 763/764, R: 765/766") # Generated from packet 767/768 led_mask_30(dev, "pass") # Generated from packet 771/772 gpio_readi(dev) # Generated from packet 775/776 gpio_readi(dev) # Generated from packet 779/780 sm_info22(dev) # Generated from packet 783/784 sm_info24(dev) # Generated from packet 787/788 sm_read(dev) # Generated from packet 791/792 cmd_49(dev) # Generated from packet 795/796 sm_read(dev) # Generated from packet 799/800 sm_insert(dev) # Generated from packet 803/804 sm_info10(dev)
def replay1(dev, cont=True): _bulkRead, bulkWrite, controlRead, controlWrite = usb_wraps(dev) # Atomic # Generated from packet 11/12 buff = controlRead(0xC0, 0xB0, 0x0000, 0x0000, 4096) # Req: 4096, got: 3 validate_read("\x00\x00\x00", buff, "packet 11/12") # Generated from packet 13/14 buff = bulk86(dev, target=0x01) validate_read("\x16", buff, "packet 13/14") # Generated from packet 15/16 cmd_01(dev) # NOTE:: req max 512 but got 136 # Generated from packet 19/20 buff = bulk2(dev, "\x43\x19\x10\x00\x00\x3B\x7E\x25\x00\x00\xFE\xFF\x3B\x7C\x25\x00" \ "\x00\xFE\xFF\x00" , target=0x02) validate_read("\xA4\x06", buff, "packet W: 19/20, R: 21/22") # Generated from packet 23/24 cmd_01(dev) # Generated from packet 27/28 sn_read(dev) # NOTE:: req max 512 but got 35 # Generated from packet 31/32 buff = bulk2(dev, "\x14\x38\x25\x00\x00\x04\x00\x90\x32\x90\x00\xA7\x02\x1F\x00\x14" \ "\x40\x25\x00\x00\x01\x00\x3C\x36\x0E\x01" , target=0x20) validate_read( "\x14\x00\x54\x41\x38\x34\x56\x4C\x56\x5F\x46\x58\x34\x00\x00\x00" \ "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x3E\x2C" , buff, "packet W: 31/32, R: 33/34") sm_info1(dev) # Generated from packet 55/56 cmd_01(dev) # NOTE:: req max 512 but got 136 # Generated from packet 59/60 cmd_43(dev, "\x10") # Generated from packet 61/62 bulkWrite(0x02, cmd_20_mk() + cmd_0C_mk()) # Generated from packet 63/64 cmd_41(dev) # Generated from packet 65/66 cmd_10(dev) sm_read(dev) ''' validate_read( "\x11\x00\x53\x4D\x34\x38\x44\x00\x00\x00\x00\x00\x00\x00\x5D\xF4" \ "\x39\xFF\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x62\x6C" , buff, "packet W: 69/70, R: 71/72") ''' sm_insert(dev) # Generated from packet 77/78 cmd_45(dev) # Generated from packet 81/82 cmd_49(dev) sm_info1(dev) sm_insert(dev) # Generated from packet 117/118 sm_info10(dev) # Generated from packet 121/122 cmd_3B(dev) cmd_4A(dev) # NOTE:: req max 512 but got 5 # Generated from packet 127/128 cmd_4C(dev) # Generated from packet 129/130 # None (0xB2) buff = controlWrite(0x40, 0xB2, 0x0000, 0x0000, "") # Atomic # Generated from packet 131/132 cmd_50(dev, "\x5D\x00") # Generated from packet 133/134 buff = bulk2(dev, "\xE9\x03\x00\x00\x00\x90\x00\x00\xE9\x03\x00\x00\x00\x90\x01\x10" \ "\xE9\x03\x00\x00\x00\x90\x00\x00\xE9\x03\x00\x00\x00\x90\x01\x80" \ "\xE9\x02\x00\x00\x00\x90\x00\xE9\x04\x00\x00\x00\x00\x00\x00\x00" \ "\xE9\x03\x00\x00\x00\x90\x00\x00\xE9\x03\x00\x00\x00\x90\x00\x00" \ "\xE9\x03\x00\x00\x00\x90\x00\x00\xE9\x03\x00\x00\x00\x90\x00\x00" \ "\x66\xB9\x00\x00\xB2\x00\xFB\xFF\x25\x44\x11\x00\x00" , target=0x02) validate_read("\x80\x00", buff, "packet W: 133/134, R: 135/136") # Generated from packet 137/138 cmd_02(dev, "\x81\x00\x60\x00\x09\x00", "packet W: 137/138, R: 139/140") # Atomic # Generated from packet 141/142 cmd_50(dev, "\xC0\x00") # Generated from packet 143/144 buff = bulk2(dev, "\x66\xB8\x01\x2D\x81\xE3\xFF\xFF\x00\x00\x66\xBB\x18\x00\x66\xC7" \ "\x05\x30\x40\x00\xC0\xF0\xFF\x89\xD9\xC1\xE1\x02\x66\xC7\x81\x02" \ "\x00\x00\x00\xF0\xFF\x66\x03\x05\xE4\x46\x00\x00\x66\x89\x05\x90" \ "\x40\x00\xC0\x89\xDA\x81\xCA\x00\x80\x00\x00\x66\x89\x15\x50\x40" \ "\x00\xC0\xC6\x05\x14\x22\x00\xC0\x7B\x81\xCA\x00\x40\x00\x00\x66" \ "\x89\x15\x50\x40\x00\xC0\x89\xD9\x66\xC1\xE1\x02\x66\x89\x81\x00" \ "\x00\x00\x00\x66\x2B\x05\xE4\x46\x00\x00\xC6\x05\x14\x22\x00\xC0" \ "\xBB\x81\xCB\x00\x80\x00\x00\x66\x89\x1D\x50\x40\x00\xC0\x89\xC2" \ "\x81\xE2\x07\x00\x00\x00\x03\xD2\x81\xCA\x01\x00\x00\x00\x89\xD9" \ "\x81\xE1\x03\x00\x00\x00\xD3\xE2\xD3\xE2\xD3\xE2\xD3\xE2\xD3\xE2" \ "\xC1\xE2\x0A\x89\xD9\x81\xE1\xFC\x03\x00\x00\x09\xCA\x88\x82\x00" \ "\x00\x00\x40\x66\xB9\x00\x00\xB2\x00\xFB\xFF\x25\x44\x11\x00\x00" , target=0x02) validate_read("\x81\x00", buff, "packet W: 143/144, R: 145/146") # Generated from packet 147/148 cmd_02(dev, "\x82\x00\x20\x01\x09\x00", "packet W: 147/148, R: 149/150") # Generated from packet 151/152 cmd_09(dev) # Generated from packet 153/154 cmd_02(dev, "\x82\x00\x20\x01\x09\x00", "packet W: 153/154, R: 155/156") # added sm_insert(dev) print 'Going active' led_mask_30(dev, 'active') # Atomic # Generated from packet 161/162 cmd_50(dev, "\x18\x00") # Generated from packet 163/164 buff = bulk2(dev, "\x66\xB8\x01\x32\x66\x89\x05\x06\x00\x09\x00\x66\xB9\x00\x00\xB2" \ "\x00\xFB\xFF\x25\x44\x11\x00\x00" , target=0x02) validate_read("\x82\x00", buff, "packet W: 163/164, R: 165/166") # Generated from packet 167/168 cmd_02(dev, "\x83\x00\x40\x01\x09\x00", "packet W: 167/168, R: 169/170") # Generated from packet 171/172 buff = bulk2(dev, "\x57\x82\x00\x20\x01\x00\x2B\x3B\x0C\x22\x00\xC0\x40\x00\x3B\x0E" \ "\x22\x00\xC0\x00\x00\x3B\x1A\x22\x00\xC0\x18\x00\x0E\x01" , target=0x20) validate_read( "\x14\x00\x54\x41\x38\x34\x56\x4C\x56\x5F\x46\x58\x34\x00\x00\x00" \ "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x3E\x2C" , buff, "packet W: 171/172, R: 173/174") sm_info0(dev) # Generated from packet 195/196 buff = bulk2(dev, "\x48\x00\x10\x82\x02", target=0x06) validate_read("\x82\x00\x20\x01\x09\x00", buff, "packet W: 195/196, R: 197/198") # Generated from packet 199/200 bulkWrite(0x02, cmd_20_mk() + cmd_50_mk("\x7D\x02")) # Generated from packet 201/202 buff = bulk2(dev, read_fw.p201, target=0x02) validate_read("\x82\x00", buff, "packet W: 201/202, R: 203/204") # Generated from packet 205/206 cmd_02(dev, "\x83\x00\xA0\x03\x09\x00", "packet W: 205/206, R: 207/208") # Atomic # Generated from packet 209/210 cmd_57_50(dev, "\x82", "\x1D\x00") # Generated from packet 211/212 buff = bulk2(dev, "\xC7\x05\x74\x46\x00\x00\x0B\x00\x00\x00\xFF\x15\x38\x11\x00\x00" \ "\x66\xB9\x00\x00\xB2\x00\xFB\xFF\x25\x44\x11\x00\x00" , target=0x02) validate_read("\x83\x00", buff, "packet W: 211/212, R: 213/214") # Generated from packet 215/216 cmd_02(dev, "\x84\x00\xC0\x03\x09\x00", "packet W: 215/216, R: 217/218") # Atomic ''' Seems these must be done together Increments socket insertion count ''' # Generated from packet 219/220 cmd_57_50(dev, "\x83", "\x18\x3A") # p221.bin: DOS executable (COM) # Generated from packet 221/222 buff = bulk2(dev, read_fw.p221, target=0x02) validate_read("\x84\x00", buff, "packet W: 221/222, R: 223/224") # Generated from packet 225/226 cmd_02(dev, "\x85\x00\xE0\x3D\x09\x00", "packet W: 225/226, R: 227/228") # Generated from packet 229/230 bulkWrite(0x02, "\x57\x84\x00\xF0\xFF\xFF\x0F\xF0\xFF\xFF\x00\x00\x00\x00\x00\x00" \ "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" \ "\x00\x00\x00\x00\xF0\x0F\x00\x00\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" \ "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" ) # Atomic # Generated from packet 231/232 cmd_50(dev, "\xDE\x03") # Generated from packet 233/234 buff = bulk2(dev, read_fw.p233, target=0x02) validate_read("\x85\x00", buff, "packet W: 233/234, R: 235/236") # Generated from packet 237/238 cmd_02(dev, "\x86\x00\xC0\x41\x09\x00", "packet W: 237/238, R: 239/240") # The actual continuity check if cont: # Generated from packet 241/242 # Takes about 0.05 sec on pass but 0.52 sec on fail tstart = time.time() buff = cmd_57s(dev, "\x85", None, "cmd_57") tend = time.time() print 'Continuity test took %0.3f sec' % (tend - tstart, ) hexdump(buff, label='Continuity', indent=' ') # Chip inserted if buff == "\x01": print 'Continuity OK' # Chip removed elif buff == ("\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" \ "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"): raise ContFail('Continuity complete failure (part not inserted?)') # Inserting chip while running # I'm guessing its telling me which pins failed # Lets bend a pin and verify else: raise ContFail( 'Continuity partial failure (dirty contacts? Inserted wrong?)' ) # Atomic with following operation # Generated from packet 245/246 cmd_50(dev, "\x62\x00") # Generated from packet 247/248 buff = bulk2(dev, "\x00\x00\x3C\x00\x38\x00\x34\x00\x30\x00\x3D\x00\x39\x00\x35\x00" \ "\x31\x00\x3E\x00\x3A\x00\x36\x00\x32\x00\x3F\x00\x3B\x00\x37\x00" \ "\x33\x00\x1E\x00\x1A\x00\x16\x00\x00\x00\x02\x00\x06\x00\x0A\x00" \ "\x0E\x00\x23\x00\x27\x00\x2B\x00\x2F\x00\x22\x00\x26\x00\x2A\x00" \ "\x2E\x00\x21\x00\x25\x00\x29\x00\x2D\x00\x20\x00\x24\x00\x28\x00" \ "\x1C\x00\x00\x00\x04\x00\x08\x00\x0C\x00\x10\x00\x14\x00\x18\x00" \ "\x1C\x00" , target=0x02) validate_read("\x86\x00", buff, "packet W: 247/248, R: 249/250") # Generated from packet 251/252 cmd_02(dev, "\x87\x00\x30\x42\x09\x00", "packet W: 251/252, R: 253/254") # Atomic with next # Generated from packet 255/256 bulkWrite(0x02, "\x1D\xC0\x41\x09\x00\x28\x00\x15\x60\x00\x00\x00\x00\x00\x00\x00" \ "\x00\x00\x01\x00\x00\x00\x1C\x30\x00\x00\x00\x08\x00\x00\x00\x48" \ "\x00\x50\x71\x09\x00\x00") # Generated from packet 257/258 buff = bulk2(dev, read_fw.p257, target=0x02) validate_read("\x87\x00", buff, "packet W: 257/258, R: 259/260") # Generated from packet 261/262 cmd_02(dev, "\x88\x00\xB0\x4B\x09\x00", "packet W: 261/262, R: 263/264") # Generated from packet 265/266 cmd_57s(dev, "\x87", "\x00\x00", "cmd_57") # Atomic # Generated from packet 269/270 cmd_50(dev, "\x17\x00") # Generated from packet 271/272 buff = bulk2(dev, "\xC7\x05\x2C\x00\x09\x00\x24\x04\x00\x00\x66\xB9\x00\x00\xB2\x00" \ "\xFB\xFF\x25\x44\x11\x00\x00" , target=0x02) validate_read("\x88\x00", buff, "packet W: 271/272, R: 273/274") # Generated from packet 275/276 cmd_02(dev, "\x89\x00\xD0\x4B\x09\x00", "packet W: 275/276, R: 277/278") # Atomic # Generated from packet 279/280 cmd_57_50(dev, "\x88", "\x32\x07") # Generated from packet 281/282 buff = bulk2(dev, read_fw.p281, target=0x02) validate_read("\x89\x00", buff, "packet W: 281/282, R: 283/284") # Generated from packet 285/286 cmd_02(dev, "\x8A\x00\x10\x53\x09\x00", "packet W: 285/286, R: 287/288") # Generated from packet 289/290 cmd_57s(dev, '\x89', "\x00\x00") # Atomic # Generated from packet 293/294 cmd_50(dev, "\x3D\x03") # Generated from packet 295/296 buff = bulk2(dev, read_fw.p295, target=0x02) validate_read("\x8A\x00", buff, "packet W: 295/296, R: 297/298") # Generated from packet 299/300 cmd_02(dev, "\x8B\x00\x50\x56\x09\x00", "packet W: 299/300, R: 301/302") # Generated from packet 303/304 cmd_57s(dev, "\x8A", "\x89\x00") # Atomic # Generated from packet 307/308 cmd_50(dev, "\x1D\x00") # Generated from packet 309/310 buff = bulk2(dev, "\x66\x8B\x0D\x1A\x24\x00\x00\xB2\x02\xFB\xFF\x25\x44\x11\x00\x00" \ "\x66\xB9\x00\x00\xB2\x02\xFB\xFF\x25\x44\x11\x00\x00" , target=0x02) validate_read("\x8B\x00", buff, "packet W: 309/310, R: 311/312") # Generated from packet 313/314 cmd_02(dev, "\x8C\x00\x70\x56\x09\x00", "packet W: 313/314, R: 315/316") # Generated from packet 317/318 # Bad part returns \x59\x00 but otherwise can be read # (with partially corrupt bit pattern) if cont: buff = cmd_57s(dev, "\x8B", None) if buff == "\x59\x00": raise Exception("Failed 0x8B health check") else: validate_read("\x58\x00", buff, "") # Atomic # Generated from packet 321/322 cmd_50(dev, "\xF8\x04") # Generated from packet 323/324 buff = bulk2(dev, read_fw.p323, target=0x02) validate_read("\x8C\x00", buff, "packet W: 323/324, R: 325/326") # Generated from packet 327/328 cmd_02(dev, "\x8D\x00\x70\x5B\x09\x00", "packet W: 327/328, R: 329/330") # Generated from packet 331/332 cmd_57s(dev, '\x8C', "\x00\x00") # Atomic # Generated from packet 335/336 cmd_50(dev, "\x18\x00") # Generated from packet 337/338 buff = bulk2(dev, "\x66\xB8\x01\x32\x66\x89\x05\x06\x00\x09\x00\x66\xB9\x00\x00\xB2" \ "\x00\xFB\xFF\x25\x44\x11\x00\x00" , target=0x02) validate_read("\x8D\x00", buff, "packet W: 337/338, R: 339/340") # Generated from packet 341/342 cmd_02(dev, "\x8E\x00\x90\x5B\x09\x00", "packet W: 341/342, R: 343/344") # Generated from packet 345/346 cmd_57s(dev, "\x8D\x89", "\x00\x00") # Atomic # Generated from packet 349/350 cmd_50(dev, "\xFA\x01") # Generated from packet 351/352 buff = bulk2(dev, read_fw.p351, target=0x02) validate_read("\x8E\x00", buff, "packet W: 351/352, R: 353/354") # Generated from packet 355/356 cmd_02(dev, "\x8F\x00\x90\x5D\x09\x00", "packet W: 355/356, R: 357/358") # Generated from packet 323/324 cmd_08(dev, "\x8E") # Generated from packet 363/364 cmd_57s(dev, '\x8C', "\x00\x00")
def boot_cold(dev): bulkRead, bulkWrite, controlRead, _controlWrite = usb_wraps(dev) # Generated from packet 70/71 buff = bulk2(dev, "\x43\x19\x00\x00\x00\x3B\x66\x1B\x00\x00\xFE\xFF\x3B\x64\x1B\x00" "\x00\xFE\xFF\x00", target=2) validate_read("\xA4\x06", buff, "packet 72/73") # Generated from packet 74/75 cmd_01(dev) # Atomic # cmd_01 state: 0x80 => 0x81 # Generated from packet 78/79 bulkWrite(0x02, cmd_43_mk("\x00") + cmd_11_mk()) # Generated from packet 80/85 bulkWrite(0x02, bp1410_fw_sn.p223) # Generated from packet 81/86 bulkWrite(0x02, bp1410_fw_sn.p224) # Generated from packet 82/87 bulkWrite(0x02, bp1410_fw_sn.p225) # Generated from packet 83/88 bulkWrite(0x02, bp1410_fw_sn.p226) # Generated from packet 84/89 bulkWrite(0x02, bp1410_fw_sn.p227) # Generated from packet 90/91 buff = bulk2(dev, "\x5A", target=1) validate_read("\x80", buff, "packet 92/93") cmd_01(dev) # temp # Atomic # cmd_01 state: 0x81 => 0x82 # Generated from packet 94/95 bulkWrite(0x02, "\x11\x10\x00") # Generated from packet 96/97 bulkWrite(0x02, "\xEA\xCC\x64\x01\x00\x08\x00\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x3F") # Generated from packet 98/99 buff = bulk2(dev, "\xA6", target=1) validate_read("\x81", buff, "packet 100/101") cmd_01(dev) # temp # Atomic # cmd_01 state: 0x82 => 0x83 # Generated from packet 102/103 bulkWrite(0x02, "\x11\x4E\x00") # Generated from packet 104/105 bulkWrite(0x02, "\xE8\x00\x00\x00\x00\xFA\x5A\x83\xEA\x05\x81\xEA\x00\x00\x01\x00" "\x81\xFA\x00\x00\x01\x00\x74\x1F\xBB\x00\x00\x00\x00\xB9\x00\x00" "\x01\x00\x66\x8B\x02\x66\x89\x83\x00\x00\x01\x00\x83\xC2\x02\x83" "\xC3\x02\x83\xE9\x02\x75\xEB\x8C\xC8\x50\xB8\xF0\xFF\x01\x00\x50" "\x0F\x20\xC0\x0D\x00\x00\x00\x60\x0F\x22\xC0\x0F\x09\xC3") # Generated from packet 106/107 buff = bulk2(dev, "\xDB", target=1) validate_read("\x82", buff, "packet 108/109") cmd_01(dev) # temp # cmd_01 state: 0x83 => 0x80. Length 129 => 133 # Generated from packet 110/111 buff = bulk2(dev, "\x82", target=1) validate_read("\x16", buff, "packet 112/113") # Generated from packet 114/115 cmd_01(dev)
def cmd_57_50(dev, c57, c50): # ex: bulkWrite(0x02, "\x57\x82\x00 \x50\x1D\x00\x00\x00") _bulkRead, bulkWrite, _controlRead, _controlWrite = usb_wraps(dev) bulkWrite(0x02, cmd_57_mk(c57) + cmd_50_mk(c50))
def bulk86(dev, target=None, donef=None, prefix=None): bulkRead, _bulkWrite, _controlRead, _controlWrite = usb_wraps(dev) dbg = bulk86_dbg if dbg: print print 'bulk86' where(2) try: where(3) except IndexError: pass # AFAIK certain packets have no way of knowing done # other than knowing in advance how many bytes you should expect # Strange since there are continue markers if donef is None and target is not None: def donef(buff): return len(buff) == target ''' Ex: need to read 4096 bytes Max buffer packet size is 512 bytes but for some reason only uses up to 256 bytes of real data + 3 framing bytes and 0 fills the rest to form 512 byte transfer So to transfer the data ''' def nxt_buff(): if dbg: print ' nxt_buff: reading' p = bulkRead(0x86, 0x0200) if dbg: hexdump(p, label=' nxt_buff', indent=' ') #print str2hex(p) prefix_this = ord(p[0]) size = (ord(p[-1]) << 8) | ord(p[-2]) ''' if size != len(p) - 3: if truncate and size < len(p) - 3: return prefix_this, p[1:1 + size], suffix_this else: print 'Truncate: %s' % truncate print size, len(p) - 3, len(p) hexdump(p) raise Exception("Bad length (enable truncation?)") return prefix_this, p[1:-2], suffix_this ''' # No harm seen in always truncating return prefix_this, p[1:1 + size] buff = '' while True: if donef and donef(buff): break # Test on "packet 152/153" (0x64 byte response) # gave 19/1010 splits => 1.9% of split # Ran some torture tests looping on this to verify this logic is okay if dbg and buff: print ' NOTE: split packet. Have %d / %s bytes' % (len(buff), target) hexdump(buff, indent=' ') splits[0] += 1 try: # Ignore suffix continue until we have a reason to care if dbg: tstart = time.time() prefix_this, buff_this = nxt_buff() if dbg: tend = time.time() print ' time: %0.3f' % (tend - tstart,) buff += buff_this if prefix is not None: if prefix != prefix_this: hexdump(buff_this) raise BadPrefix('Wanted prefix 0x%02X, got 0x%02X' % (prefix, prefix_this)) elif prefix_this == 0x08: pass else: raise BadPrefix('Unknown prefix 0x%02X' % prefix_this) if donef and not donef(buff): if dbg: print ' continue: not done' continue if dbg: print ' break: no special markers' break # FIXME: temp except libusb1.USBError: #if prefix is None: # return buff raise #print 'Done w/ buff len %d' % len(buff) if target is not None and len(buff) != target: hexdump(buff, label='Wrong size', indent=' ') prefix_this, buff_this = nxt_buff() raise Exception('Target len: buff %d != target %d' % (len(buff), target)) if dbg: hexdump(buff, label=' ret', indent=' ') print return buff
def replay_setup(dev): bulkRead, bulkWrite, controlRead, controlWrite = usb_wraps(dev) # Verified that control request allows bulk to be read # Generated from packet 281/282 # None (0xB0) buff = controlRead(0xC0, 0xB0, 0x0000, 0x0000, 4096) # NOTE:: req max 4096 but got 3 validate_read("\x00\x00\x00", buff, "packet 281/282") buff = bulk86(dev, target=1) validate_read("\x16", buff, "packet 283/284") # Generated from packet 285/286 buff = bulk2(dev, "\x01", target=0x85) validate_readv(( "\x84\xA4\x06\x02\x00\x26\x00\x43\x00\xC0\x03\x00\x08\x10\x24" "\x00\x00\x30\x00\x83\x00\x30\x01\x09\x00\xC0\x00\x00\x00\x09\x00" "\x08\x00\xFF\x00\xC4\x1E\x00\x00\xCC\x1E\x00\x00\xB4\x46\x00\x00" "\xD0\x1E\x00\x00\xC0\x1E\x01\x00\xB0\x1E\x01\x00\x00\x00\x30\x55" "\x01\x00\x00\x00\x00\x00\x02\x00\x80\x01\xD0\x01\x02\x00\x01\x00" "\x00\x00\x56\x10\x00\x00\xA0\x25\x00\x00\x84\x25\x00\x00\x00\x00" "\x01\x00\x7C\x25\x00\x00\x7E\x25\x00\x00\x80\x25\x00\x00\x74\x46" "\x00\x00\x38\x11\x00\x00\x3C\x11\x00\x00\x40\x11\x00\x00\x44\x11" "\x00\x00\xC0\x1E\x00\x00", "\x84\xA4\x06\x02\x00\x26\x00\x43\x00\xC0\x03\x00\x08\x10\x24\x00" \ "\x00\x30\x00\x83\x00\x30\x01\x09\x00\xC0\x00\x00\x00\x09\x00\x08" \ "\x00\xFF\x00\xC4\x1E\x00\x00\xCC\x1E\x00\x00\xB4\x46\x00\x00\xD0" \ "\x1E\x00\x00\xC0\x1E\x01\x00\xB0\x1E\x01\x00\x00\x00\x30\x55\x01" \ "\x00\x00\x00\x00\x00\x02\x00\x80\x01\xC0\x01\x02\x00\x01\x00\x00" \ "\x00\x56\x10\x00\x00\xA0\x25\x00\x00\x84\x25\x00\x00\x00\x00\x01" \ "\x00\x7C\x25\x00\x00\x7E\x25\x00\x00\x80\x25\x00\x00\x74\x46\x00" \ "\x00\x38\x11\x00\x00\x3C\x11\x00\x00\x40\x11\x00\x00\x44\x11\x00" \ "\x00\xC0\x1E\x00\x00"), buff, "packet 287/288") # Generated from packet 289/290 buff = bulk2(dev, "\x43\x19\x00\x00\x00\x3B\x7E\x25\x00\x00\xFE\xFF\x3B\x7C\x25\x00" "\x00\xFE\xFF\x00", target=2) validate_read("\xA4\x06", buff, "packet 291/292") # Generated from packet 293/294 buff = bulk2(dev, "\x01", target=0x85) validate_readv(( "\x84\xA4\x06\x02\x00\x26\x00\x43\x00\xC0\x03\x00\x08\x10\x24" "\x00\x00\x30\x00\x83\x00\x30\x01\x09\x00\xC0\x00\x00\x00\x09\x00" "\x08\x00\xFF\x00\xC4\x1E\x00\x00\xCC\x1E\x00\x00\xB4\x46\x00\x00" "\xD0\x1E\x00\x00\xC0\x1E\x01\x00\xB0\x1E\x01\x00\x00\x00\x30\x55" "\x01\x00\x00\x00\x00\x00\x02\x00\x80\x01\xD0\x01\x02\x00\x01\x00" "\x00\x00\x56\x10\x00\x00\xA0\x25\x00\x00\x84\x25\x00\x00\x00\x00" "\x01\x00\x7C\x25\x00\x00\x7E\x25\x00\x00\x80\x25\x00\x00\x74\x46" "\x00\x00\x38\x11\x00\x00\x3C\x11\x00\x00\x40\x11\x00\x00\x44\x11" "\x00\x00\xC0\x1E\x00\x00", "\x84\xA4\x06\x02\x00\x26\x00\x43\x00\xC0\x03\x00\x08\x10\x24\x00" \ "\x00\x30\x00\x83\x00\x30\x01\x09\x00\xC0\x00\x00\x00\x09\x00\x08" \ "\x00\xFF\x00\xC4\x1E\x00\x00\xCC\x1E\x00\x00\xB4\x46\x00\x00\xD0" \ "\x1E\x00\x00\xC0\x1E\x01\x00\xB0\x1E\x01\x00\x00\x00\x30\x55\x01" \ "\x00\x00\x00\x00\x00\x02\x00\x80\x01\xC0\x01\x02\x00\x01\x00\x00" \ "\x00\x56\x10\x00\x00\xA0\x25\x00\x00\x84\x25\x00\x00\x00\x00\x01" \ "\x00\x7C\x25\x00\x00\x7E\x25\x00\x00\x80\x25\x00\x00\x74\x46\x00" \ "\x00\x38\x11\x00\x00\x3C\x11\x00\x00\x40\x11\x00\x00\x44\x11\x00" \ "\x00\xC0\x1E\x00\x00" ), buff, "packet 295/296") # Generated from packet 297/298 buff = bulk2(dev, "\x0E\x00", target = 0x20) validate_read("\x3A\x00\x90\x32\xA7\x02\x2A\x86\x01\x95\x3C\x36\x90\x00\x1F" "\x00\x01\x00\xD6\x05\x01\x00\x72\x24\x22\x39\x00\x00\x00\x00\x27" "\x1F", buff, "packet 299/300") # Generated from packet 301/302 buff = bulk2(dev, "\x14\x38\x25\x00\x00\x04\x00\x90\x32\x90\x00\xA7\x02\x1F\x00\x14" "\x40\x25\x00\x00\x01\x00\x3C\x36\x0E\x01", target=0x20) validate_read("\x14\x00\x54\x41\x38\x34\x56\x4C\x56\x5F\x46\x58\x34\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x3E" "\x2C", buff, "packet 303/304") # Generated from packet 305/306 gpio_readi(dev) # Generated from packet 309/310 gpio_readi(dev) # Generated from packet 313/314 sm_read(dev) # Generated from packet 317/318 buff = bulk2(dev, "\x01", target=0x85) validate_readv(( "\x84\xA4\x06\x02\x00\x26\x00\x43\x00\xC0\x03\x00\x08\x10\x24" "\x00\x00\x30\x00\x83\x00\x30\x01\x09\x00\xC0\x00\x00\x00\x09\x00" "\x08\x00\xFF\x00\xC4\x1E\x00\x00\xCC\x1E\x00\x00\xB4\x46\x00\x00" "\xD0\x1E\x00\x00\xC0\x1E\x01\x00\xB0\x1E\x01\x00\x00\x00\x30\x55" "\x01\x00\x00\x00\x00\x00\x02\x00\x80\x01\xD0\x01\x02\x00\x01\x00" "\x00\x00\x56\x10\x00\x00\xA0\x25\x00\x00\x84\x25\x00\x00\x00\x00" "\x01\x00\x7C\x25\x00\x00\x7E\x25\x00\x00\x80\x25\x00\x00\x74\x46" "\x00\x00\x38\x11\x00\x00\x3C\x11\x00\x00\x40\x11\x00\x00\x44\x11" "\x00\x00\xC0\x1E\x00\x00", # SM "\x84\xA4\x06\x02\x00\x26\x00\x43\x00\xC0\x03\x00\x08\x10\x24\x00" \ "\x00\x30\x00\x83\x00\x30\x01\x09\x00\xC0\x00\x00\x00\x09\x00\x08" \ "\x00\xFF\x00\xC4\x1E\x00\x00\xCC\x1E\x00\x00\xB4\x46\x00\x00\xD0" \ "\x1E\x00\x00\xC0\x1E\x01\x00\xB0\x1E\x01\x00\x00\x00\x30\x55\x01" \ "\x00\x00\x00\x00\x00\x02\x00\x80\x01\xC0\x01\x02\x00\x01\x00\x00" \ "\x00\x56\x10\x00\x00\xA0\x25\x00\x00\x84\x25\x00\x00\x00\x00\x01" \ "\x00\x7C\x25\x00\x00\x7E\x25\x00\x00\x80\x25\x00\x00\x74\x46\x00" \ "\x00\x38\x11\x00\x00\x3C\x11\x00\x00\x40\x11\x00\x00\x44\x11\x00" \ "\x00\xC0\x1E\x00\x00" ), buff, "packet 319/320") # Generated from packet 321/322 bulkWrite(0x02, "\x43\x19\x00\x00\x00") # Generated from packet 323/324 bulkWrite(0x02, "\x20\x01\x00\x0C\x04") # Generated from packet 325/326 bulkWrite(0x02, "\x41\x00\x00") # Generated from packet 327/328 buff = bulk2(dev, "\x10\x80\x02", target=6) validate_read("\x80\x00\x00\x00\x09\x00", buff, "packet 329/330") # Generated from packet 331/332 buff = bulk2(dev, "\x45\x01\x00\x00\x31\x00\x06", target=0x64) validate_read("\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" "\xFF\xFF\xFF\xFF\xFF", buff, "packet 333/334") # Generated from packet 335/336 buff = bulk2(dev, "\x49", target=2) validate_read("\x0F\x00", buff, "packet 337/338") # Generated from packet 339/340 gpio_readi(dev) # Generated from packet 343/344 gpio_readi(dev) ''' For kicks tried: bulk2(dev, "\x0E\x01", target=0x20) 00000000 14 00 54 41 38 34 56 4C 56 5F 46 58 34 00 00 00 |..TA84VLV_FX4...| TA84VLV_FX4 Is this some sort of special FX4 socket configuration? Looks like an EEPROM read maybe just reading some random memory buffer though ''' # Generated from packet 347/348 sm_read(dev) # Generated from packet 351/352 bulkWrite(0x02, "\x3B\x0C\x22\x00\xC0\x40\x00\x3B\x0E\x22\x00\xC0\x00\x00\x3B\x1A" "\x22\x00\xC0\x18\x00") # Generated from packet 353/354 buff = bulk2(dev, "\x4A\x03\x00\x00\x00", target=2) validate_read("\x03\x00", buff, "packet 355/356") # Generated from packet 357/358 bulkWrite(0x02, "\x4C\x00\x02") # Generated from packet 359/360 # None (0xB2) controlWrite(0x40, 0xB2, 0x0000, 0x0000, "") # Generated from packet 361/362 bulkWrite(0x02, "\x50\x45\x00\x00\x00") # Generated from packet 363/364 buff = bulk2(dev, "\xE9\x03\x00\x00\x00\x90\x00\x00\xE9\x03\x00\x00\x00\x90\x01\x10" "\xE9\x03\x00\x00\x00\x90\x00\x00\xE9\x03\x00\x00\x00\x90\x01\x80" "\xE9\x02\x00\x00\x00\x90\x00\xE9\x04\x00\x00\x00\x00\x00\x00\x00" "\xE9\x03\x00\x00\x00\x90\x00\x00\x66\xB9\x00\x00\xB2\x00\xFB\xFF" "\x25\x44\x11\x00\x00", target=2, truncate=True) validate_read("\x80\x00", buff, "packet 365/366") # Generated from packet 367/368 buff = bulk2(dev, "\x02", target=6, truncate=True) validate_read("\x81\x00\x50\x00\x09\x00", buff, "packet 369/370") # Generated from packet 371/372 bulkWrite(0x02, "\x50\xC0\x00\x00\x00") # Generated from packet 373/374 buff = bulk2(dev, "\x66\xB8\x01\x2D\x81\xE3\xFF\xFF\x00\x00\x66\xBB\x18\x00\x66\xC7" "\x05\x30\x40\x00\xC0\xF0\xFF\x89\xD9\xC1\xE1\x02\x66\xC7\x81\x02" "\x00\x00\x00\xF0\xFF\x66\x03\x05\xE4\x46\x00\x00\x66\x89\x05\x90" "\x40\x00\xC0\x89\xDA\x81\xCA\x00\x80\x00\x00\x66\x89\x15\x50\x40" "\x00\xC0\xC6\x05\x14\x22\x00\xC0\x7B\x81\xCA\x00\x40\x00\x00\x66" "\x89\x15\x50\x40\x00\xC0\x89\xD9\x66\xC1\xE1\x02\x66\x89\x81\x00" "\x00\x00\x00\x66\x2B\x05\xE4\x46\x00\x00\xC6\x05\x14\x22\x00\xC0" "\xBB\x81\xCB\x00\x80\x00\x00\x66\x89\x1D\x50\x40\x00\xC0\x89\xC2" "\x81\xE2\x07\x00\x00\x00\x03\xD2\x81\xCA\x01\x00\x00\x00\x89\xD9" "\x81\xE1\x03\x00\x00\x00\xD3\xE2\xD3\xE2\xD3\xE2\xD3\xE2\xD3\xE2" "\xC1\xE2\x0A\x89\xD9\x81\xE1\xFC\x03\x00\x00\x09\xCA\x88\x82\x00" "\x00\x00\x40\x66\xB9\x00\x00\xB2\x00\xFB\xFF\x25\x44\x11\x00\x00", target=2, truncate=True) validate_read("\x81\x00", buff, "packet 375/376") # Generated from packet 377/378 buff = bulk2(dev, "\x02", target=6, truncate=True) validate_read("\x82\x00\x10\x01\x09\x00", buff, "packet 379/380") # Generated from packet 381/382 buff = bulk2(dev, "\x04\x63\x05\x72\x06\x69\x07\x70\x08\x74\x09\x20\x0A\x74\x0B\x79" "\x57\x81\x00\x0C\x02\x30", target=2, truncate=True) validate_read("\x02\x00", buff, "packet 383/384") # When paired with below looping fails on average maybe about 3 iterations # (about 1 - 8 observed) # 31/71 bit changes # Generated from packet 385/386 buff = bulk2(dev, "\x20\x01\x00\x2B\x3B\x0C\x22\x00\xC0\x40\x00\x3B\x0E\x22\x00\xC0" "\x00\x00\x3B\x1A\x22\x00\xC0\x18\x00\x0E\x01", target=0x20, truncate=True) validate_read( "\x14\x00\x54\x41\x38\x34\x56\x4C\x56\x5F\x46\x58\x34\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x3E" "\x2C", buff, "packet 387/388") # 30k iterations by itself and always passes # Generated from packet 389/390 gpio_readi(dev) # Generated from packet 393/394 gpio_readi(dev) # Generated from packet 397/398 sm_read(dev) # Generated from packet 401/402 bulkWrite(0x02, "\x48\x00\x20\x00\x00\x50\x12\x00\x00\x00") # Generated from packet 403/404 buff = bulk2(dev, "\x00\x00\x00\x00\x04\x00\x08\x00\x0C\x00\x10\x00\x14\x00\x18\x00" "\x1C\x00", target=2, truncate=True) validate_read("\x82\x00", buff, "packet 405/406") # Generated from packet 407/408 buff = bulk2(dev, "\x02", target=6, truncate=True) validate_read("\x83\x00\x30\x01\x09\x00", buff, "packet 409/410") # Generated from packet 411/412 buff = bulk2(dev, "\x1D\x10\x01\x09\x00\x00\x00\x15\x60\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x1C\x00\x00\x48\x00\x12\xAA", target=1, truncate=True) validate_read("\xAB", buff, "packet 413/414")
def replay(dev): bulkRead, bulkWrite, controlRead, controlWrite = usb_wraps(dev) ''' cmd_01 ''' # Generated from packet 169/170 # ... # Generated from packet 179/180 load_fx2(dev) # Generated from packet 50/51 # None (0xB0) buff = controlRead(0xC0, 0xB0, 0x0000, 0x0000, 4096) # NOTE:: req max 4096 but got 3 validate_read("\x00\x00\x00", buff, "packet 50/51") # Generated from packet 55/56 # None (0xB0) buff = controlRead(0xC0, 0xB0, 0x0000, 0x0000, 4096) # NOTE:: req max 4096 but got 3 validate_read("\x00\x00\x00", buff, "packet 55/56") # Generated from packet 57/58 buff = bulkRead(0x86, 0x0200) # NOTE:: req max 512 but got 4 validate_read("\x08\x16\x01\x00", buff, "packet 57/58") # Generated from packet 62/63 # None (0xB0) buff = controlRead(0xC0, 0xB0, 0x0000, 0x0000, 4096) # NOTE:: req max 4096 but got 3 validate_read("\x00\x00\x00", buff, "packet 62/63") # Generated from packet 64/65 buff = bulkRead(0x86, 0x0200) # NOTE:: req max 512 but got 4 validate_read("\x08\x16\x01\x00", buff, "packet 64/65") # Generated from packet 66/67 buff = cmd_01(dev) # Seems to be okay if we always do this although its only sometimes needed glitch_154 = True # All of these are the same except for the state byte # maybe varies depending if SM installed if len(buff) == 129: print 'Cold boot' state = ord(buff[0x13]) if state != 0x80: print ' WARNING: state: 0x%02X. Interrupted load?' % state # 70-117 boot_cold(dev) elif len(buff) == 133: print 'Warm boot' # 70-76 boot_warm(dev) # elif buff == r01_glitch_154: # print 'Warm boot (glitch)' # glitch_154 = True # # 70-76 # boot_warm(dev) else: raise Exception("Bad warm/cold response") # Packets going forward are from cold boot since its more canonical / clean # warm -40 packet (ie 120 cold => 80 warm) sn_read(dev) cmd_01(dev) # temp # Generated from packet 122/123 buff = bulk2(dev, "\x14\x38\x25\x00\x00\x04\x00\x90\x32\x90\x00\xA7\x02\x1F\x00\x14" "\x40\x25\x00\x00\x01\x00\x3C\x36\x0E\x01", target=0x20) validate_read("\x14\x00\x54\x41\x38\x34\x56\x4C\x56\x5F\x46\x58\x34\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x3E" "\x2C", buff, "packet 124/125") cmd_01(dev) # temp # Generated from packet 126/127 gpio_readi(dev) cmd_01(dev) # temp # Generated from packet 130/131 gpio_readi(dev) # Generated from packet 134/135 sm_read(dev) # Generated from packet 138/139 cmd_01(dev) # Generated from packet 142/143 bulkWrite(0x02, "\x43\x19\x00\x00\x00") # Generated from packet 144/145 bulkWrite(0x02, "\x20\x01\x00\x0C\x04") # Generated from packet 146/147 bulkWrite(0x02, "\x41\x00\x00") # Generated from packet 148/149 # cmd_01[0x17]: 0x00 => 0x09 # warm: als state 0x83 => 0x80, 0x15: 0x30 => 0x00, 016: 0x01 => 0x00 buff = bulk2(dev, "\x10\x80\x02", target=6) validate_read("\x80\x00\x00\x00\x09\x00", buff, "packet 150/151") # Generated from packet 152/153 buff = bulk2(dev, "\x45\x01\x00\x00\x31\x00\x06", target=0x64) validate_read("\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" "\xFF\xFF\xFF\xFF\xFF", buff, "packet 154/155") # Generated from packet 156/157 cmd_49(dev) # Generated from packet 160/161 gpio_readi(dev) # Generated from packet 164/165 gpio_readi(dev) # Generated from packet 168/169 sm_read(dev) # Generated from packet 172/173 bulkWrite(0x02, "\x3B\x0C\x22\x00\xC0\x30\x00\x3B\x0E\x22\x00\xC0\x00\x00\x3B\x1A" "\x22\x00\xC0\x18\x00") cmd_01(dev) # temp # Generated from packet 174/175 buff = bulk2(dev, "\x4A\x03\x00\x00\x00", target=2) validate_read("\x03\x00", buff, "packet 176/177") # Atomic # Generated from packet 178/179 bulkWrite(0x02, "\x4C\x00\x02") # Generated from packet 180/181 # None (0xB2) controlWrite(0x40, 0xB2, 0x0000, 0x0000, "") # Atomic # cmd_01 state: 0x80 => 0x81 # Generated from packet 182/183 cmd_50(dev, "\x45\x00") # Generated from packet 184/185 # FIXME: size field unexpected buff = bulk2(dev, "\xE9\x03\x00\x00\x00\x90\x00\x00\xE9\x03\x00\x00\x00\x90\x01\x10" "\xE9\x03\x00\x00\x00\x90\x00\x00\xE9\x03\x00\x00\x00\x90\x01\x80" "\xE9\x02\x00\x00\x00\x90\x00\xE9\x04\x00\x00\x00\x00\x00\x00\x00" "\xE9\x03\x00\x00\x00\x90\x00\x00\x66\xB9\x00\x00\xB2\x00\xFB\xFF" "\x25\x44\x11\x00\x00", target=2) validate_read("\x80\x00", buff, "packet 186/187") # cmd_01[0x15]: 0x00 => 0x50 # Generated from packet 188/189 cmd_02(dev, "\x81\x00\x50\x00\x09\x00", "packet 190/191") # Atomic # cmd_01 state: 0x81 => 0x82 # Generated from packet 192/193 cmd_50(dev, "\xC0\x00") # Generated from packet 194/195 buff = bulk2(dev, "\x66\xB8\x01\x2D\x81\xE3\xFF\xFF\x00\x00\x66\xBB\x18\x00\x66\xC7" "\x05\x30\x40\x00\xC0\xF0\xFF\x89\xD9\xC1\xE1\x02\x66\xC7\x81\x02" "\x00\x00\x00\xF0\xFF\x66\x03\x05\xE4\x46\x00\x00\x66\x89\x05\x90" "\x40\x00\xC0\x89\xDA\x81\xCA\x00\x80\x00\x00\x66\x89\x15\x50\x40" "\x00\xC0\xC6\x05\x14\x22\x00\xC0\x7B\x81\xCA\x00\x40\x00\x00\x66" "\x89\x15\x50\x40\x00\xC0\x89\xD9\x66\xC1\xE1\x02\x66\x89\x81\x00" "\x00\x00\x00\x66\x2B\x05\xE4\x46\x00\x00\xC6\x05\x14\x22\x00\xC0" "\xBB\x81\xCB\x00\x80\x00\x00\x66\x89\x1D\x50\x40\x00\xC0\x89\xC2" "\x81\xE2\x07\x00\x00\x00\x03\xD2\x81\xCA\x01\x00\x00\x00\x89\xD9" "\x81\xE1\x03\x00\x00\x00\xD3\xE2\xD3\xE2\xD3\xE2\xD3\xE2\xD3\xE2" "\xC1\xE2\x0A\x89\xD9\x81\xE1\xFC\x03\x00\x00\x09\xCA\x88\x82\x00" "\x00\x00\x40\x66\xB9\x00\x00\xB2\x00\xFB\xFF\x25\x44\x11\x00\x00", target=2) validate_read("\x81\x00", buff, "packet 196/197") # cmd_01: 0x15: 0x50 => 0x01. 0x16: 0x00 => 0x01 # Generated from packet 198/199 cmd_02(dev, "\x82\x00\x10\x01\x09\x00", "packet 200/201") if glitch_154: buff = bulk2(dev, "\x08\x20\x09\x20\x0A\x20\x0B\x20\x57\x81\x00\x0C\x04\x30", target=2) validate_read("\x04\x00", buff, "packet 204/205") else: # Think this clears the red light # Generated from packet 202/203 buff = bulk2(dev, "\x04\x72\x05\x73\x06\x2E\x07\x70\x08\x75\x09\x73\x0A\x68\x0B\x28" "\x57\x81\x00\x0C\x04\x30", target=2) validate_read("\x04\x00", buff, "packet 204/205") # Generated from packet 206/207 buff = bulk2(dev, "\x3B\x0C\x22\x00\xC0\x30\x00\x3B\x0E\x22\x00\xC0\x00\x00\x3B\x1A" "\x22\x00\xC0\x18\x00\x0E\x01", target=0x20) validate_read( "\x14\x00\x54\x41\x38\x34\x56\x4C\x56\x5F\x46\x58\x34\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x3E" "\x2C", buff, "packet 208/209") # Generated from packet 210/211 gpio_readi(dev) # Generated from packet 214/215 gpio_readi(dev) # Generated from packet 218/219 sm_read(dev) # Atomic # cmd_01 state: 0x82 => 0x83 # Generated from packet 222/223 bulkWrite(0x02, "\x48\x00\x20\x00\x00\x50\x12\x00\x00\x00") # Generated from packet 224/225 buff = bulk2(dev, "\x00\x00\x00\x00\x04\x00\x08\x00\x0C\x00\x10\x00\x14\x00\x18\x00" "\x1C\x00", target=2) validate_read("\x82\x00", buff, "packet 226/227") # Generated from packet 228/229 cmd_02(dev, "\x83\x00\x30\x01\x09\x00", "packet 230/231") # cmd_01: 0x15: 0x10 => 0x30 # Generated from packet 232/233 buff = bulk2(dev, "\x1D\x10\x01\x09\x00\x00\x00\x15\x60\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x1C\x00\x00\x48\x00\x12\xAA", target=1) validate_read("\xAB", buff, "packet 234/235") # Generated from packet 236/237 gpio_readi(dev) cmd_01(dev) # temp