71 #endif // HAVE_CONFIG_H
86 stop_emulation(
int sig)
97 static uint8_t __nfcforum_tag2_memory_area[] = {
98 0x00, 0x00, 0x00, 0x00,
99 0x00, 0x00, 0x00, 0x00,
100 0x00, 0x00, 0xFF, 0xFF,
101 0xE1, 0x10, 0x06, 0x0F,
103 0x03, 33, 0xd1, 0x02,
104 0x1c, 0x53, 0x70, 0x91,
105 0x01, 0x09, 0x54, 0x02,
106 0x65, 0x6e, 0x4c, 0x69,
108 0x62, 0x6e, 0x66, 0x63,
109 0x51, 0x01, 0x0b, 0x55,
110 0x03, 0x6c, 0x69, 0x62,
111 0x6e, 0x66, 0x63, 0x2e,
113 0x6f, 0x72, 0x67, 0x00,
114 0x00, 0x00, 0x00, 0x00,
115 0x00, 0x00, 0x00, 0x00,
116 0x00, 0x00, 0x00, 0x00,
121 #define SECTOR_SELECT 0xC2
125 nfcforum_tag2_io(
struct nfc_emulator *emulator,
const uint8_t *data_in,
const size_t data_in_len, uint8_t *data_out,
const size_t data_out_len)
129 uint8_t *nfcforum_tag2_memory_area = (uint8_t *)(emulator->user_data);
132 print_hex(data_in, data_in_len);
134 switch (data_in[0]) {
136 if (data_out_len >= 16) {
137 memcpy(data_out, nfcforum_tag2_memory_area + (data_in[1] * 4), 16);
144 printf(
"HALT sent\n");
148 printf(
"Unknown command: 0x%02x\n", data_in[0]);
153 ERR(
"%s (%d)", strerror(-res), -res);
156 print_hex(data_out, res);
163 main(
int argc,
char *argv[])
170 .nmt = NMT_ISO14443A,
171 .nbr = NBR_UNDEFINED,
175 .abtAtqa = { 0x00, 0x04 },
176 .abtUid = { 0x08, 0x00, 0xb0, 0x0b },
185 .io = nfcforum_tag2_io
190 .state_machine = &state_machine,
191 .user_data = __nfcforum_tag2_memory_area,
194 signal(SIGINT, stop_emulation);
197 if (context == NULL) {
198 ERR(
"Unable to init libnfc (malloc)");
204 ERR(
"Unable to open NFC device");
210 printf(
"Emulating NDEF tag now, please touch it with a second NFC device\n");