User Tools

Site Tools


cvend

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
cvend [2026-11-23 00:40 UTC (5 days ago)] – restore new protocol details from rewrite doofcvend [2026-11-23 00:56 UTC (5 days ago)] (current) – fix Ultralight reply header to remove emdash qkb
Line 43: Line 43:
 | 0x97 | <- | PutFileReply | | | 0x97 | <- | PutFileReply | |
 | 0x98 | -> | GetFile | ''%%[u16 pathlen][path][u32 offset][u16 count]%%'' | | 0x98 | -> | GetFile | ''%%[u16 pathlen][path][u32 offset][u16 count]%%'' |
-| 0x99 | <- | GetFileReply | ''%%0x99 [u32 len][data]%%'' |+| 0x99 | <- | GetFileReply | ''%%[u32 len][data]%%'' |
 | 0x9a | -> | DeleteFile | | | 0x9a | -> | DeleteFile | |
 | 0x9b | <- | DeleteFileReply | | | 0x9b | <- | DeleteFileReply | |
 | 0x9c | -> | FileInfo | ''%%[u16 pathlen][path][u32 off][u32 len]%%'' | | 0x9c | -> | FileInfo | ''%%[u16 pathlen][path][u32 off][u32 len]%%'' |
-| 0x9d | <- | FileInfoReply | ''%%0x9D [status:u16][size:u32 BE][crc32:u32 BE]%%'' |+| 0x9d | <- | FileInfoReply | ''%%[status:u16][size:u32 BE][crc32:u32 BE]%%'' |
 | 0xa4 | -> | FileList | ''%%[u16 pathlen][path]%%'' | | 0xa4 | -> | FileList | ''%%[u16 pathlen][path]%%'' |
-| 0xa5 | <- | FileListReply | ''%%0xA5 [u32 len][name\0mtime\0...]%%'' |+| 0xa5 | <- | FileListReply | ''%%[u32 len][name\0mtime\0...]%%'' |
 | 0xaa | -> | SetTime | payload is a timestamp | | 0xaa | -> | SetTime | payload is a timestamp |
 | 0xab | <- | SetTimeReply | | | 0xab | <- | SetTimeReply | |
Line 84: Line 84:
 <- - Reader to Host <- - Reader to Host
  
-===== LEDs ===== +==== 0x20 LEDs ==== 
  
 The ''%%0x20%%'' payload is a big-endian u32. The eight LEDs live in the low byte:  The ''%%0x20%%'' payload is a big-endian u32. The eight LEDs live in the low byte: 
Line 98: Line 98:
 | 0x80 | NFC logo, left |  | 0x80 | NFC logo, left | 
  
-==== 0xD5 UltralightReply — unsolicited card events ====+==== 0xD5 UltralightReply for unsolicited card events ====
  
 ''replyTo'' = 0 for both forms. ''replyTo'' = 0 for both forms.
Line 127: Line 127:
   * If no card is in the field, the device echoes ''[subcmd, 0x01]'' immediately without attempting the operation.   * If no card is in the field, the device echoes ''[subcmd, 0x01]'' immediately without attempting the operation.
   * To read all pages of an NTAG 215: send subcmd 0x02 with ''start_page=0x00'', ''num_pages=135''.   * To read all pages of an NTAG 215: send subcmd 0x02 with ''start_page=0x00'', ''num_pages=135''.
 +
 +==== 0xD1 EMVStatus ====
 +
 +''%%0xD1%%'' appears at startup and on state changes. It is EMV-style BER-TLV:
 +
 +<code>
 +05 fffee004 39              outer container, 0x39 bytes
 +  df fe e0 08  01  10       poll/state counter A
 +  df fe e0 09  01  01       poll/state counter B
 +  df fe e0 0a  03  000000
 +  df fe e0 0e  08  00...00  card token/UID slot, zero when unhandled
 +  df fe e0 0b  01  00
 +  df fe e0 0c  06  00...00
 +  df fe e0 0d  02  0000
 +</code>
 +
 +The ''%%08%%''/''%%09%%'' counters change between scans. The ''%%0e%%'' slot is where a handled card's token or UID lands once nx has the application keys. Without keys it stays zero and the UID arrives through ''%%0xBE%%''.
  
 ==== Sample reader flow ==== ==== Sample reader flow ====
Line 139: Line 156:
   - Host sends read command. To read the full contents of file 0x00, the body is ''0xBD00000000000000''.   - Host sends read command. To read the full contents of file 0x00, the body is ''0xBD00000000000000''.
   - Reader responds with the status code and file data.   - Reader responds with the status code and file data.
- 
-==== Reader -> Host ==== 
- 
-packet type 0xED seems to be a log message: 
-  \xBC\xB9\0\xED\0h\xB6\x0306:48:13 Error: feclr_transceive() failed: error: 0, status: 0x00000008  
- 
-0xB9 - card read? 
- 
-==== Host -> reader ==== 
-0xBC - appears after every read (ack of some sort?) 
- 
  
 ==== Card read flow ==== ==== Card read flow ====
Line 180: Line 186:
   00000070  cd 15 33 bc b1 00 ed 00 46 b4 01 30 36 3a 34 38  |Í.3¼±.í.F´.06:48|   00000070  cd 15 33 bc b1 00 ed 00 46 b4 01 30 36 3a 34 38  |Í.3¼±.í.F´.06:48|
   00000080  3a 30 38 20 74 72 61 6e 73 63 65 69 76 65 20 65  |:08 transceive e|   00000080  3a 30 38 20 74 72 61 6e 73 63 65 69 76 65 20 65  |:08 transceive e|
-   
-   
-   
-There are 4 bytes appended at the end of some messages (presumably those with ID LSB=1, if the Rust struct description is accurate?) which is not a CRC32 with any polynomial I recognize, but a CRC32 of (message + CRC) is always 0xFFFFFFFF. These 4 bytes are NOT included in the length. 
- 
-The checksum is _appended_, as can be seen by it following the log message (after the final \0). 
- 
-is it a _little endian_, _bit negated_ CRC32. Which is weird because the length is big endian?.. 
- 
  
-* Host only sends two types of messages after initialization - both of type 0xBC. One is length 1 and the body is always 0x60 (+ negated CRC 2A714F60), the other is of length 4 and the body is always 5A2BC3F9 (+ negated-CRC 11A8A56A) 
  
cvend.1795394425.txt.gz · Last modified: by doof