]>
Commit | Line | Data |
---|---|---|
54a942b0 | 1 | //-----------------------------------------------------------------------------\r |
2 | //\r | |
3 | // This code is licensed to you under the terms of the GNU GPL, version 2 or,\r | |
4 | // at your option, any later version. See the LICENSE.txt file for the text of\r | |
5 | // the license.\r | |
6 | //-----------------------------------------------------------------------------\r | |
7 | // Low frequency T55xx commands\r | |
8 | //-----------------------------------------------------------------------------\r | |
9 | \r | |
10 | #include <stdio.h>\r | |
11 | #include <string.h>\r | |
12 | #include <inttypes.h>\r | |
224ce36e | 13 | #include <time.h>\r |
54a942b0 | 14 | #include "proxmark3.h"\r |
15 | #include "ui.h"\r | |
16 | #include "graph.h"\r | |
13d77ef9 | 17 | #include "cmdmain.h"\r |
54a942b0 | 18 | #include "cmdparser.h"\r |
19 | #include "cmddata.h"\r | |
20 | #include "cmdlf.h"\r | |
21 | #include "cmdlft55xx.h"\r | |
13d77ef9 | 22 | #include "util.h"\r |
23 | #include "data.h"\r | |
24 | #include "lfdemod.h"\r | |
25 | #include "../common/crc.h"\r | |
26 | #include "../common/iso14443crc.h"\r | |
27 | #include "cmdhf14a.h"\r | |
28 | \r | |
1d0ccbe0 | 29 | #define T55x7_CONFIGURATION_BLOCK 0x00\r |
30 | #define T55x7_PAGE0 0x00\r | |
31 | #define T55x7_PAGE1 0x01\r | |
952a812c | 32 | #define T55x7_PWD 0x00000010\r |
1d0ccbe0 | 33 | #define REGULAR_READ_MODE_BLOCK 0xFF\r |
13d77ef9 | 34 | \r |
35 | // Default configuration\r | |
36 | t55xx_conf_block_t config = { .modulation = DEMOD_ASK, .inverted = FALSE, .offset = 0x00, .block0 = 0x00};\r | |
37 | \r | |
94422fa2 | 38 | t55xx_conf_block_t Get_t55xx_Config(){\r |
39 | return config;\r | |
40 | }\r | |
41 | void Set_t55xx_Config(t55xx_conf_block_t conf){\r | |
42 | config = conf;\r | |
43 | }\r | |
44 | \r | |
13d77ef9 | 45 | int usage_t55xx_config(){\r |
46 | PrintAndLog("Usage: lf t55xx config [d <demodulation>] [i 1] [o <offset>]");\r | |
9276e859 | 47 | PrintAndLog("Options:");\r |
13d77ef9 | 48 | PrintAndLog(" h This help");\r |
49 | PrintAndLog(" b <8|16|32|40|50|64|100|128> Set bitrate");\r | |
e98572a1 | 50 | PrintAndLog(" d <FSK|FSK1|FSK1a|FSK2|FSK2a|ASK|PSK1|PSK2|NRZ|BI|BIa> Set demodulation FSK / ASK / PSK / NRZ / Biphase / Biphase A");\r |
13d77ef9 | 51 | PrintAndLog(" i [1] Invert data signal, defaults to normal");\r |
52 | PrintAndLog(" o [offset] Set offset, where data should start decode in bitstream");\r | |
53 | PrintAndLog("");\r | |
54 | PrintAndLog("Examples:");\r | |
55 | PrintAndLog(" lf t55xx config d FSK - FSK demodulation");\r | |
56 | PrintAndLog(" lf t55xx config d FSK i 1 - FSK demodulation, inverse data");\r | |
57 | PrintAndLog(" lf t55xx config d FSK i 1 o 3 - FSK demodulation, inverse data, offset=3,start from position 3 to decode data");\r | |
58 | PrintAndLog("");\r | |
59 | return 0;\r | |
60 | }\r | |
61 | int usage_t55xx_read(){\r | |
1d0ccbe0 | 62 | PrintAndLog("Usage: lf t55xx read [b <block>] [p <password>] <override_safety> <page1>");\r |
9276e859 | 63 | PrintAndLog("Options:");\r |
1d0ccbe0 | 64 | PrintAndLog(" b <block> - block number to read. Between 0-7");\r |
65 | PrintAndLog(" p <password> - OPTIONAL password (8 hex characters)");\r | |
66 | PrintAndLog(" o - OPTIONAL override safety check");\r | |
67 | PrintAndLog(" 1 - OPTIONAL read Page 1 instead of Page 0");\r | |
9276e859 | 68 | PrintAndLog(" ****WARNING****");\r |
69 | PrintAndLog(" Use of read with password on a tag not configured for a pwd");\r | |
70 | PrintAndLog(" can damage the tag");\r | |
13d77ef9 | 71 | PrintAndLog("");\r |
72 | PrintAndLog("Examples:");\r | |
9276e859 | 73 | PrintAndLog(" lf t55xx read b 0 - read data from block 0");\r |
74 | PrintAndLog(" lf t55xx read b 0 p feedbeef - read data from block 0 password feedbeef");\r | |
75 | PrintAndLog(" lf t55xx read b 0 p feedbeef o - read data from block 0 password feedbeef safety check");\r | |
13d77ef9 | 76 | PrintAndLog("");\r |
77 | return 0;\r | |
78 | }\r | |
79 | int usage_t55xx_write(){\r | |
1d0ccbe0 | 80 | PrintAndLog("Usage: lf t55xx wr [b <block>] [d <data>] [p <password>] [1]");\r |
9276e859 | 81 | PrintAndLog("Options:");\r |
1d0ccbe0 | 82 | PrintAndLog(" b <block> - block number to write. Between 0-7");\r |
83 | PrintAndLog(" d <data> - 4 bytes of data to write (8 hex characters)");\r | |
84 | PrintAndLog(" p <password> - OPTIONAL password 4bytes (8 hex characters)");\r | |
85 | PrintAndLog(" 1 - OPTIONAL write Page 1 instead of Page 0");\r | |
13d77ef9 | 86 | PrintAndLog("");\r |
87 | PrintAndLog("Examples:");\r | |
1d0ccbe0 | 88 | PrintAndLog(" lf t55xx write b 3 d 11223344 - write 11223344 to block 3");\r |
89 | PrintAndLog(" lf t55xx write b 3 d 11223344 p feedbeef - write 11223344 to block 3 password feedbeef");\r | |
13d77ef9 | 90 | PrintAndLog("");\r |
91 | return 0;\r | |
92 | }\r | |
93 | int usage_t55xx_trace() {\r | |
94 | PrintAndLog("Usage: lf t55xx trace [1]");\r | |
9276e859 | 95 | PrintAndLog("Options:");\r |
1d0ccbe0 | 96 | PrintAndLog(" [graph buffer data] - if set, use Graphbuffer otherwise read data from tag.");\r |
13d77ef9 | 97 | PrintAndLog("");\r |
98 | PrintAndLog("Examples:");\r | |
99 | PrintAndLog(" lf t55xx trace");\r | |
100 | PrintAndLog(" lf t55xx trace 1");\r | |
101 | PrintAndLog("");\r | |
102 | return 0;\r | |
103 | }\r | |
104 | int usage_t55xx_info() {\r | |
105 | PrintAndLog("Usage: lf t55xx info [1]");\r | |
9276e859 | 106 | PrintAndLog("Options:");\r |
1d0ccbe0 | 107 | PrintAndLog(" [graph buffer data] - if set, use Graphbuffer otherwise read data from tag.");\r |
13d77ef9 | 108 | PrintAndLog("");\r |
109 | PrintAndLog("Examples:");\r | |
110 | PrintAndLog(" lf t55xx info");\r | |
111 | PrintAndLog(" lf t55xx info 1");\r | |
112 | PrintAndLog("");\r | |
113 | return 0;\r | |
114 | }\r | |
115 | int usage_t55xx_dump(){\r | |
1d0ccbe0 | 116 | PrintAndLog("Usage: lf t55xx dump <password> [o]");\r |
9276e859 | 117 | PrintAndLog("Options:");\r |
1d0ccbe0 | 118 | PrintAndLog(" <password> - OPTIONAL password 4bytes (8 hex symbols)");\r |
119 | PrintAndLog(" o - OPTIONAL override, force pwd read despite danger to card");\r | |
13d77ef9 | 120 | PrintAndLog("");\r |
121 | PrintAndLog("Examples:");\r | |
122 | PrintAndLog(" lf t55xx dump");\r | |
1d0ccbe0 | 123 | PrintAndLog(" lf t55xx dump feedbeef o");\r |
13d77ef9 | 124 | PrintAndLog("");\r |
125 | return 0;\r | |
126 | }\r | |
127 | int usage_t55xx_detect(){\r | |
9276e859 | 128 | PrintAndLog("Usage: lf t55xx detect [1]");\r |
129 | PrintAndLog("Options:");\r | |
1d0ccbe0 | 130 | PrintAndLog(" [graph buffer data] - if set, use Graphbuffer otherwise read data from tag.");\r |
13d77ef9 | 131 | PrintAndLog("");\r |
132 | PrintAndLog("Examples:");\r | |
133 | PrintAndLog(" lf t55xx detect");\r | |
134 | PrintAndLog(" lf t55xx detect 1");\r | |
135 | PrintAndLog("");\r | |
136 | return 0;\r | |
137 | }\r | |
9276e859 | 138 | int usage_t55xx_wakup(){\r |
139 | PrintAndLog("Usage: lf t55xx wakeup [h] p <password>");\r | |
140 | PrintAndLog("This commands send the Answer-On-Request command and leaves the readerfield ON afterwards.");\r | |
141 | PrintAndLog("Options:");\r | |
142 | PrintAndLog(" h - this help");\r | |
143 | PrintAndLog(" p <password> - password 4bytes (8 hex symbols)");\r | |
144 | PrintAndLog("");\r | |
145 | PrintAndLog("Examples:");\r | |
146 | PrintAndLog(" lf t55xx wakeup p 11223344 - send wakeup password");\r | |
147 | return 0;\r | |
148 | }\r | |
54a942b0 | 149 | \r |
150 | static int CmdHelp(const char *Cmd);\r | |
151 | \r | |
13d77ef9 | 152 | int CmdT55xxSetConfig(const char *Cmd) {\r |
54a942b0 | 153 | \r |
13d77ef9 | 154 | uint8_t offset = 0;\r |
155 | bool errors = FALSE;\r | |
156 | uint8_t cmdp = 0;\r | |
157 | char modulation[5] = {0x00};\r | |
158 | char tmp = 0x00;\r | |
159 | uint8_t bitRate = 0;\r | |
160 | uint8_t rates[9] = {8,16,32,40,50,64,100,128,0};\r | |
1d0ccbe0 | 161 | while(param_getchar(Cmd, cmdp) != 0x00 && !errors) {\r |
13d77ef9 | 162 | tmp = param_getchar(Cmd, cmdp);\r |
163 | switch(tmp)\r | |
164 | {\r | |
165 | case 'h':\r | |
166 | case 'H':\r | |
167 | return usage_t55xx_config();\r | |
168 | case 'b':\r | |
169 | errors |= param_getdec(Cmd, cmdp+1, &bitRate);\r | |
170 | if ( !errors){\r | |
171 | uint8_t i = 0;\r | |
172 | for (; i < 9; i++){\r | |
173 | if (rates[i]==bitRate) {\r | |
174 | config.bitrate = i;\r | |
175 | break;\r | |
176 | }\r | |
177 | }\r | |
178 | if (i==9) errors = TRUE;\r | |
179 | }\r | |
180 | cmdp+=2;\r | |
181 | break;\r | |
182 | case 'd':\r | |
183 | param_getstr(Cmd, cmdp+1, modulation);\r | |
184 | cmdp += 2;\r | |
54a942b0 | 185 | \r |
2767fc02 | 186 | if ( strcmp(modulation, "FSK" ) == 0) {\r |
13d77ef9 | 187 | config.modulation = DEMOD_FSK;\r |
2767fc02 | 188 | } else if ( strcmp(modulation, "FSK1" ) == 0) {\r |
13d77ef9 | 189 | config.modulation = DEMOD_FSK1;\r |
2767fc02 | 190 | config.inverted=1;\r |
191 | } else if ( strcmp(modulation, "FSK1a" ) == 0) {\r | |
13d77ef9 | 192 | config.modulation = DEMOD_FSK1a;\r |
2767fc02 | 193 | config.inverted=0;\r |
194 | } else if ( strcmp(modulation, "FSK2" ) == 0) {\r | |
13d77ef9 | 195 | config.modulation = DEMOD_FSK2;\r |
2767fc02 | 196 | config.inverted=0;\r |
197 | } else if ( strcmp(modulation, "FSK2a" ) == 0) {\r | |
13d77ef9 | 198 | config.modulation = DEMOD_FSK2a;\r |
2767fc02 | 199 | config.inverted=1;\r |
200 | } else if ( strcmp(modulation, "ASK" ) == 0) {\r | |
13d77ef9 | 201 | config.modulation = DEMOD_ASK;\r |
2767fc02 | 202 | } else if ( strcmp(modulation, "NRZ" ) == 0) {\r |
13d77ef9 | 203 | config.modulation = DEMOD_NRZ;\r |
2767fc02 | 204 | } else if ( strcmp(modulation, "PSK1" ) == 0) {\r |
13d77ef9 | 205 | config.modulation = DEMOD_PSK1;\r |
2767fc02 | 206 | } else if ( strcmp(modulation, "PSK2" ) == 0) {\r |
13d77ef9 | 207 | config.modulation = DEMOD_PSK2;\r |
2767fc02 | 208 | } else if ( strcmp(modulation, "PSK3" ) == 0) {\r |
13d77ef9 | 209 | config.modulation = DEMOD_PSK3;\r |
2767fc02 | 210 | } else if ( strcmp(modulation, "BIa" ) == 0) {\r |
13d77ef9 | 211 | config.modulation = DEMOD_BIa;\r |
2767fc02 | 212 | config.inverted=1;\r |
213 | } else if ( strcmp(modulation, "BI" ) == 0) {\r | |
13d77ef9 | 214 | config.modulation = DEMOD_BI;\r |
2767fc02 | 215 | config.inverted=0;\r |
216 | } else {\r | |
13d77ef9 | 217 | PrintAndLog("Unknown modulation '%s'", modulation);\r |
218 | errors = TRUE;\r | |
219 | }\r | |
220 | break;\r | |
221 | case 'i':\r | |
222 | config.inverted = param_getchar(Cmd,cmdp+1) == '1';\r | |
223 | cmdp+=2;\r | |
224 | break;\r | |
225 | case 'o':\r | |
226 | errors |= param_getdec(Cmd, cmdp+1, &offset);\r | |
227 | if ( !errors )\r | |
228 | config.offset = offset;\r | |
229 | cmdp+=2;\r | |
230 | break;\r | |
231 | default:\r | |
232 | PrintAndLog("Unknown parameter '%c'", param_getchar(Cmd, cmdp));\r | |
233 | errors = TRUE;\r | |
234 | break;\r | |
235 | }\r | |
236 | }\r | |
54a942b0 | 237 | \r |
13d77ef9 | 238 | // No args\r |
1c8fbeb9 | 239 | if (cmdp == 0) return printConfiguration( config );\r |
240 | \r | |
13d77ef9 | 241 | //Validations\r |
1c8fbeb9 | 242 | if (errors) return usage_t55xx_config();\r |
54a942b0 | 243 | \r |
13d77ef9 | 244 | config.block0 = 0;\r |
1c8fbeb9 | 245 | return printConfiguration ( config );\r |
13d77ef9 | 246 | }\r |
54a942b0 | 247 | \r |
1d0ccbe0 | 248 | int T55xxReadBlock(uint8_t block, bool page1, bool usepwd, bool override, uint32_t password){\r |
249 | //Password mode\r | |
250 | if ( usepwd ) {\r | |
251 | // try reading the config block and verify that PWD bit is set before doing this!\r | |
252 | if ( !override ) {\r | |
253 | \r | |
254 | if ( !AquireData(T55x7_PAGE0, T55x7_CONFIGURATION_BLOCK, false, 0 ) ) return 0;\r | |
255 | \r | |
256 | if ( !tryDetectModulation() ) {\r | |
257 | PrintAndLog("Safety Check: Could not detect if PWD bit is set in config block. Exits.");\r | |
258 | return 0;\r | |
259 | } else {\r | |
260 | PrintAndLog("Safety Check: PWD bit is NOT set in config block. Reading without password..."); \r | |
261 | usepwd = false;\r | |
262 | page1 = false;\r | |
263 | }\r | |
264 | } else {\r | |
265 | PrintAndLog("Safety Check Overriden - proceeding despite risk");\r | |
266 | }\r | |
267 | }\r | |
268 | \r | |
269 | if (!AquireData(page1, block, usepwd, password) ) return 0;\r | |
270 | if (!DecodeT55xxBlock()) return 0;\r | |
271 | \r | |
272 | char blk[10]={0};\r | |
273 | sprintf(blk,"%d", block);\r | |
274 | printT55xxBlock(blk); \r | |
275 | return 1;\r | |
276 | }\r | |
277 | \r | |
13d77ef9 | 278 | int CmdT55xxReadBlock(const char *Cmd) {\r |
1d0ccbe0 | 279 | uint8_t block = REGULAR_READ_MODE_BLOCK;\r |
1c8fbeb9 | 280 | uint32_t password = 0; //default to blank Block 7\r |
1d0ccbe0 | 281 | bool usepwd = false;\r |
282 | bool override = false;\r | |
283 | bool page1 = false;\r | |
284 | bool errors = false;\r | |
9276e859 | 285 | uint8_t cmdp = 0;\r |
9276e859 | 286 | while(param_getchar(Cmd, cmdp) != 0x00 && !errors) {\r |
287 | switch(param_getchar(Cmd, cmdp)) {\r | |
288 | case 'h':\r | |
289 | case 'H':\r | |
1c8fbeb9 | 290 | return usage_t55xx_read();\r |
9276e859 | 291 | case 'b':\r |
292 | case 'B':\r | |
293 | errors |= param_getdec(Cmd, cmdp+1, &block);\r | |
1c8fbeb9 | 294 | cmdp += 2;\r |
9276e859 | 295 | break;\r |
296 | case 'o':\r | |
297 | case 'O':\r | |
1c8fbeb9 | 298 | override = TRUE;\r |
9276e859 | 299 | cmdp++;\r |
300 | break;\r | |
301 | case 'p':\r | |
302 | case 'P':\r | |
1d0ccbe0 | 303 | password = param_get32ex(Cmd, cmdp+1, 0, 16);\r |
304 | usepwd = true;\r | |
1c8fbeb9 | 305 | cmdp += 2;\r |
9276e859 | 306 | break;\r |
1d0ccbe0 | 307 | case '1':\r |
308 | page1 = true;\r | |
309 | cmdp++;\r | |
310 | break;\r | |
9276e859 | 311 | default:\r |
312 | PrintAndLog("Unknown parameter '%c'", param_getchar(Cmd, cmdp));\r | |
313 | errors = true;\r | |
314 | break;\r | |
315 | }\r | |
316 | }\r | |
317 | if (errors) return usage_t55xx_read();\r | |
1c8fbeb9 | 318 | \r |
1d0ccbe0 | 319 | if (block > 7 && block != REGULAR_READ_MODE_BLOCK ) {\r |
13d77ef9 | 320 | PrintAndLog("Block must be between 0 and 7");\r |
1d0ccbe0 | 321 | return 0;\r |
13d77ef9 | 322 | }\r |
1d0ccbe0 | 323 | PrintAndLog("Reading Page %d:", page1); \r |
324 | PrintAndLog("blk | hex data | binary");\r | |
325 | return T55xxReadBlock(block, page1, usepwd, override, password);\r | |
54a942b0 | 326 | }\r |
327 | \r | |
13d77ef9 | 328 | bool DecodeT55xxBlock(){\r |
329 | \r | |
fef74fdc | 330 | char buf[30] = {0x00};\r |
13d77ef9 | 331 | char *cmdStr = buf;\r |
332 | int ans = 0;\r | |
333 | uint8_t bitRate[8] = {8,16,32,40,50,64,100,128};\r | |
13d77ef9 | 334 | DemodBufferLen = 0x00;\r |
54a942b0 | 335 | \r |
13d77ef9 | 336 | switch( config.modulation ){\r |
337 | case DEMOD_FSK:\r | |
224ce36e | 338 | snprintf(cmdStr, sizeof(buf),"%d %d", bitRate[config.bitrate], config.inverted );\r |
13d77ef9 | 339 | ans = FSKrawDemod(cmdStr, FALSE);\r |
340 | break;\r | |
341 | case DEMOD_FSK1:\r | |
13d77ef9 | 342 | case DEMOD_FSK1a:\r |
224ce36e | 343 | snprintf(cmdStr, sizeof(buf),"%d %d 8 5", bitRate[config.bitrate], config.inverted );\r |
13d77ef9 | 344 | ans = FSKrawDemod(cmdStr, FALSE);\r |
345 | break;\r | |
346 | case DEMOD_FSK2:\r | |
13d77ef9 | 347 | case DEMOD_FSK2a:\r |
224ce36e | 348 | snprintf(cmdStr, sizeof(buf),"%d %d 10 8", bitRate[config.bitrate], config.inverted );\r |
13d77ef9 | 349 | ans = FSKrawDemod(cmdStr, FALSE);\r |
350 | break;\r | |
351 | case DEMOD_ASK:\r | |
224ce36e | 352 | snprintf(cmdStr, sizeof(buf),"%d %d 0", bitRate[config.bitrate], config.inverted );\r |
fef74fdc | 353 | ans = ASKDemod(cmdStr, FALSE, FALSE, 1);\r |
13d77ef9 | 354 | break;\r |
355 | case DEMOD_PSK1:\r | |
224ce36e | 356 | snprintf(cmdStr, sizeof(buf),"%d %d 0", bitRate[config.bitrate], config.inverted );\r |
13d77ef9 | 357 | ans = PSKDemod(cmdStr, FALSE);\r |
13d77ef9 | 358 | break;\r |
2767fc02 | 359 | case DEMOD_PSK2: //inverted won't affect this\r |
360 | case DEMOD_PSK3: //not fully implemented\r | |
224ce36e | 361 | snprintf(cmdStr, sizeof(buf),"%d 0 1", bitRate[config.bitrate] );\r |
13d77ef9 | 362 | ans = PSKDemod(cmdStr, FALSE);\r |
363 | psk1TOpsk2(DemodBuffer, DemodBufferLen);\r | |
364 | break;\r | |
365 | case DEMOD_NRZ:\r | |
224ce36e | 366 | snprintf(cmdStr, sizeof(buf),"%d %d 1", bitRate[config.bitrate], config.inverted );\r |
13d77ef9 | 367 | ans = NRZrawDemod(cmdStr, FALSE);\r |
368 | break;\r | |
369 | case DEMOD_BI:\r | |
13d77ef9 | 370 | case DEMOD_BIa:\r |
224ce36e | 371 | snprintf(cmdStr, sizeof(buf),"0 %d %d 0", bitRate[config.bitrate], config.inverted );\r |
13d77ef9 | 372 | ans = ASKbiphaseDemod(cmdStr, FALSE);\r |
373 | break;\r | |
374 | default:\r | |
375 | return FALSE;\r | |
376 | }\r | |
377 | return (bool) ans;\r | |
378 | }\r | |
54a942b0 | 379 | \r |
13d77ef9 | 380 | int CmdT55xxDetect(const char *Cmd){\r |
54a942b0 | 381 | \r |
1d0ccbe0 | 382 | bool override = false;\r |
383 | //bool pwdmode = false;\r | |
384 | \r | |
385 | uint32_t password = 0; //default to blank Block 7\r | |
386 | bool usepwd = ( strlen(Cmd) > 0); \r | |
387 | if ( usepwd ){\r | |
388 | password = param_get32ex(Cmd, 0, 0, 16);\r | |
389 | if (param_getchar(Cmd, 1) =='o' )\r | |
390 | override = true;\r | |
391 | }\r | |
392 | \r | |
13d77ef9 | 393 | char cmdp = param_getchar(Cmd, 0);\r |
1c8fbeb9 | 394 | if (strlen(Cmd) > 1 || cmdp == 'h' || cmdp == 'H') return usage_t55xx_detect();\r |
13d77ef9 | 395 | \r |
1d0ccbe0 | 396 | if (strlen(Cmd)==0) {\r |
397 | password = param_get32ex(Cmd, 0, 0, 16);\r | |
398 | if (param_getchar(Cmd, 1) =='o' ) override = true;\r | |
399 | }\r | |
13d77ef9 | 400 | \r |
1d0ccbe0 | 401 | if ( !AquireData(T55x7_PAGE0, T55x7_CONFIGURATION_BLOCK, usepwd, password) )\r |
402 | return 0;\r | |
403 | \r | |
13d77ef9 | 404 | if ( !tryDetectModulation() )\r |
405 | PrintAndLog("Could not detect modulation automatically. Try setting it manually with \'lf t55xx config\'");\r | |
406 | \r | |
1d0ccbe0 | 407 | return 1;\r |
54a942b0 | 408 | }\r |
409 | \r | |
13d77ef9 | 410 | // detect configuration?\r |
411 | bool tryDetectModulation(){\r | |
13d77ef9 | 412 | uint8_t hits = 0;\r |
413 | t55xx_conf_block_t tests[15];\r | |
fef74fdc | 414 | int bitRate=0;\r |
322f7eb1 | 415 | uint8_t fc1 = 0, fc2 = 0, clk=0;\r |
416 | save_restoreGB(1);\r | |
13d77ef9 | 417 | if (GetFskClock("", FALSE, FALSE)){ \r |
13d77ef9 | 418 | fskClocks(&fc1, &fc2, &clk, FALSE);\r |
fef74fdc | 419 | if ( FSKrawDemod("0 0", FALSE) && test(DEMOD_FSK, &tests[hits].offset, &bitRate)){\r |
13d77ef9 | 420 | tests[hits].modulation = DEMOD_FSK;\r |
421 | if (fc1==8 && fc2 == 5)\r | |
422 | tests[hits].modulation = DEMOD_FSK1a;\r | |
423 | else if (fc1==10 && fc2 == 8)\r | |
424 | tests[hits].modulation = DEMOD_FSK2;\r | |
fef74fdc | 425 | tests[hits].bitrate = bitRate;\r |
13d77ef9 | 426 | tests[hits].inverted = FALSE;\r |
427 | tests[hits].block0 = PackBits(tests[hits].offset, 32, DemodBuffer);\r | |
428 | ++hits;\r | |
429 | }\r | |
fef74fdc | 430 | if ( FSKrawDemod("0 1", FALSE) && test(DEMOD_FSK, &tests[hits].offset, &bitRate)) {\r |
13d77ef9 | 431 | tests[hits].modulation = DEMOD_FSK;\r |
fef74fdc | 432 | if (fc1 == 8 && fc2 == 5)\r |
13d77ef9 | 433 | tests[hits].modulation = DEMOD_FSK1;\r |
fef74fdc | 434 | else if (fc1 == 10 && fc2 == 8)\r |
13d77ef9 | 435 | tests[hits].modulation = DEMOD_FSK2a;\r |
54a942b0 | 436 | \r |
fef74fdc | 437 | tests[hits].bitrate = bitRate;\r |
13d77ef9 | 438 | tests[hits].inverted = TRUE;\r |
439 | tests[hits].block0 = PackBits(tests[hits].offset, 32, DemodBuffer);\r | |
440 | ++hits;\r | |
441 | }\r | |
442 | } else {\r | |
322f7eb1 | 443 | clk = GetAskClock("", FALSE, FALSE);\r |
444 | if (clk>0) {\r | |
411105e0 | 445 | if ( ASKDemod("0 0 0", FALSE, FALSE, 1) && test(DEMOD_ASK, &tests[hits].offset, &bitRate)) {\r |
322f7eb1 | 446 | tests[hits].modulation = DEMOD_ASK;\r |
447 | tests[hits].bitrate = bitRate;\r | |
448 | tests[hits].inverted = FALSE;\r | |
449 | tests[hits].block0 = PackBits(tests[hits].offset, 32, DemodBuffer);\r | |
450 | ++hits;\r | |
451 | }\r | |
411105e0 | 452 | if ( ASKDemod("0 1 0", FALSE, FALSE, 1) && test(DEMOD_ASK, &tests[hits].offset, &bitRate)) {\r |
322f7eb1 | 453 | tests[hits].modulation = DEMOD_ASK;\r |
454 | tests[hits].bitrate = bitRate;\r | |
455 | tests[hits].inverted = TRUE;\r | |
456 | tests[hits].block0 = PackBits(tests[hits].offset, 32, DemodBuffer);\r | |
457 | ++hits;\r | |
458 | }\r | |
411105e0 | 459 | if ( ASKbiphaseDemod("0 0 0 0", FALSE) && test(DEMOD_BI, &tests[hits].offset, &bitRate) ) {\r |
322f7eb1 | 460 | tests[hits].modulation = DEMOD_BI;\r |
461 | tests[hits].bitrate = bitRate;\r | |
462 | tests[hits].inverted = FALSE;\r | |
463 | tests[hits].block0 = PackBits(tests[hits].offset, 32, DemodBuffer);\r | |
464 | ++hits;\r | |
465 | }\r | |
411105e0 | 466 | if ( ASKbiphaseDemod("0 0 1 0", FALSE) && test(DEMOD_BIa, &tests[hits].offset, &bitRate) ) {\r |
322f7eb1 | 467 | tests[hits].modulation = DEMOD_BIa;\r |
468 | tests[hits].bitrate = bitRate;\r | |
469 | tests[hits].inverted = TRUE;\r | |
470 | tests[hits].block0 = PackBits(tests[hits].offset, 32, DemodBuffer);\r | |
471 | ++hits;\r | |
472 | }\r | |
13d77ef9 | 473 | }\r |
322f7eb1 | 474 | //undo trim from ask\r |
475 | save_restoreGB(0);\r | |
476 | clk = GetNrzClock("", FALSE, FALSE);\r | |
477 | if (clk>0) {\r | |
322f7eb1 | 478 | if ( NRZrawDemod("0 0 1", FALSE) && test(DEMOD_NRZ, &tests[hits].offset, &bitRate)) {\r |
479 | tests[hits].modulation = DEMOD_NRZ;\r | |
480 | tests[hits].bitrate = bitRate;\r | |
481 | tests[hits].inverted = FALSE;\r | |
482 | tests[hits].block0 = PackBits(tests[hits].offset, 32, DemodBuffer);\r | |
483 | ++hits;\r | |
484 | }\r | |
54a942b0 | 485 | \r |
322f7eb1 | 486 | if ( NRZrawDemod("0 1 1", FALSE) && test(DEMOD_NRZ, &tests[hits].offset, &bitRate)) {\r |
487 | tests[hits].modulation = DEMOD_NRZ;\r | |
488 | tests[hits].bitrate = bitRate;\r | |
489 | tests[hits].inverted = TRUE;\r | |
490 | tests[hits].block0 = PackBits(tests[hits].offset, 32, DemodBuffer);\r | |
491 | ++hits;\r | |
492 | }\r | |
13d77ef9 | 493 | }\r |
494 | \r | |
322f7eb1 | 495 | //undo trim from nrz\r |
496 | save_restoreGB(0);\r | |
497 | clk = GetPskClock("", FALSE, FALSE);\r | |
498 | if (clk>0) {\r | |
322f7eb1 | 499 | if ( PSKDemod("0 0 1", FALSE) && test(DEMOD_PSK1, &tests[hits].offset, &bitRate)) {\r |
500 | tests[hits].modulation = DEMOD_PSK1;\r | |
fef74fdc | 501 | tests[hits].bitrate = bitRate;\r |
13d77ef9 | 502 | tests[hits].inverted = FALSE;\r |
503 | tests[hits].block0 = PackBits(tests[hits].offset, 32, DemodBuffer);\r | |
504 | ++hits;\r | |
505 | }\r | |
322f7eb1 | 506 | if ( PSKDemod("0 1 1", FALSE) && test(DEMOD_PSK1, &tests[hits].offset, &bitRate)) {\r |
507 | tests[hits].modulation = DEMOD_PSK1;\r | |
fef74fdc | 508 | tests[hits].bitrate = bitRate;\r |
322f7eb1 | 509 | tests[hits].inverted = TRUE;\r |
13d77ef9 | 510 | tests[hits].block0 = PackBits(tests[hits].offset, 32, DemodBuffer);\r |
511 | ++hits;\r | |
512 | }\r | |
322f7eb1 | 513 | // PSK2 - needs a call to psk1TOpsk2.\r |
514 | if ( PSKDemod("0 0 1", FALSE)) {\r | |
515 | psk1TOpsk2(DemodBuffer, DemodBufferLen);\r | |
516 | if (test(DEMOD_PSK2, &tests[hits].offset, &bitRate)){\r | |
517 | tests[hits].modulation = DEMOD_PSK2;\r | |
518 | tests[hits].bitrate = bitRate;\r | |
519 | tests[hits].inverted = FALSE;\r | |
520 | tests[hits].block0 = PackBits(tests[hits].offset, 32, DemodBuffer);\r | |
521 | ++hits;\r | |
522 | }\r | |
523 | } // inverse waves does not affect this demod\r | |
524 | // PSK3 - needs a call to psk1TOpsk2.\r | |
525 | if ( PSKDemod("0 0 1", FALSE)) {\r | |
526 | psk1TOpsk2(DemodBuffer, DemodBufferLen);\r | |
527 | if (test(DEMOD_PSK3, &tests[hits].offset, &bitRate)){\r | |
528 | tests[hits].modulation = DEMOD_PSK3;\r | |
529 | tests[hits].bitrate = bitRate;\r | |
530 | tests[hits].inverted = FALSE;\r | |
531 | tests[hits].block0 = PackBits(tests[hits].offset, 32, DemodBuffer);\r | |
532 | ++hits;\r | |
533 | }\r | |
534 | } // inverse waves does not affect this demod\r | |
13d77ef9 | 535 | }\r |
536 | } \r | |
537 | if ( hits == 1) {\r | |
538 | config.modulation = tests[0].modulation;\r | |
fef74fdc | 539 | config.bitrate = tests[0].bitrate;\r |
13d77ef9 | 540 | config.inverted = tests[0].inverted;\r |
541 | config.offset = tests[0].offset;\r | |
542 | config.block0 = tests[0].block0;\r | |
543 | printConfiguration( config );\r | |
544 | return TRUE;\r | |
545 | }\r | |
546 | \r | |
547 | if ( hits > 1) {\r | |
548 | PrintAndLog("Found [%d] possible matches for modulation.",hits);\r | |
549 | for(int i=0; i<hits; ++i){\r | |
550 | PrintAndLog("--[%d]---------------", i+1);\r | |
551 | printConfiguration( tests[i] );\r | |
552 | }\r | |
553 | }\r | |
554 | return FALSE;\r | |
555 | }\r | |
556 | \r | |
557 | bool testModulation(uint8_t mode, uint8_t modread){\r | |
558 | switch( mode ){\r | |
559 | case DEMOD_FSK:\r | |
94422fa2 | 560 | if (modread >= DEMOD_FSK1 && modread <= DEMOD_FSK2a) return TRUE;\r |
13d77ef9 | 561 | break;\r |
562 | case DEMOD_ASK:\r | |
563 | if (modread == DEMOD_ASK) return TRUE;\r | |
564 | break;\r | |
565 | case DEMOD_PSK1:\r | |
566 | if (modread == DEMOD_PSK1) return TRUE;\r | |
567 | break;\r | |
568 | case DEMOD_PSK2:\r | |
569 | if (modread == DEMOD_PSK2) return TRUE;\r | |
570 | break;\r | |
571 | case DEMOD_PSK3:\r | |
572 | if (modread == DEMOD_PSK3) return TRUE;\r | |
573 | break;\r | |
574 | case DEMOD_NRZ:\r | |
575 | if (modread == DEMOD_NRZ) return TRUE;\r | |
576 | break;\r | |
577 | case DEMOD_BI:\r | |
578 | if (modread == DEMOD_BI) return TRUE;\r | |
579 | break;\r | |
580 | case DEMOD_BIa:\r | |
581 | if (modread == DEMOD_BIa) return TRUE;\r | |
582 | break; \r | |
583 | default:\r | |
584 | return FALSE;\r | |
585 | }\r | |
586 | return FALSE;\r | |
587 | }\r | |
588 | \r | |
589 | bool testBitRate(uint8_t readRate, uint8_t mod){\r | |
590 | uint8_t expected[8] = {8, 16, 32, 40, 50, 64, 100, 128};\r | |
591 | uint8_t detRate = 0;\r | |
592 | switch( mod ){\r | |
593 | case DEMOD_FSK:\r | |
13d77ef9 | 594 | case DEMOD_FSK1:\r |
13d77ef9 | 595 | case DEMOD_FSK1a:\r |
13d77ef9 | 596 | case DEMOD_FSK2:\r |
13d77ef9 | 597 | case DEMOD_FSK2a:\r |
598 | detRate = GetFskClock("",FALSE, FALSE); \r | |
fef74fdc | 599 | if (expected[readRate] == detRate) \r |
13d77ef9 | 600 | return TRUE;\r |
13d77ef9 | 601 | break;\r |
602 | case DEMOD_ASK:\r | |
2767fc02 | 603 | case DEMOD_BI:\r |
604 | case DEMOD_BIa:\r | |
13d77ef9 | 605 | detRate = GetAskClock("",FALSE, FALSE); \r |
fef74fdc | 606 | if (expected[readRate] == detRate) \r |
13d77ef9 | 607 | return TRUE;\r |
13d77ef9 | 608 | break;\r |
609 | case DEMOD_PSK1:\r | |
13d77ef9 | 610 | case DEMOD_PSK2:\r |
13d77ef9 | 611 | case DEMOD_PSK3:\r |
612 | detRate = GetPskClock("",FALSE, FALSE); \r | |
fef74fdc | 613 | if (expected[readRate] == detRate)\r |
13d77ef9 | 614 | return TRUE;\r |
13d77ef9 | 615 | break;\r |
616 | case DEMOD_NRZ:\r | |
617 | detRate = GetNrzClock("",FALSE, FALSE); \r | |
fef74fdc | 618 | if (expected[readRate] == detRate)\r |
13d77ef9 | 619 | return TRUE;\r |
13d77ef9 | 620 | break;\r |
13d77ef9 | 621 | default:\r |
622 | return FALSE;\r | |
623 | }\r | |
624 | return FALSE;\r | |
625 | }\r | |
626 | \r | |
fef74fdc | 627 | bool test(uint8_t mode, uint8_t *offset, int *fndBitRate){\r |
13d77ef9 | 628 | \r |
fef74fdc | 629 | if ( DemodBufferLen < 64 ) return FALSE;\r |
13d77ef9 | 630 | uint8_t si = 0;\r |
631 | for (uint8_t idx = 0; idx < 64; idx++){\r | |
632 | si = idx;\r | |
633 | if ( PackBits(si, 32, DemodBuffer) == 0x00 ) continue;\r | |
634 | \r | |
2767fc02 | 635 | uint8_t safer = PackBits(si, 4, DemodBuffer); si += 4; //master key\r |
13d77ef9 | 636 | uint8_t resv = PackBits(si, 4, DemodBuffer); si += 4; //was 7 & +=7+3 //should be only 4 bits if extended mode\r |
637 | // 2nibble must be zeroed.\r | |
638 | // moved test to here, since this gets most faults first.\r | |
639 | if ( resv > 0x00) continue;\r | |
640 | \r | |
2767fc02 | 641 | uint8_t xtRate = PackBits(si, 3, DemodBuffer); si += 3; //extended mode part of rate\r |
fef74fdc | 642 | int bitRate = PackBits(si, 3, DemodBuffer); si += 3; //bit rate\r |
643 | if (bitRate > 7) continue;\r | |
13d77ef9 | 644 | uint8_t extend = PackBits(si, 1, DemodBuffer); si += 1; //bit 15 extended mode\r |
2767fc02 | 645 | uint8_t modread = PackBits(si, 5, DemodBuffer); si += 5+2+1; \r |
646 | //uint8_t pskcr = PackBits(si, 2, DemodBuffer); si += 2+1; //could check psk cr\r | |
647 | uint8_t nml01 = PackBits(si, 1, DemodBuffer); si += 1+5; //bit 24, 30, 31 could be tested for 0 if not extended mode\r | |
13d77ef9 | 648 | uint8_t nml02 = PackBits(si, 2, DemodBuffer); si += 2;\r |
649 | \r | |
650 | //if extended mode\r | |
651 | bool extMode =( (safer == 0x6 || safer == 0x9) && extend) ? TRUE : FALSE;\r | |
652 | \r | |
653 | if (!extMode){\r | |
654 | if (nml01 || nml02 || xtRate) continue;\r | |
655 | }\r | |
656 | //test modulation\r | |
657 | if (!testModulation(mode, modread)) continue;\r | |
13d77ef9 | 658 | if (!testBitRate(bitRate, mode)) continue;\r |
fef74fdc | 659 | *fndBitRate = bitRate;\r |
2767fc02 | 660 | *offset = idx;\r |
13d77ef9 | 661 | return TRUE;\r |
662 | }\r | |
663 | return FALSE;\r | |
54a942b0 | 664 | }\r |
665 | \r | |
224ce36e | 666 | void printT55xxBlock(const char *blockNum){\r |
13d77ef9 | 667 | \r |
668 | uint8_t i = config.offset;\r | |
669 | uint8_t endpos = 32 + i;\r | |
670 | uint32_t blockData = 0;\r | |
671 | uint8_t bits[64] = {0x00};\r | |
672 | \r | |
673 | if ( !DemodBufferLen) return;\r | |
674 | \r | |
675 | if ( endpos > DemodBufferLen){\r | |
676 | PrintAndLog("The configured offset %d is too big. Possible offset: %d)", i, DemodBufferLen-32);\r | |
677 | return;\r | |
678 | }\r | |
679 | \r | |
680 | for (; i < endpos; ++i)\r | |
1c8fbeb9 | 681 | bits[i - config.offset] = DemodBuffer[i];\r |
13d77ef9 | 682 | \r |
683 | blockData = PackBits(0, 32, bits);\r | |
1c8fbeb9 | 684 | PrintAndLog("%s | %08X | %s", blockNum, blockData, sprint_bin(bits,32));\r |
13d77ef9 | 685 | }\r |
686 | \r | |
687 | int special(const char *Cmd) {\r | |
688 | uint32_t blockData = 0;\r | |
689 | uint8_t bits[32] = {0x00};\r | |
690 | \r | |
1c8fbeb9 | 691 | PrintAndLog("OFFSET | DATA | BINARY");\r |
13d77ef9 | 692 | PrintAndLog("----------------------------------------------------");\r |
693 | int i,j = 0;\r | |
694 | for (; j < 64; ++j){\r | |
695 | \r | |
696 | for (i = 0; i < 32; ++i)\r | |
697 | bits[i]=DemodBuffer[j+i];\r | |
698 | \r | |
699 | blockData = PackBits(0, 32, bits);\r | |
700 | \r | |
1c8fbeb9 | 701 | PrintAndLog("%02d | 0x%08X | %s",j , blockData, sprint_bin(bits,32)); \r |
13d77ef9 | 702 | }\r |
703 | return 0;\r | |
704 | }\r | |
705 | \r | |
1c8fbeb9 | 706 | int printConfiguration( t55xx_conf_block_t b){\r |
13d77ef9 | 707 | PrintAndLog("Modulation : %s", GetSelectedModulationStr(b.modulation) );\r |
708 | PrintAndLog("Bit Rate : %s", GetBitRateStr(b.bitrate) );\r | |
709 | PrintAndLog("Inverted : %s", (b.inverted) ? "Yes" : "No" );\r | |
710 | PrintAndLog("Offset : %d", b.offset);\r | |
711 | PrintAndLog("Block0 : 0x%08X", b.block0);\r | |
712 | PrintAndLog("");\r | |
1c8fbeb9 | 713 | return 0;\r |
13d77ef9 | 714 | }\r |
715 | \r | |
1d0ccbe0 | 716 | int CmdT55xxWakeUp(const char *Cmd) {\r |
717 | uint32_t password = 0;\r | |
718 | uint8_t cmdp = 0;\r | |
719 | bool errors = false;\r | |
720 | while(param_getchar(Cmd, cmdp) != 0x00 && !errors) {\r | |
721 | switch(param_getchar(Cmd, cmdp)) {\r | |
722 | case 'h':\r | |
723 | case 'H':\r | |
724 | return usage_t55xx_wakup();\r | |
725 | case 'p':\r | |
726 | case 'P':\r | |
727 | password = param_get32ex(Cmd, cmdp+1, 0, 16);\r | |
728 | cmdp += 2;\r | |
729 | errors = false;\r | |
730 | break;\r | |
731 | default:\r | |
732 | PrintAndLog("Unknown parameter '%c'", param_getchar(Cmd, cmdp));\r | |
733 | errors = true;\r | |
734 | break;\r | |
735 | }\r | |
736 | }\r | |
737 | if (errors) return usage_t55xx_wakup();\r | |
738 | \r | |
739 | UsbCommand c = {CMD_T55XX_WAKEUP, {password, 0, 0}};\r | |
740 | clearCommandBuffer();\r | |
741 | SendCommand(&c);\r | |
742 | PrintAndLog("Wake up command sent. Try read now");\r | |
743 | return 0;\r | |
744 | }\r | |
745 | \r | |
1c8fbeb9 | 746 | int CmdT55xxWriteBlock(const char *Cmd) {\r |
1d0ccbe0 | 747 | uint8_t block = 0xFF; //default to invalid block\r |
748 | uint32_t data = 0; //default to blank Block \r | |
749 | uint32_t password = 0; //default to blank Block 7\r | |
750 | bool usepwd = false;\r | |
751 | bool page1 = false; \r | |
752 | bool gotdata = false;\r | |
753 | bool errors = false;\r | |
754 | uint8_t cmdp = 0;\r | |
755 | while(param_getchar(Cmd, cmdp) != 0x00 && !errors) {\r | |
756 | switch(param_getchar(Cmd, cmdp)) {\r | |
757 | case 'h':\r | |
758 | case 'H':\r | |
759 | return usage_t55xx_write();\r | |
760 | case 'b':\r | |
761 | case 'B':\r | |
762 | errors |= param_getdec(Cmd, cmdp+1, &block);\r | |
763 | cmdp += 2;\r | |
764 | break;\r | |
765 | case 'd':\r | |
766 | case 'D':\r | |
767 | data = param_get32ex(Cmd, cmdp+1, 0, 16);\r | |
768 | gotdata = true;\r | |
769 | cmdp += 2;\r | |
770 | break;\r | |
771 | case 'p':\r | |
772 | case 'P':\r | |
773 | password = param_get32ex(Cmd, cmdp+1, 0, 16);\r | |
774 | usepwd = true;\r | |
775 | cmdp += 2;\r | |
776 | break;\r | |
777 | case '1':\r | |
778 | page1 = true;\r | |
779 | cmdp++;\r | |
780 | break;\r | |
781 | default:\r | |
782 | PrintAndLog("Unknown parameter '%c'", param_getchar(Cmd, cmdp));\r | |
783 | errors = true;\r | |
784 | break;\r | |
785 | }\r | |
13d77ef9 | 786 | }\r |
1d0ccbe0 | 787 | if (errors || !gotdata) return usage_t55xx_write();\r |
13d77ef9 | 788 | \r |
789 | if (block > 7) {\r | |
790 | PrintAndLog("Block number must be between 0 and 7");\r | |
1d0ccbe0 | 791 | return 0;\r |
13d77ef9 | 792 | }\r |
793 | \r | |
794 | UsbCommand c = {CMD_T55XX_WRITE_BLOCK, {data, block, 0}};\r | |
a739812e | 795 | UsbCommand resp;\r |
1d0ccbe0 | 796 | c.d.asBytes[0] = (page1) ? 0x2 : 0; \r |
13d77ef9 | 797 | \r |
1d0ccbe0 | 798 | PrintAndLog("Writing to page: %d block: %d data : 0x%08X", page1, block, data);\r |
13d77ef9 | 799 | \r |
800 | //Password mode\r | |
1d0ccbe0 | 801 | if (usepwd) {\r |
13d77ef9 | 802 | c.arg[2] = password;\r |
1d0ccbe0 | 803 | c.d.asBytes[0] |= 0x1; \r |
13d77ef9 | 804 | PrintAndLog("pwd : 0x%08X", password);\r |
805 | }\r | |
db25599d | 806 | clearCommandBuffer();\r |
13d77ef9 | 807 | SendCommand(&c);\r |
db25599d | 808 | if (!WaitForResponseTimeout(CMD_ACK, &resp, 1000)){\r |
809 | PrintAndLog("Error occurred, device did not ACK write operation. (May be due to old firmware)");\r | |
13d77ef9 | 810 | return 0;\r |
1d0ccbe0 | 811 | }\r |
812 | return 1;\r | |
54a942b0 | 813 | }\r |
814 | \r | |
1c8fbeb9 | 815 | int CmdT55xxReadTrace(const char *Cmd) {\r |
13d77ef9 | 816 | char cmdp = param_getchar(Cmd, 0);\r |
1d0ccbe0 | 817 | bool pwdmode = false;\r |
818 | uint32_t password = 0; \r | |
1c8fbeb9 | 819 | if (strlen(Cmd) > 1 || cmdp == 'h' || cmdp == 'H') return usage_t55xx_trace();\r |
13d77ef9 | 820 | \r |
821 | if (strlen(Cmd)==0)\r | |
1d0ccbe0 | 822 | if ( !AquireData( T55x7_PAGE1, REGULAR_READ_MODE_BLOCK, pwdmode, password ) )\r |
823 | return 0;\r | |
13d77ef9 | 824 | \r |
1d0ccbe0 | 825 | if (!DecodeT55xxBlock()) return 0;\r |
54a942b0 | 826 | \r |
1d0ccbe0 | 827 | if ( !DemodBufferLen) return 0;\r |
13d77ef9 | 828 | \r |
829 | RepaintGraphWindow();\r | |
830 | uint8_t repeat = 0;\r | |
831 | if (config.offset > 5) \r | |
832 | repeat = 32;\r | |
833 | uint8_t si = config.offset+repeat;\r | |
1d0ccbe0 | 834 | uint32_t bl1 = PackBits(si, 32, DemodBuffer);\r |
835 | uint32_t bl2 = PackBits(si+32, 32, DemodBuffer);\r | |
13d77ef9 | 836 | \r |
224ce36e | 837 | uint32_t acl = PackBits(si, 8, DemodBuffer); si += 8;\r |
838 | uint32_t mfc = PackBits(si, 8, DemodBuffer); si += 8;\r | |
839 | uint32_t cid = PackBits(si, 5, DemodBuffer); si += 5;\r | |
840 | uint32_t icr = PackBits(si, 3, DemodBuffer); si += 3;\r | |
841 | uint32_t year = PackBits(si, 4, DemodBuffer); si += 4;\r | |
842 | uint32_t quarter = PackBits(si, 2, DemodBuffer); si += 2;\r | |
843 | uint32_t lotid = PackBits(si, 14, DemodBuffer); si += 14;\r | |
844 | uint32_t wafer = PackBits(si, 5, DemodBuffer); si += 5;\r | |
13d77ef9 | 845 | uint32_t dw = PackBits(si, 15, DemodBuffer); \r |
846 | \r | |
224ce36e | 847 | time_t t = time(NULL);\r |
848 | struct tm tm = *localtime(&t);\r | |
849 | if ( year > tm.tm_year-110)\r | |
850 | year += 2000;\r | |
851 | else\r | |
852 | year += 2010;\r | |
853 | \r | |
854 | if ( acl != 0xE0 ) {\r | |
855 | PrintAndLog("The modulation is most likely wrong since the ACL is not 0xE0. ");\r | |
1d0ccbe0 | 856 | return 0;\r |
224ce36e | 857 | }\r |
858 | \r | |
13d77ef9 | 859 | PrintAndLog("");\r |
860 | PrintAndLog("-- T55xx Trace Information ----------------------------------");\r | |
861 | PrintAndLog("-------------------------------------------------------------");\r | |
862 | PrintAndLog(" ACL Allocation class (ISO/IEC 15963-1) : 0x%02X (%d)", acl, acl);\r | |
863 | PrintAndLog(" MFC Manufacturer ID (ISO/IEC 7816-6) : 0x%02X (%d) - %s", mfc, mfc, getTagInfo(mfc));\r | |
864 | PrintAndLog(" CID : 0x%02X (%d) - %s", cid, cid, GetModelStrFromCID(cid));\r | |
865 | PrintAndLog(" ICR IC Revision : %d",icr );\r | |
866 | PrintAndLog(" Manufactured");\r | |
cc15a118 | 867 | PrintAndLog(" Year/Quarter : %d/%d",year, quarter);\r |
13d77ef9 | 868 | PrintAndLog(" Lot ID : %d", lotid );\r |
869 | PrintAndLog(" Wafer number : %d", wafer);\r | |
870 | PrintAndLog(" Die Number : %d", dw);\r | |
871 | PrintAndLog("-------------------------------------------------------------");\r | |
872 | PrintAndLog(" Raw Data - Page 1");\r | |
1d0ccbe0 | 873 | PrintAndLog(" Block 1 : 0x%08X %s", bl1, sprint_bin(DemodBuffer+config.offset+repeat,32) );\r |
874 | PrintAndLog(" Block 2 : 0x%08X %s", bl2, sprint_bin(DemodBuffer+config.offset+repeat+32,32) );\r | |
13d77ef9 | 875 | PrintAndLog("-------------------------------------------------------------");\r |
54a942b0 | 876 | \r |
13d77ef9 | 877 | /*\r |
878 | TRACE - BLOCK O\r | |
879 | Bits Definition HEX\r | |
880 | 1-8 ACL Allocation class (ISO/IEC 15963-1) 0xE0 \r | |
881 | 9-16 MFC Manufacturer ID (ISO/IEC 7816-6) 0x15 Atmel Corporation\r | |
882 | 17-21 CID 0x1 = Atmel ATA5577M1 0x2 = Atmel ATA5577M2 \r | |
883 | 22-24 ICR IC revision\r | |
884 | 25-28 YEAR (BCD encoded) 9 (= 2009)\r | |
885 | 29-30 QUARTER 1,2,3,4 \r | |
886 | 31-32 LOT ID\r | |
887 | \r | |
888 | TRACE - BLOCK 1\r | |
889 | 1-12 LOT ID \r | |
890 | 13-17 Wafer number\r | |
891 | 18-32 DW, die number sequential\r | |
892 | */\r | |
893 | \r | |
54a942b0 | 894 | return 0;\r |
895 | }\r | |
896 | \r | |
13d77ef9 | 897 | int CmdT55xxInfo(const char *Cmd){\r |
898 | /*\r | |
899 | Page 0 Block 0 Configuration data.\r | |
900 | Normal mode\r | |
901 | Extended mode\r | |
902 | */\r | |
1d0ccbe0 | 903 | bool pwdmode = false;\r |
904 | uint32_t password = 0;\r | |
13d77ef9 | 905 | char cmdp = param_getchar(Cmd, 0);\r |
906 | \r | |
1c8fbeb9 | 907 | if (strlen(Cmd) > 1 || cmdp == 'h' || cmdp == 'H') return usage_t55xx_info();\r |
13d77ef9 | 908 | \r |
909 | if (strlen(Cmd)==0)\r | |
1d0ccbe0 | 910 | if ( !AquireData( T55x7_PAGE0, T55x7_CONFIGURATION_BLOCK, pwdmode, password ) )\r |
911 | return 1;\r | |
fef74fdc | 912 | \r |
13d77ef9 | 913 | if (!DecodeT55xxBlock()) return 1;\r |
914 | \r | |
fef74fdc | 915 | if ( DemodBufferLen < 32) return 1;\r |
13d77ef9 | 916 | \r |
917 | uint8_t si = config.offset;\r | |
918 | uint32_t bl0 = PackBits(si, 32, DemodBuffer);\r | |
919 | \r | |
920 | uint32_t safer = PackBits(si, 4, DemodBuffer); si += 4; \r | |
921 | uint32_t resv = PackBits(si, 7, DemodBuffer); si += 7;\r | |
922 | uint32_t dbr = PackBits(si, 3, DemodBuffer); si += 3;\r | |
923 | uint32_t extend = PackBits(si, 1, DemodBuffer); si += 1;\r | |
924 | uint32_t datamod = PackBits(si, 5, DemodBuffer); si += 5;\r | |
925 | uint32_t pskcf = PackBits(si, 2, DemodBuffer); si += 2;\r | |
926 | uint32_t aor = PackBits(si, 1, DemodBuffer); si += 1; \r | |
927 | uint32_t otp = PackBits(si, 1, DemodBuffer); si += 1; \r | |
928 | uint32_t maxblk = PackBits(si, 3, DemodBuffer); si += 3;\r | |
929 | uint32_t pwd = PackBits(si, 1, DemodBuffer); si += 1; \r | |
930 | uint32_t sst = PackBits(si, 1, DemodBuffer); si += 1; \r | |
931 | uint32_t fw = PackBits(si, 1, DemodBuffer); si += 1;\r | |
932 | uint32_t inv = PackBits(si, 1, DemodBuffer); si += 1; \r | |
933 | uint32_t por = PackBits(si, 1, DemodBuffer); si += 1;\r | |
934 | \r | |
935 | PrintAndLog("");\r | |
936 | PrintAndLog("-- T55xx Configuration & Tag Information --------------------");\r | |
937 | PrintAndLog("-------------------------------------------------------------");\r | |
938 | PrintAndLog(" Safer key : %s", GetSaferStr(safer));\r | |
939 | PrintAndLog(" reserved : %d", resv);\r | |
940 | PrintAndLog(" Data bit rate : %s", GetBitRateStr(dbr));\r | |
941 | PrintAndLog(" eXtended mode : %s", (extend) ? "Yes - Warning":"No");\r | |
942 | PrintAndLog(" Modulation : %s", GetModulationStr(datamod));\r | |
943 | PrintAndLog(" PSK clock frequency : %d", pskcf);\r | |
944 | PrintAndLog(" AOR - Answer on Request : %s", (aor) ? "Yes":"No");\r | |
945 | PrintAndLog(" OTP - One Time Pad : %s", (otp) ? "Yes - Warning":"No" );\r | |
946 | PrintAndLog(" Max block : %d", maxblk);\r | |
947 | PrintAndLog(" Password mode : %s", (pwd) ? "Yes":"No");\r | |
948 | PrintAndLog(" Sequence Start Terminator : %s", (sst) ? "Yes":"No");\r | |
949 | PrintAndLog(" Fast Write : %s", (fw) ? "Yes":"No");\r | |
950 | PrintAndLog(" Inverse data : %s", (inv) ? "Yes":"No");\r | |
951 | PrintAndLog(" POR-Delay : %s", (por) ? "Yes":"No");\r | |
952 | PrintAndLog("-------------------------------------------------------------");\r | |
953 | PrintAndLog(" Raw Data - Page 0");\r | |
954 | PrintAndLog(" Block 0 : 0x%08X %s", bl0, sprint_bin(DemodBuffer+config.offset,32) );\r | |
955 | PrintAndLog("-------------------------------------------------------------");\r | |
956 | \r | |
957 | return 0;\r | |
958 | }\r | |
959 | \r | |
960 | int CmdT55xxDump(const char *Cmd){\r | |
961 | \r | |
1d0ccbe0 | 962 | uint32_t password = 0;\r |
963 | bool override = false;\r | |
964 | char cmdp = param_getchar(Cmd, 0); \r | |
1c8fbeb9 | 965 | if ( cmdp == 'h' || cmdp == 'H') return usage_t55xx_dump();\r |
13d77ef9 | 966 | \r |
1d0ccbe0 | 967 | bool usepwd = ( strlen(Cmd) > 0); \r |
968 | if ( usepwd ){\r | |
969 | password = param_get32ex(Cmd, 0, 0, 16);\r | |
970 | if (param_getchar(Cmd, 1) =='o' )\r | |
971 | override = true;\r | |
13d77ef9 | 972 | }\r |
973 | \r | |
1d0ccbe0 | 974 | PrintAndLog("Reading Page 0:"); \r |
975 | PrintAndLog("blk | hex data | binary");\r | |
976 | for ( uint8_t i = 0; i < 8; ++i){\r | |
977 | T55xxReadBlock(i, 0, usepwd, override, password);\r | |
13d77ef9 | 978 | }\r |
1d0ccbe0 | 979 | PrintAndLog("Reading Page 1:"); \r |
980 | PrintAndLog("blk | hex data | binary");\r | |
981 | for ( uint8_t i = 0; i < 4; i++){\r | |
982 | T55xxReadBlock(i, 1, usepwd, override, password); \r | |
983 | }\r | |
984 | return 1;\r | |
13d77ef9 | 985 | }\r |
986 | \r | |
1d0ccbe0 | 987 | int AquireData( uint8_t page, uint8_t block, bool pwdmode, uint32_t password ){\r |
988 | // arg0 bitmodes:\r | |
989 | // bit0 = pwdmode\r | |
990 | // bit1 = page to read from\r | |
991 | uint8_t arg0 = (page<<1) | pwdmode;\r | |
992 | UsbCommand c = {CMD_T55XX_READ_BLOCK, {arg0, block, password}};\r | |
1c8fbeb9 | 993 | \r |
db25599d | 994 | clearCommandBuffer();\r |
13d77ef9 | 995 | SendCommand(&c);\r |
996 | if ( !WaitForResponseTimeout(CMD_ACK,NULL,2500) ) {\r | |
997 | PrintAndLog("command execution time out");\r | |
1d0ccbe0 | 998 | return 0;\r |
13d77ef9 | 999 | }\r |
1000 | \r | |
1001 | uint8_t got[12000];\r | |
1002 | GetFromBigBuf(got,sizeof(got),0);\r | |
1003 | WaitForResponse(CMD_ACK,NULL);\r | |
1d0ccbe0 | 1004 | setGraphBuf(got, sizeof(got));\r |
1005 | return 1;\r | |
13d77ef9 | 1006 | }\r |
1007 | \r | |
1008 | char * GetBitRateStr(uint32_t id){\r | |
fef74fdc | 1009 | static char buf[25];\r |
1010 | \r | |
13d77ef9 | 1011 | char *retStr = buf;\r |
1012 | switch (id){\r | |
1013 | case 0: \r | |
9795e535 | 1014 | snprintf(retStr,sizeof(buf),"%d - RF/8",id);\r |
13d77ef9 | 1015 | break;\r |
1016 | case 1:\r | |
9795e535 | 1017 | snprintf(retStr,sizeof(buf),"%d - RF/16",id);\r |
13d77ef9 | 1018 | break;\r |
1019 | case 2: \r | |
9795e535 | 1020 | snprintf(retStr,sizeof(buf),"%d - RF/32",id);\r |
13d77ef9 | 1021 | break;\r |
1022 | case 3:\r | |
9795e535 | 1023 | snprintf(retStr,sizeof(buf),"%d - RF/40",id);\r |
13d77ef9 | 1024 | break;\r |
1025 | case 4:\r | |
9795e535 | 1026 | snprintf(retStr,sizeof(buf),"%d - RF/50",id);\r |
13d77ef9 | 1027 | break;\r |
1028 | case 5:\r | |
9795e535 | 1029 | snprintf(retStr,sizeof(buf),"%d - RF/64",id);\r |
13d77ef9 | 1030 | break;\r |
1031 | case 6:\r | |
9795e535 | 1032 | snprintf(retStr,sizeof(buf),"%d - RF/100",id);\r |
13d77ef9 | 1033 | break;\r |
1034 | case 7:\r | |
9795e535 | 1035 | snprintf(retStr,sizeof(buf),"%d - RF/128",id);\r |
13d77ef9 | 1036 | break;\r |
1037 | default:\r | |
9795e535 | 1038 | snprintf(retStr,sizeof(buf),"%d - (Unknown)",id);\r |
13d77ef9 | 1039 | break;\r |
1040 | }\r | |
1041 | \r | |
1042 | return buf;\r | |
1043 | }\r | |
1044 | \r | |
1045 | char * GetSaferStr(uint32_t id){\r | |
1046 | static char buf[40];\r | |
1047 | char *retStr = buf;\r | |
1048 | \r | |
9795e535 | 1049 | snprintf(retStr,sizeof(buf),"%d",id);\r |
13d77ef9 | 1050 | if (id == 6) {\r |
9795e535 | 1051 | snprintf(retStr,sizeof(buf),"%d - passwd",id);\r |
13d77ef9 | 1052 | }\r |
1053 | if (id == 9 ){\r | |
9795e535 | 1054 | snprintf(retStr,sizeof(buf),"%d - testmode",id);\r |
13d77ef9 | 1055 | }\r |
1056 | \r | |
1057 | return buf;\r | |
1058 | }\r | |
9795e535 | 1059 | \r |
13d77ef9 | 1060 | char * GetModulationStr( uint32_t id){\r |
2767fc02 | 1061 | static char buf[60];\r |
13d77ef9 | 1062 | char *retStr = buf;\r |
1063 | \r | |
1064 | switch (id){\r | |
1065 | case 0: \r | |
9795e535 | 1066 | snprintf(retStr,sizeof(buf),"%d - DIRECT (ASK/NRZ)",id);\r |
13d77ef9 | 1067 | break;\r |
1068 | case 1:\r | |
9795e535 | 1069 | snprintf(retStr,sizeof(buf),"%d - PSK 1 phase change when input changes",id);\r |
13d77ef9 | 1070 | break;\r |
1071 | case 2: \r | |
9795e535 | 1072 | snprintf(retStr,sizeof(buf),"%d - PSK 2 phase change on bitclk if input high",id);\r |
13d77ef9 | 1073 | break;\r |
1074 | case 3:\r | |
9795e535 | 1075 | snprintf(retStr,sizeof(buf),"%d - PSK 3 phase change on rising edge of input",id);\r |
13d77ef9 | 1076 | break;\r |
1077 | case 4:\r | |
9795e535 | 1078 | snprintf(retStr,sizeof(buf),"%d - FSK 1 RF/8 RF/5",id);\r |
13d77ef9 | 1079 | break;\r |
1080 | case 5:\r | |
9795e535 | 1081 | snprintf(retStr,sizeof(buf),"%d - FSK 2 RF/8 RF/10",id);\r |
13d77ef9 | 1082 | break;\r |
1083 | case 6:\r | |
9795e535 | 1084 | snprintf(retStr,sizeof(buf),"%d - FSK 1a RF/5 RF/8",id);\r |
13d77ef9 | 1085 | break;\r |
1086 | case 7:\r | |
9795e535 | 1087 | snprintf(retStr,sizeof(buf),"%d - FSK 2a RF/10 RF/8",id);\r |
13d77ef9 | 1088 | break;\r |
1089 | case 8:\r | |
cc15a118 | 1090 | snprintf(retStr,sizeof(buf),"%d - Manchester",id);\r |
13d77ef9 | 1091 | break;\r |
1092 | case 16:\r | |
9795e535 | 1093 | snprintf(retStr,sizeof(buf),"%d - Biphase",id);\r |
13d77ef9 | 1094 | break;\r |
1095 | case 0x18:\r | |
9795e535 | 1096 | snprintf(retStr,sizeof(buf),"%d - Biphase a - AKA Conditional Dephase Encoding(CDP)",id);\r |
13d77ef9 | 1097 | break;\r |
1098 | case 17:\r | |
9795e535 | 1099 | snprintf(retStr,sizeof(buf),"%d - Reserved",id);\r |
13d77ef9 | 1100 | break;\r |
1101 | default:\r | |
9795e535 | 1102 | snprintf(retStr,sizeof(buf),"0x%02X (Unknown)",id);\r |
13d77ef9 | 1103 | break;\r |
1104 | }\r | |
1105 | return buf;\r | |
1106 | }\r | |
1107 | \r | |
1108 | char * GetModelStrFromCID(uint32_t cid){\r | |
1109 | \r | |
1110 | static char buf[10];\r | |
1111 | char *retStr = buf;\r | |
1112 | \r | |
224ce36e | 1113 | if (cid == 1) snprintf(retStr, sizeof(buf),"ATA5577M1");\r |
1114 | if (cid == 2) snprintf(retStr, sizeof(buf),"ATA5577M2"); \r | |
13d77ef9 | 1115 | return buf;\r |
1116 | }\r | |
1117 | \r | |
1118 | char * GetSelectedModulationStr( uint8_t id){\r | |
1119 | \r | |
9795e535 | 1120 | static char buf[20];\r |
13d77ef9 | 1121 | char *retStr = buf;\r |
1122 | \r | |
1123 | switch (id){\r | |
1124 | case DEMOD_FSK:\r | |
9795e535 | 1125 | snprintf(retStr,sizeof(buf),"FSK");\r |
13d77ef9 | 1126 | break;\r |
1127 | case DEMOD_FSK1:\r | |
9795e535 | 1128 | snprintf(retStr,sizeof(buf),"FSK1");\r |
13d77ef9 | 1129 | break;\r |
1130 | case DEMOD_FSK1a:\r | |
9795e535 | 1131 | snprintf(retStr,sizeof(buf),"FSK1a");\r |
13d77ef9 | 1132 | break;\r |
1133 | case DEMOD_FSK2:\r | |
9795e535 | 1134 | snprintf(retStr,sizeof(buf),"FSK2");\r |
13d77ef9 | 1135 | break;\r |
1136 | case DEMOD_FSK2a:\r | |
9795e535 | 1137 | snprintf(retStr,sizeof(buf),"FSK2a");\r |
13d77ef9 | 1138 | break;\r |
1139 | case DEMOD_ASK: \r | |
9795e535 | 1140 | snprintf(retStr,sizeof(buf),"ASK");\r |
13d77ef9 | 1141 | break;\r |
1142 | case DEMOD_NRZ:\r | |
9795e535 | 1143 | snprintf(retStr,sizeof(buf),"DIRECT/NRZ");\r |
13d77ef9 | 1144 | break;\r |
1145 | case DEMOD_PSK1:\r | |
9795e535 | 1146 | snprintf(retStr,sizeof(buf),"PSK1");\r |
13d77ef9 | 1147 | break;\r |
1148 | case DEMOD_PSK2:\r | |
9795e535 | 1149 | snprintf(retStr,sizeof(buf),"PSK2");\r |
13d77ef9 | 1150 | break;\r |
1151 | case DEMOD_PSK3:\r | |
9795e535 | 1152 | snprintf(retStr,sizeof(buf),"PSK3");\r |
13d77ef9 | 1153 | break;\r |
1154 | case DEMOD_BI:\r | |
9795e535 | 1155 | snprintf(retStr,sizeof(buf),"BIPHASE");\r |
13d77ef9 | 1156 | break;\r |
1157 | case DEMOD_BIa:\r | |
9795e535 | 1158 | snprintf(retStr,sizeof(buf),"BIPHASEa - (CDP)");\r |
13d77ef9 | 1159 | break;\r |
1160 | default:\r | |
9795e535 | 1161 | snprintf(retStr,sizeof(buf),"(Unknown)");\r |
13d77ef9 | 1162 | break;\r |
1163 | }\r | |
1164 | return buf;\r | |
1165 | }\r | |
1166 | \r | |
e98572a1 | 1167 | void t55x7_create_config_block( int tagtype ){\r |
1168 | //switch?\r | |
1169 | \r | |
1170 | \r | |
1171 | }\r | |
1172 | \r | |
ad6219fc | 1173 | /*\r |
13d77ef9 | 1174 | uint32_t PackBits(uint8_t start, uint8_t len, uint8_t* bits){\r |
1175 | \r | |
1176 | int i = start;\r | |
1177 | int j = len-1;\r | |
1178 | \r | |
1179 | if (len > 32) return 0;\r | |
1180 | \r | |
1181 | uint32_t tmp = 0;\r | |
1182 | for (; j >= 0; --j, ++i)\r | |
1183 | tmp |= bits[i] << j;\r | |
1184 | \r | |
1185 | return tmp;\r | |
1186 | }\r | |
ad6219fc | 1187 | */\r |
94422fa2 | 1188 | \r |
1189 | int CmdResetRead(const char *Cmd) {\r | |
1190 | UsbCommand c = {CMD_T55XX_RESET_READ, {0,0,0}};\r | |
1191 | \r | |
1192 | clearCommandBuffer();\r | |
1193 | SendCommand(&c);\r | |
1194 | if ( !WaitForResponseTimeout(CMD_ACK,NULL,2500) ) {\r | |
1195 | PrintAndLog("command execution time out");\r | |
1196 | return 0;\r | |
1197 | }\r | |
1198 | \r | |
1199 | uint8_t got[BIGBUF_SIZE-1];\r | |
1200 | GetFromBigBuf(got,sizeof(got),0);\r | |
1201 | WaitForResponse(CMD_ACK,NULL);\r | |
1202 | setGraphBuf(got, sizeof(got));\r | |
1203 | return 1;\r | |
1204 | }\r | |
1205 | \r | |
54a942b0 | 1206 | static command_t CommandTable[] =\r |
1207 | {\r | |
13d77ef9 | 1208 | {"help", CmdHelp, 1, "This help"},\r |
1209 | {"config", CmdT55xxSetConfig, 1, "Set/Get T55XX configuration (modulation, inverted, offset, rate)"},\r | |
1210 | {"detect", CmdT55xxDetect, 0, "[1] Try detecting the tag modulation from reading the configuration block."},\r | |
94422fa2 | 1211 | {"read", CmdT55xxReadBlock, 0, "b <block> p [password] [o] [1] -- Read T55xx block data. Optional [p password], [override], [page1]"},\r |
1212 | {"resetread",CmdResetRead, 0, "Send Reset Cmd then lf read the stream to attempt to identify the start of it (needs a demod and/or plot after)"},\r | |
1213 | {"write", CmdT55xxWriteBlock,0, "b <block> d <data> p [password] [1] -- Write T55xx block data. Optional [p password], [page1]"},\r | |
13d77ef9 | 1214 | {"trace", CmdT55xxReadTrace, 0, "[1] Show T55xx traceability data (page 1/ blk 0-1)"},\r |
1215 | {"info", CmdT55xxInfo, 0, "[1] Show T55xx configuration data (page 0/ blk 0)"},\r | |
94422fa2 | 1216 | {"dump", CmdT55xxDump, 0, "[password] [o] Dump T55xx card block 0-7. Optional [password], [override]"},\r |
13d77ef9 | 1217 | {"special", special, 0, "Show block changes with 64 different offsets"},\r |
9276e859 | 1218 | {"wakeup", CmdT55xxWakeUp, 0, "Send AOR wakeup command"},\r |
54a942b0 | 1219 | {NULL, NULL, 0, NULL}\r |
1220 | };\r | |
1221 | \r | |
1222 | int CmdLFT55XX(const char *Cmd)\r | |
1223 | {\r | |
1224 | CmdsParse(CommandTable, Cmd);\r | |
1225 | return 0;\r | |
1226 | }\r | |
1227 | \r | |
1228 | int CmdHelp(const char *Cmd)\r | |
1229 | {\r | |
1230 | CmdsHelp(CommandTable);\r | |
1231 | return 0;\r | |
1232 | }\r |