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-05-03 21:35 UTC (7 months ago)] – Explain UltralightCommand and UltralightReply commands haylincvend [2026-11-23 00:56 UTC (5 days ago)] (current) – fix Ultralight reply header to remove emdash qkb
Line 32: Line 32:
 | 0x04 | -> | Status | | | 0x04 | -> | Status | |
 | 0x05 | <- | StatusReply | e.g. "\x00\x00" | | 0x05 | <- | StatusReply | e.g. "\x00\x00" |
-| 0x07 | <- | Heartbeat| sent periodically by reader |+| 0x07 | <- | Heartbeat| sent every ~3s by reader |
 | 0x0f | <- | Startup | sent by reader after startup, approx 1 minute after power on, e.g. "\x00" | | 0x0f | <- | Startup | sent by reader after startup, approx 1 minute after power on, e.g. "\x00" |
-| 0x10 | -> | Reset | Seems to be unimplemented | +| 0x10 | -> | Reset | first byte selects subcommand (2 = restart application, 3 = reboot, 4 = poweroff, 33-36 = reset sam 1-4, others = ''Error: Reset Code not implemented yet. [IppBaseTelegram.cpp:157]'') | 
-| 0x11 | <- | ResetReply | Always seems to be ''Error: Reset Code not implemented yet. [IppBaseTelegram.cpp:157]'' | +| 0x11 | <- | ResetReply | e.g. "\x00\x00" | 
-| 0x20 | -> | LEDs | sets LED status, u32 bitmap; the only two externally visible LEDs on the PM3 are "\x00\x00\x00\x40" and "\x00\x00\x00\x80" |+| 0x20 | -> | LEDs | sets LED status, u32 bitmap; all eight LEDs are in the low byte |
 | 0x22 | -> | Buzzer | makes the cvend beep; u16 frequency, u16 duration.  e.g. "\x06\x00\x01\x00" | | 0x22 | -> | Buzzer | makes the cvend beep; u16 frequency, u16 duration.  e.g. "\x06\x00\x01\x00" |
 | 0x32 | -> | CardRelease | // registered in ProxCardCtrl::ProxCardCtrl(RFIDReader&)// | | 0x32 | -> | CardRelease | // registered in ProxCardCtrl::ProxCardCtrl(RFIDReader&)// |
Line 42: Line 42:
 | 0x96 | -> | PutFile | | | 0x96 | -> | PutFile | |
 | 0x97 | <- | PutFileReply | | | 0x97 | <- | PutFileReply | |
-| 0x98 | -> | GetFile | | +| 0x98 | -> | GetFile | ''%%[u16 pathlen][path][u32 offset][u16 count]%%'' | 
-| 0x99 | <- | GetFileReply | |+| 0x99 | <- | GetFileReply | ''%%[u32 len][data]%%'' |
 | 0x9a | -> | DeleteFile | | | 0x9a | -> | DeleteFile | |
 | 0x9b | <- | DeleteFileReply | | | 0x9b | <- | DeleteFileReply | |
-| 0x9c | -> | FileInfo | | +| 0x9c | -> | FileInfo | ''%%[u16 pathlen][path][u32 off][u32 len]%%'' | 
-| 0x9d | <- | FileInfoReply | | +| 0x9d | <- | FileInfoReply | ''%%[status:u16][size:u32 BE][crc32:u32 BE]%%'' | 
-| 0xa4 | -> | FileList | Seems to list files on the cVEND. First 2 bytes are the path length, remaining bytes are the path to list | +| 0xa4 | -> | FileList | ''%%[u16 pathlen][path]%%'' | 
-| 0xa5 | <- | FileListReply | First 4 bytes are reply length, remaining bytes seem to be null seperated modification timestamps and file/folder names | +| 0xa5 | <- | FileListReply | ''%%[u32 len][name\0mtime\0...]%%'' | 
-| 0xaa | -> | SetTime | |+| 0xaa | -> | SetTime | payload is a timestamp |
 | 0xab | <- | SetTimeReply | | | 0xab | <- | SetTimeReply | |
 | 0xac | -> | ITSOData | //conditionally registered in ItsoIppHandler::_handleItsoCtrlReq(CommBuffer&, IppHeader const&, unsigned char const*)// | | 0xac | -> | ITSOData | //conditionally registered in ItsoIppHandler::_handleItsoCtrlReq(CommBuffer&, IppHeader const&, unsigned char const*)// |
Line 67: Line 67:
 | 0xbc | -> | DESFireCommand | sends desfire command, documented in {{ 0:m075031_desfire.pdf}} | | 0xbc | -> | DESFireCommand | sends desfire command, documented in {{ 0:m075031_desfire.pdf}} |
 | 0xbd | <- | DESFireCommandReply | response to command, documented above | | 0xbd | <- | DESFireCommandReply | response to command, documented above |
-| 0xbe | <- | UnhandledCard | sent by reader when a card is presented that is not supported by any enabled ProxCardFunction, containing UID, historical bytes, and other data |+| 0xbe | <- | UnhandledCard | sent by reader when a card is presented that is not supported by any enabled ProxCardFunction, containing UID, historical bytes, and other data. First two bytes seem to be card type |
 | 0xce | -> | | //unknown, registered in IppHandling::IppHandling()// | | 0xce | -> | | //unknown, registered in IppHandling::IppHandling()// |
-| 0xd0 | -> | EMV | first byte selects subcommand (0 = load config, 1 = preprocess, 2 = toggle polling) | +| 0xd0 | -> | EMV | first byte selects subcommand (0 = load config, 1 = preprocess, 2 = toggle polling)\\ * load config followed by null terminated filename, which is read and passed to fetfpd ''emvco_ep_configure''\\ * preprocess following bytes passed to fetfpd ''emvco_ep_preprocess''\\ * toggle polling following byte (0 = start polling, 1 = stop polling) | 
-| 0xd1 | <- | EMVStatus | sent by reader after startup and certain nfc state changes, format and semantics not yet understood |+| 0xd1 | <- | EMVStatus | sent by reader after startup and certain nfc state changes, EMV-style BER-TLV |
 | 0xd4 | -> | UltralightCommand | Sends a subcommand to the UltralightC/NTAG card in the field. First byte is subcmd. See table below. | | 0xd4 | -> | UltralightCommand | Sends a subcommand to the UltralightC/NTAG card in the field. First byte is subcmd. See table below. |
 | 0xd5 | <- | UltralightReply | Unsolicited card event (''replyTo'' = 0), or reply to a 0xD4 command (''replyTo'' = seq of the 0xD4). See tables below. | | 0xd5 | <- | UltralightReply | Unsolicited card event (''replyTo'' = 0), or reply to a 0xD4 command (''replyTo'' = seq of the 0xD4). See tables below. |
Line 84: Line 84:
 <- - Reader to Host <- - Reader to Host
  
-==== 0xD5 UltralightReply — unsolicited card events ====+==== 0x20 LEDs ====  
 + 
 +The ''%%0x20%%'' payload is a big-endian u32. The eight LEDs live in the low byte:  
 + 
 +^ bit ^ LED ^  
 +| 0x01 | status row 1, green |  
 +| 0x02 | status row 2, green |  
 +| 0x04 | status row 3, green |  
 +| 0x08 | status row 4, green |  
 +| 0x10 | status row 3, amber (same LED as 0x04) |  
 +| 0x20 | status row 4, red (same LED as 0x08) |  
 +| 0x40 | NFC logo, right |  
 +| 0x80 | NFC logo, left |  
 + 
 +==== 0xD5 UltralightReply for unsolicited card events ====
  
 ''replyTo'' = 0 for both forms. ''replyTo'' = 0 for both forms.
Line 113: 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 125: 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 166: 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.1777844122.txt.gz · Last modified: by haylin