renamed 'hf mfdes readdata, writedata' to 'read/write'
[RRG-proxmark3.git] / client / src / cmdhfst.c
blob28af644c4fc45bdc83621c0d1a396a1456a4539f
1 //-----------------------------------------------------------------------------
2 // Copyright (C) 2020 iceman1001
3 //
4 // This code is licensed to you under the terms of the GNU GPL, version 2 or,
5 // at your option, any later version. See the LICENSE.txt file for the text of
6 // the license.
7 //-----------------------------------------------------------------------------
8 // High frequency ISO14443A / ST commands
9 //-----------------------------------------------------------------------------
11 #include "cmdhfst.h"
12 #include <string.h>
13 #include <stdio.h>
15 #define TIMEOUT 2000
17 // get ST Microelectronics chip model (from UID)
18 char *get_st_chip_model(uint8_t pc) {
19 static char model[40];
20 char *s = model;
21 memset(model, 0, sizeof(model));
22 switch (pc) {
23 case 0x0:
24 sprintf(s, "SRIX4K (Special)");
25 break;
26 case 0x2:
27 sprintf(s, "SR176");
28 break;
29 case 0x3:
30 sprintf(s, "SRIX4K");
31 break;
32 case 0x4:
33 sprintf(s, "SRIX512");
34 break;
35 case 0x6:
36 sprintf(s, "SRI512");
37 break;
38 case 0x7:
39 sprintf(s, "SRI4K");
40 break;
41 case 0xC:
42 sprintf(s, "SRT512");
43 break;
44 case 0xC4:
45 sprintf(s, "ST25TA64K");
46 break;
47 case 0xE2:
48 sprintf(s, "ST25??? IKEA Rothult");
49 break;
50 case 0xE3:
51 sprintf(s, "ST25TA02KB");
52 break;
53 case 0xE4:
54 sprintf(s, "ST25TA512B");
55 break;
56 case 0xA3:
57 sprintf(s, "ST25TA02KB-P");
58 break;
59 case 0xF3:
60 sprintf(s, "ST25TA02KB-D");
61 break;
62 default :
63 sprintf(s, "Unknown");
64 break;
66 return s;
69 // print UID info from SRx chips (ST Microelectronics)
70 void print_st_general_info(uint8_t *data, uint8_t len) {
71 //uid = first 8 bytes in data
72 PrintAndLogEx(NORMAL, "");
73 PrintAndLogEx(SUCCESS, " UID: " _GREEN_("%s"), sprint_hex(SwapEndian64(data, 8, 8), len));
74 PrintAndLogEx(SUCCESS, " MFG: %02X, " _YELLOW_("%s"), data[6], getTagInfo(data[6]));
75 PrintAndLogEx(SUCCESS, "Chip: %02X, " _YELLOW_("%s"), data[5] >> 2, get_st_chip_model(data[5] >> 2));