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-22 23:42 UTC (5 days ago)] – cvend deep dive, codes gathered from unstripped binaries on device, and some example c code and math qkbcvend [2026-11-23 00:56 UTC (5 days ago)] (current) – fix Ultralight reply header to remove emdash qkb
Line 1: Line 1:
 ====== cVEND NFC Reader ====== ====== cVEND NFC Reader ======
  
-The cVEND is the NFC reader on the bottom half of the PM3. It is a FEIG cVEND +cVEND is the NFC reader on the bottom half of the PM3
-module with its own ARM CPU and embedded Linux, not just a UART peripheral.+
  
 {{ :cvend_plug.pdf |}} {{ :cvend_plug.pdf |}}
  
-The host serial link is ''%%/dev/ttymxc3%%'' at 115200 8N1.+The associated serial device appears to be at ''%%/dev/ttymxc3%%'' @ 115200 8n1 in Linux.
  
-The reader application reports version 02.35 and model string +===== cVEND protocol notes =====
-''%%cS01.05.45-49.00-2-2%%''. ''%%/etc/issue%%'' says ''%%FEIG ELECTRONIC GmbH - cVEND Development Kit%%''. The reader OS is Buildroot 2014.05.+
  
-The boot sequence was captured on the serial line with a Saleae logic analyzer: +Boot-up / initialization logic analyzer trace (open with the Saleae app):
-{{ :cvend-bootup.sal |Boot capture}}. Open it with the Saleae app.+
  
-===== Hardware and provisioning limits =====+{{ :cvend-bootup.sal |}}
  
-The SAM, ISAM, HSM key, Girogo, ITSO, VDV-KA, and EMV configuration paths are +==== IPP packet structure ====
-present in the firmware, but a surplus unit does not have the matching hardware, +
-keys, or EMV config. The protocol table describes the firmware; it does not mean +
-those paths work on every unit.+
  
 +^ offset ^ length ^ name ^ description ^
 +| 0 | 1 | | always 0xBC |
 +| 1 | 1 | ''seq'' | monotonically increasing from 1; skips 0 when rolling over |
 +| 2 | 1 | ''replyTo'' | ''seq'' of the message that this is replying to, or 0 if not a reply |
 +| 3 | 1 | ''msgType'' | |
 +| 4 | 2 | ''msgLen'' | length of ''msgData'' |
 +| 6 | 1 | ''hdrCRC'' | CRC-8-Dallas/Maxim over previous 6 bytes |
 +| 7 | ''msgLen'' | ''msgData'' | message payload, structure depends on ''msgType'' |
 +| 7+''msgLen'' | 4 | ''msgCRC'' | little endian bit inverted IEEE CRC-32/JAMCRC over ''msgData'', only present when ''msgType >= 0x80'' |
  
-===== Reading raw UIDs =====+==== IPP message types ====
  
-The reader scans ISO14443 cards on its own after its firmware boots. It pushes a +^ msgType ^ dir ^ name ^ description ^ 
-frame for every card it sees. No keys, no nx, and no enable sequence are needed +| 0x02 | -> | Version | | 
-to read a UID.+| 0x03 | <- | VersionReply | (device ID from rockchip otp, firmware version, cwd) as length-prefixed strings\\ e.g. "\x18\x00\xdd\xf5\x14cS01.05.46-49.00-2-2\x0502.35\n/home/app0" | 
 +| 0x04 | -> | Status | | 
 +| 0x05 | <- | StatusReply | e.g. "\x00\x00" | 
 +| 0x07 | <- | Heartbeat| sent every ~3s by reader | 
 +| 0x0f | <- | Startup | sent by reader after startup, approx 1 minute after power on, e.g. "\x00" | 
 +| 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 | e.g. "\x00\x00" | 
 +| 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" | 
 +| 0x32 | -> | CardRelease | // registered in ProxCardCtrl::ProxCardCtrl(RFIDReader&)// | 
 +| 0x46 | -> | AbortCardHandling | //registered in ProxCardCtrl::ProxCardCtrl(RFIDReader&)// | 
 +| 0x96 | -> | PutFile | | 
 +| 0x97 | <- | PutFileReply | | 
 +| 0x98 | -> | GetFile | ''%%[u16 pathlen][path][u32 offset][u16 count]%%'' | 
 +| 0x99 | <- | GetFileReply | ''%%[u32 len][data]%%'' | 
 +| 0x9a | -> | DeleteFile | | 
 +| 0x9b | <- | DeleteFileReply | | 
 +| 0x9c | -> | FileInfo | ''%%[u16 pathlen][path][u32 off][u32 len]%%'' | 
 +| 0x9d | <- | FileInfoReply | ''%%[status:u16][size:u32 BE][crc32:u32 BE]%%'' | 
 +| 0xa4 | -> | FileList | ''%%[u16 pathlen][path]%%'' | 
 +| 0xa5 | <- | FileListReply | ''%%[u32 len][name\0mtime\0...]%%'' | 
 +| 0xaa | -> | SetTime | payload is a timestamp | 
 +| 0xab | <- | SetTimeReply | | 
 +| 0xac | -> | ITSOData | //conditionally registered in ItsoIppHandler::_handleItsoCtrlReq(CommBuffer&, IppHeader const&, unsigned char const*)// | 
 +| 0xad | <- | ITSODataReply | | 
 +| 0xae | -> | ITSOCtrl | //registered in ItsoIppHandler::ItsoIppHandler(ProxCardItso&)// | 
 +| 0xaf | <- | ITSOCtrlReply | | 
 +| 0xb1 | <- | ISORead | sent by reader when ISO14443A card presented, after enabling Iso with 0xe4\\ card UID at offset 2 | 
 +| 0xb3 | <- | ISOCardReleased | sent by reader after ISO1443A card released with 0x32 or 0x46 | 
 +| 0xb4 | -> | APDUProx | DeviceSelect(0x00), CLA, INS, P1, P2, Lc (2 bytes), Data, [magic], Le (2 bytes), I don't know what magic is, but put 0x04 if you have data or 0x01 if you don't | 
 +| 0xb5 | <- | APDUProxReply | DeviceSelect(0x00), Echo (?), Status (0x00=success, 0x6c=no session, 0x70=no card, 0x76=retry), SW1, SW2, Data | 
 +| 0xb6 | -> | SAMCtrl | //registered in SamCtrl::SamCtrl()// | 
 +| 0xb7 | <- | SAMCtrlReply | | 
 +| 0xb9 | <- | DESFireRead | sent by reader when DESFire card presented, after enabling DESFire with 0xe4 | 
 +| 0xba | -> | | //unknown, registered in ProxCardDesfire::ProxCardDesfire(RFIDReader&)// | 
 +| 0xbb | <- | DESFireCardRemoved | sent by reader when DESFire card removed from field | 
 +| 0xbc | -> | DESFireCommand | sends desfire command, documented in {{ 0:m075031_desfire.pdf}} | 
 +| 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. First two bytes seem to be card type | 
 +| 0xce | -> | | //unknown, registered in IppHandling::IppHandling()// | 
 +| 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, EMV-style BER-TLV | 
 +| 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. | 
 +| 0xe4 | -> | ProxCardFunction | first 2 bytes specify function (4=VdvKa, 5=MifareClassic, 6=Iso, 7=Desfire, 8=Girogo, 9=Itso, 10=UltralightC), next byte must be 1, next byte (0=disable, 1=enable)\\ ''00070101'' sent by PM3 to enable DESFire reading at startup | 
 +| 0xe5 | <- | ProxCardFunctionReply | Returns 4 byte payload: 0x00, the function number (as above), 0x00, 0x00 | 
 +| 0xe6 | -> | | //unknown, registered in GirogoIppHandler::GirogoIppHandler(RFIDReader&, ProxCardGirogo*)// | 
 +| 0xe8 | -> | SecurityServices | first byte selects subcommand (0=GetVersionOfKey, 1=RemoveX509Cert, 2=RemoveKeyBlock, 3=ImportX509Cert, 4=ExportX509Cert, 5=ImportKeyBlock, 6=ExportKeyBlock, 7=GenerateKSKPair), remaining bytes unknown | 
 +| 0xe9 | <- | SecurityServicesReply | | 
 +| 0xea | -> | | //unknown, registered in ProxCardMifareClassic::ProxCardMifareClassic(RFIDReader&)// | 
 +| 0xed | <- | Log | first byte specifies log level (1=INFO, 2=WARNING, 3=ERROR) followed by null-terminated human-readable log message |
  
-  - Open ''%%/dev/ttymxc3%%'' at 115200 8N1 after the unit boots. +-> - Host to Reader\\ 
-  - Do not send the nx init sequence. The ''%%0xE4%%'' enables, ''%%0xAA%%'' SetTime, and ''%%0xE8%%'' certificate read switch the reader into nx's handled-card mode and stop the autonomous base scan. +<- - Reader to Host
-  - Send a ''%%0x04%%'' status frame about once a second. It is cheap and covers the case where the reader drops into idle. +
-  - Watch for ''%%0xBE%%'' frames. The 7-byte UID starts at payload offset 11.+
  
-Gate on the frame type. ''%%0xBE%%'' is the unhandled-card frame. The ''%%0xD1%%'' status and +==== 0x20 LEDs ==== 
-''%%0xED%%'' log frames also contain ''%%0x04%%'' bytes, so looking for the byte instead of +
-the frame type produces phantom reads.+
  
-Direct frames, with sequence 1 and no payload CRC:+The ''%%0x20%%'' payload is a big-endian u32. The eight LEDs live in the low byte: 
  
-<code> +^ bit ^ LED ^  
-stty -F /dev/ttymxc3 115200 cs8 -cstopb -parenb raw -echo+| 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 | 
  
-# Status keepalive +==== 0xD5 UltralightReply for unsolicited card events ====
-printf '\274\001\000\004\000\000\051' > /dev/ttymxc3+
  
-# Version request +''replyTo'' = 0 for both forms.
-printf '\274\001\000\002\000\000\370' > /dev/ttymxc3+
  
-# Restart the reader application +^ byte 0 ^ meaning ^ payload ^ 
-printf '\274\001\000\020\000\001\243\002' > /dev/ttymxc3+| 0x00 | Card entered field | byte 1 = 0x00 (purpose unknown); bytes 2–8 = 7-byte UID (cascade / double UID format, e.g. ''04 21 B9 01 10 04 03'' for NTAG 215) | 
 +| 0x01 | Card left field    | byte 1 = 0x00 |
  
-# Listen for frames +==== 0xD4 UltralightCommand / 0xD5 UltralightReply — subcommands ====
-timeout -t 3 dd if=/dev/ttymxc3 bs=1 count=256 2>/dev/null | hexdump -C +
-</code>+
  
-The examples use sequence 1. Increment the sequence byte and recompute the CRC-8 +Host sends 0xD4 with ''msgData[0]'' = subcmd. Reader replies with 0xD5 where ''replyTo'' = seq of the 0xD4.
-if you send more than one frame. The CRC only appears on frames with a type of +
-''%%0x80%%'' or higher.+
  
-===== What the firmware handles =====+Reply format: ''[subcmd_echo, status, payload...]''
  
-The cVEND runs a complete card stack on its own ARM core. None of this happens +Status codes: ''0x00'' = success, ''0x01'' = operation error (e.g. no card in field), ''0x02'' = invalid parameters.
-on the PM3's i.MX6:+
  
-  * RF field and ISO14443A/B anticollision. +^ subcmd ^ name ^ request payload (after subcmd byte) ^ reply payload (after subcmd + status) ^ 
-  * Polling for every card type the reader is configured to look for. +| 0x02 | Read | ''[start_page: u8, num_pages: u8]'' — exactly 3 bytes total | page data, 4 bytes per page (e.g. 135 pages × 4 = 540 bytes for NTAG 215) | 
-  * ISO14443-4 activation, ATS, and protocol selection. +| 0x03 | Write | ''[page_addr: u8, data: 4 bytes]'' — 5 bytes total | //empty// | 
-  * DESFire native protocol and the EMV Level 2 kernel. +| 0x04 | Authenticate (raw key) | ''[key: 16 bytes]'' — 17 bytes total | //empty// | 
-  * Card presence tracking and the LED/buzzer feedback.+| 0x05 | Authenticate (key index) | ''[key_idx: BE u16]'' — 3 bytes total | //empty// | 
 +| 0x06 | Authenticate (index + key) | ''[key_idx: BE u16, key: 16 bytes]'' — 19 bytes total | //empty// | 
 +| 0x07 | Abort | //none// — exactly 1 byte total | //empty// | 
 +| 0x00–0x01, 0x08+ | (invalid) | — | no reply frame; device logs "Unknown subcommand" |
  
-A host application never talks to a card. It opens the serial port and reads the +Notes: 
-frames the reader pushes. That is why a UID reader fits in one short file, +  * Subcmds 0x02–0x07 are registered in ''ProxCardUltralightC::ProxCardUltralightC(RFIDReader&)'' (confirmed by disassembly of ''feig'' ARM binary from V0200.C72 firmware). 
-and it is also the ceiling: if the firmware does not poll a card type, no amount +  * If no card is in the field, the device echoes ''[subcmd, 0x01]'' immediately without attempting the operation. 
-of host code makes it appear.+  * To read all pages of an NTAG 215: send subcmd 0x02 with ''start_page=0x00'', ''num_pages=135''.
  
-The base scan is UID-only for the same reason. The reader activates the card, +==== 0xD1 EMVStatus ====
-emits ''%%0xBE%%'', and releases it because no handler owns that card type. +
-''%%0xD4%%'' Transceive then has nothing selected to talk to and replies status +
-''%%0x01%%'' (no card). Sending APDUs, reading files, or authenticating needs a +
-card type enabled and the reader's handled-card path, which is what ''%%nx%%'' +
-drives. See [[nx]] for that side.+
  
-===== Writing a host application ===== +''%%0xD1%%'' appears at startup and on state changes. It is EMV-style BER-TLV:
- +
-Every frame is the same seven-byte header, then the payload: +
- +
-<code> +
-BC  seq  replyTo  type  lenHi  lenLo  crc8  data... +
-</code> +
- +
-  * ''%%BC%%'' is the start byte. The parser resyncs on it. +
-  * ''%%seq%%'' counts host requests. The reader echoes it in ''%%replyTo%%'' so replies can be matched. +
-  * ''%%lenHi lenLo%%'' is the payload length, big-endian. +
-  * ''%%crc8%%'' is CRC-8/MAXIM over the first six bytes, reflected polynomial ''%%0x8C%%'', init ''%%0%%''. +
-  * A trailing CRC-32 appears only when ''%%type >= 0x80%%''. It is CRC-32/JAMCRC over the payload, little-endian. +
- +
-Parse in the same order the reader does: find ''%%BC%%'', check the header CRC, +
-then wait until the declared length plus the optional trailer is buffered. +
-A ''%%BC%%'' inside a payload cannot be mistaken for a frame start, because its +
-header CRC will not validate. +
- +
-A complete reader, no dependencies: +
- +
-<code> +
-#include <stdio.h> +
-#include <stdint.h> +
-#include <string.h> +
-#include <fcntl.h> +
-#include <unistd.h> +
-#include <poll.h> +
-#include <termios.h> +
-#include <time.h> +
- +
-static uint8_t crc8(const uint8_t *p, size_t n) +
-{ +
-    uint8_t c = 0; +
-    while (n--) { +
-        c ^= *p++; +
-        for (int i = 0; i < 8; i++) +
-            c = (c & 1) ? (c >> 1) ^ 0x8C : c >> 1; +
-    } +
-    return c; +
-} +
- +
-static int send_frame(int fd, uint8_t seq, uint8_t type, +
-                      const uint8_t *d, uint16_t n) +
-{ +
-    uint8_t b[7 + 64]; +
-    b[0] = 0xBC; b[1] = seq; b[2] = 0; b[3] = type; +
-    b[4] = n >> 8; b[5] = n & 0xFF; +
-    b[6] = crc8(b, 6); +
-    if (n) +
-        memcpy(b + 7, d, n); +
-    return write(fd, b, 7 + n) == 7 + n ? 0 : -1; +
-} +
- +
-int main(void) +
-{ +
-    int fd = open("/dev/ttymxc3", O_RDWR | O_NOCTTY); +
-    struct termios t; +
-    tcgetattr(fd, &t); +
-    cfmakeraw(&t); +
-    cfsetispeed(&t, B115200); +
-    cfsetospeed(&t, B115200); +
-    tcsetattr(fd, TCSANOW, &t); +
- +
-    uint8_t buf[512], seq = 1, last_uid[8] = {0}; +
-    size_t used = 0; +
-    time_t last_ka = 0, last_seen = 0; +
- +
-    for (;;) { +
-        time_t now = time(NULL); +
-        if (now != last_ka) { +
-            send_frame(fd, seq, 0x04, NULL, 0); +
-            if (++seq == 0) +
-                seq = 1; +
-            last_ka = now; +
-        } +
- +
-        struct pollfd p = { fd, POLLIN, 0 }; +
-        if (poll(&p, 1, 1000) <= 0) +
-            continue; +
- +
-        ssize_t r = read(fd, buf + used, sizeof buf - used); +
-        if (r <= 0) +
-            continue; +
-        used += r; +
- +
-        size_t i = 0; +
-        while (used - i >= 7) { +
-            if (buf[i] != 0xBC || crc8(buf + i, 6) != buf[i + 6]) { +
-                i++; +
-                continue; +
-            } +
-            uint16_t n = (buf[i + 4] << 8) | buf[i + 5]; +
-            size_t total = 7 + n + (buf[i + 3] >= 0x80 ? 4 : 0); +
-            if (used - i < total) +
-                break; +
- +
-            if (buf[i + 3] == 0xBE && n >= 18) { +
-                uint8_t *uid = buf + i + 7 + 11;   /* see payload layout below */ +
-                int fresh = memcmp(uid, last_uid, 7) != 0 || +
-                            now - last_seen > 3; +
-                last_seen = now; +
-                if (fresh) { +
-                    memcpy(last_uid, uid, 7); +
-                    for (int j = 0; j < 7; j++) +
-                        printf("%02X%s", uid[j], j == 6 ? "\n" : ":"); +
-                } +
-            } +
-            i += total; +
-        } +
-        memmove(buf, buf + i, used - i); +
-        used -= i; +
-    } +
-} +
-</code> +
- +
-The UID sits at payload offset 11 in every ''%%0xBE%%'' seen so far: one status +
-byte, one length byte, nine reserved bytes, then the UID. Check the frame length +
-before trusting the offset. The example assumes a 7-byte UID; a 4-byte UID +
-carries a different length. +
- +
-===== Card presence ===== +
- +
-The reader re-sends ''%%0xBE%%'' about once a second for as long as the card is in +
-the field. It arrives unsolicited with ''%%replyTo=0%%'', so the sequence byte does +
-not help match it. It does not send a leave frame on the base path, so presence +
-has to be inferred: treat the card as gone when no ''%%0xBE%%'' with that UID has +
-arrived for a couple of seconds. Without that timeout a card parked on the reader +
-keeps producing events and a queue fills up. +
- +
-Handled mode does have a leave event. ''%%0xD5%%'' with ''%%replyTo=0%%'' is +
-''%%[subtype][status][7-byte UID]%%'': subtype ''%%0x00%%'' is a card entering, +
-''%%0x01%%'' a card leaving. +
- +
-<code> +
-00 00 04 85 92 8a a0 61 81   card entered +
-01 00 04 85 92 8a a0 61 81   card left +
-</code> +
- +
-That path only runs with card types enabled and the matching keys present. +
- +
-===== What a card frame gives you ===== +
- +
-''%%0xBE%%'' carries more than the UID. After the UID the payload holds the +
-ATQA, the SAK, and the length-prefixed ATS, so cards can be classified without +
-selecting them. The full layout is in the card events section below. +
- +
-SAK ''%%0x20%%'' means ISO14443-4: DESFire, EMV cards, and Java Card. +
-''%%0x08%%'' is MIFARE Classic 1K, ''%%0x18%%'' Classic 4K, ''%%0x44%%'' Ultralight. +
-That is enough to decide whether to look for an EMV application or treat the +
-card as a memory tag. +
- +
-The same reader has the LED and buzzer frames (''%%0x20%%'' and ''%%0x22%%''), so a +
-host application can chirp and light the reader on a read without any extra +
-hardware. +
- +
-===== Running a reader next to nx ===== +
- +
-Only one process can own ''%%/dev/ttymxc3%%''. Stop ''%%nx%%'' and +
-''%%init-abtproxy%%'' first, or the two will interleave frames and neither will +
-work reliably. +
- +
-Do not send the ''%%0xE4%%'' enables, ''%%0xAA%%'' SetTime, or ''%%0xE8%%'' certificate +
-read. That switches the reader into nx's handled-card mode and stops the +
-autonomous base scan. It is a different mode, not an initialization step for +
-UIDs. Handled reads also need the card keys and, for some schemes, a SAM or +
-ISAM. +
- +
-Do not re-initialize the reader on every tap. That stops the scan you are trying +
-to read from. If scanning does stop, ''%%0x10 02%%'' restarts the reader application +
-and normally returns scanning in about 6 seconds. If no Startup arrives, +
-power-cycle the reader. A bare ''%%0x10%%'' with no subcode wedges it. +
- +
-A loop like the one above has read 74 taps from five different cards over four +
-minutes without a gap. +
- +
-===== Card events ===== +
- +
-^ Type ^ Direction ^ Meaning ^ +
-| ''%%0xBE%%'' | reader to host | UnhandledCard. UID is present for card types that are not enabled. | +
-| ''%%0xD5%%'' | reader to host | Card in/out for an enabled type. ''%%replyTo=0%%'' for an unsolicited event: ''%%[subtype][0x00][7-byte UID]%%'', subtype 0 enter, 1 leave. Also used as the reply to ''%%0xD4%%''. | +
-| ''%%0xB1%%'' | reader to host | ISO14443A read. UID starts at offset 2. | +
-| ''%%0xB9%%'' | reader to host | DESFire read. UID starts at offset 2. | +
-| ''%%0xBB%%'' | reader to host | DESFire card removed. | +
-| ''%%0xD1%%'' | reader to host | EMV/status record. See below. | +
-| ''%%0xED%%'' | reader to host | Log line. First byte is 1 INFO, 2 WARN, 3 ERROR, then a null-terminated ASCII message. | +
- +
-A ''%%0xBE%%'' payload looks like: +
- +
-<code> +
-00        status (card present) +
-0c        length +
-00 x9     reserved +
-04 50 67 0a 81 22 90   7-byte ISO14443A UID (NXP cards start with 04) +
-44 03     ATQA, little-endian, about 0x0344 +
-20        SAK +
-06 75 77 81 02 80      ATS, length-prefixed +
-</code> +
- +
-The bytes before the UID are status/length/reserved fields, not a reliable +
-card-type field. +
- +
-===== The 0xD1 status record ===== +
- +
-''%%0xD1%%'' appears at startup and on state changes. It is not a continuous idle +
-stream on this firmware, so do not use it as a keepalive indicator. It is +
-EMV-style BER-TLV:+
  
 <code> <code>
Line 301: Line 143:
 </code> </code>
  
-The ''%%08%%''/''%%09%%'' counters change between scans. The ''%%0e%%'' slot is where a handled +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%%''.
-card's token or UID lands once nx has the application keys. Without keys it +
-stays zero and the UID arrives through ''%%0xBE%%''.+
  
-===== DESFire commands =====+==== Sample reader flow ====
  
-DESFire cards are read with ''%%0xBC%%'' DESFireCommand and ''%%0xBD%%'' +  - Host enables desired card type with ''ProxCardFunction''. 
-DESFireCommandReply. The ''%%0xBC%%'' payload is the native DESFire frame, so +  - Reader acknowledges with ''ProxCardFunctionReply''. 
-{{ 0:m075031_desfire.pdf }} applies directly.+  - Reader waits for card, seems like it eventually goes to sleep without any stimuli. Might have to keep it awake by sending packets occasionally (e.g. ''Status''). 
 +  - When card is scanned, reader sends the corresponding read packet if the card type is enabled (e.g. ''DESFireRead'' for DESFire). If type is not enabled, sends ''UnhandledCard''. 
 +  - Card data can then be queried by sending the equivalent command packets. DESFire commands are documented in {{ 0:m075031_desfire.pdf }}. Example for reading a page off a DESFire ( all of the following packets are of type ''DESFireCommand'' and ''DESFireCommandReply''):  
 +  - Host sets DESFire application (e.g. packet type ''DESFireCommand'' with body ''0x5AF210E0'' for application ID ''0xE010F2''). **NOTE:** The application ID will vary between issuer/agency. For example, the stock software uses application ID ''F9C32B'' while Portland's TriMet uses the one in the example. You can check this for your card with an NFC reader or app.  
 +  - Reader responds with a status code in accordance with the documentation. This comes in the form of a ''DESFireCommandReply'' packet. 
 +  - 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.
  
-Enable the handler first with ''%%0xE4 00 07 01 01%%''. This is the handled path, so +==== Card read flow ==== 
-it stops the autonomous base scan; pick one mode or the other. The reader then +  R: BCB600B9000BBB0C000000048A6EF29B149079CB8CF0 
-sends ''%%0xB9%%'' when a DESFire card enters the field and ''%%0xBB%%'' when it leaves. +  H: BC2200BC000158602A714F60           # DESFire GetVersion (60) 
- +  R: BCB722BD001E3D00000401013300160504010103001605048A6EF29B149020487330305022C98C7E9B 
-The commands nx sends after the card event: +  H: BC2300BC0004AA5A2BC3F911A8A56A     # DESFire SelectApplication (5A 2BC3F9) 
- +  R: BCB823BD0002E301FDE0523164
-<code> +
-GetVersion        0xBC -> 60 +
-SelectApplication 0xBC -> 5A <3-byte application id> +
-ReadData          0xBC -> BD <file> <offset, 3 bytes> <length, 3 bytes> +
-</code> +
- +
-The application ID is issuer-specific. The stock software uses ''%%F9C32B%%''; +
-Portland TriMet cards use ''%%E010F2%%''. If you do not know the ID, read it off +
-the card first. +
- +
-A GetVersion exchange captured from nx, split into header, payload, and CRC: +
- +
-<code> +
-host    BC 22 00 BC | 00 01 | 58 | 60 | 2A 71 4F 60 +
-reader  BC B7 22 BD | 00 1E | 3D | 00 00 04 01 01 33 00 16 05 04 +
-                                 01 01 03 00 16 05 04 8A 6E F2 +
-                                 9B 14 90 20 48 73 30 30 50 22 | C9 8C 7E 9B +
-</code> +
- +
-''%%0xBD%%'' puts two reader bytes ahead of the card data. Here they are ''%%00 00%%'', +
-and the DESFire data starts at ''%%04 01 01 33%%''. A SelectApplication reply in +
-the same capture was ''%%01 FD%%'' with no data. Check the DESFire status word +
-instead of assuming a fixed offset. +
- +
-A host DESFire frame starts ''%%BC seq 00 BC%%''. The second ''%%0xBC%%'' is the +
-message type, not an ack of some kind. +
- +
-===== IPP packet structure ===== +
- +
-^ offset ^ length ^ name ^ description ^ +
-| 0 | 1 | | always ''%%0xBC%%'' | +
-| 1 | 1 | ''%%seq%%'' | increasing from 1, skips 0 on rollover | +
-| 2 | 1 | ''%%replyTo%%'' | ''%%seq%%'' being answered, or 0 for unsolicited | +
-| 3 | 1 | ''%%msgType%%'' | | +
-| 4 | 2 | ''%%msgLen%%'' | payload length | +
-| 6 | 1 | ''%%hdrCRC%%'' | CRC-8 Dallas/Maxim over the previous 6 bytes | +
-| 7 | ''%%msgLen%%'' | ''%%msgData%%'' | payload | +
-| 7+''%%msgLen%%'' | 4 | ''%%msgCRC%%'' | little-endian bit-inverted IEEE CRC-32/JAMCRC over ''%%msgData%%'', only when ''%%msgType >= 0x80%%'' | +
- +
-===== IPP Message types ===== +
- +
-^ msgType ^ dir ^ name ^ notes ^ +
-| 0x02 | -> | Version | reply 0x03 | +
-| 0x03 | <- | VersionReply | device id from the Rockchip OTP, model string, firmware, and cwd as length-prefixed strings | +
-| 0x04 | -> | Status | reply 0x05, ''%%00 00%%'' | +
-| 0x05 | <- | StatusReply | | +
-| 0x07 | <- | Heartbeat | about every 3.0 s | +
-| 0x0F | <- | Startup | sent about 1 minute after reader power-on | +
-| 0x10 | -> | Reset | first byte selects the action: 2 exits the app so it is respawned, 3 calls ''%%fetrm_reboot%%'', 4 calls ''%%fetrm_poweroff%%'', 33-36 reset SAM slot 1-4. Anything else logs ''%%Error: Reset Code not implemented yet. [IppBaseTelegram.cpp:157]%%'' and answers ''%%0x11 0000%%''. Do not send it without a payload byte. | +
-| 0x11 | <- | ResetReply | ''%%00 00%%'' | +
-| 0x20 | -> | LEDs | u32 bitmap, big-endian. All eight LEDs are in the low byte. Upper bytes are inert. | +
-| 0x22 | -> | Buzzer | ''%%[u16 freq][u16 ms]%%'', big-endian. About 2700 Hz is loudest. | +
-| 0x32 | -> | CardRelease | | +
-| 0x46 | -> | AbortCardHandling | | +
-| 0x96 | -> | PutFile | write operation; use with care | +
-| 0x97 | <- | PutFileReply | | +
-| 0x98 | -> | GetFile | ''%%[u16 pathlen][path][u32 offset][u16 count]%%'' -> ''%%0x99 [u32 len][data]%%'' | +
-| 0x99 | <- | GetFileReply | | +
-| 0x9A | -> | DeleteFile | left alone | +
-| 0x9B | <- | DeleteFileReply | | +
-| 0x9C | -> | FileInfo | ''%%[u16 pathlen][path][u32 off][u32 len]%%'' -> ''%%0x9D [status:u16][size:u32 BE][crc32:u32 BE]%%''. ''%%0,0%%'' covers the whole file. The CRC is reflected CRC-32 with polynomial ''%%0xEDB88320%%'', initial value 0, final XOR ''%%0xFFFFFFFF%%''. See the 0x9C CRC section. | +
-| 0x9D | <- | FileInfoReply | | +
-| 0xA4 | -> | FileList | ''%%[u16 pathlen][path]%%'' -> ''%%0xA5 [u32 len][name\0mtime\0...]%%'' | +
-| 0xA5 | <- | FileListReply | | +
-| 0xAA | -> | SetTime | payload is a timestamp. Reply ''%%0xAB 0000%%''. Not an arm command. | +
-| 0xAB | <- | SetTimeReply | | +
-| 0xAC | -> | ITSOData | needs an ISAM | +
-| 0xAD | <- | ITSODataReply | | +
-| 0xAE | -> | ITSOCtrl | needs an ISAM | +
-| 0xAF | <- | ITSOCtrlReply | | +
-| 0xB1 | <- | ISORead | UID at offset 2 | +
-| 0xB3 | <- | ISOCardReleased | | +
-| 0xB4 | -> | APDUProx | ''%%[devsel][CLA][INS][P1][P2][Lc BE][data][flags][Le BE]%%'', total ''%%10 + Lc%%''. The device byte is copied into the reply and not validated. Only dispatches while ProxCardIso is the active handler. | +
-| 0xB5 | <- | APDUProxReply | ''%%[devsel][echo][status][SW1][SW2][data]%%''; status 0x70 no card, 0x6C no session | +
-| 0xB6 | -> | SAMCtrl | needs a fitted SAM | +
-| 0xB7 | <- | SAMCtrlReply | status 0x72 on error | +
-| 0xB9 | <- | DESFireRead | | +
-| 0xBA | -> | DESFire second entry | | +
-| 0xBB | <- | DESFireCardRemoved | | +
-| 0xBC | -> | DESFireCommand | native DESFire command | +
-| 0xBD | <- | DESFireCommandReply | two reader bytes, then the card data. GetVersion replies ''%%00 00 04 01 01 33 ...%%'' | +
-| 0xBE | <- | UnhandledCard | UID carrier for disabled types | +
-| 0xCE | -> | control | IppHandling | +
-| 0xD0 | -> | EMV | 0 load config, followed by a null-terminated filename that is read on the reader and passed to ''%%fetfpd emvco_ep_configure%%''; 1 preprocess, bytes passed to ''%%emvco_ep_preprocess%%''; 2 toggle polling, next byte 0 start or 1 stop. Needs an EMV config. | +
-| 0xD1 | <- | EMVStatus | BER-TLV status record | +
-| 0xD4 | -> | UltralightCommand | subcommands below. Host path is limited; see the warning. | +
-| 0xD5 | <- | UltralightReply / card event | | +
-| 0xE4 | -> | ProxCardFunction | ''%%[00][id][01][00|01]%%''; ids 4 VdvKa, 5 MifareClassic, 6 Iso, 7 Desfire, 8 Girogo, 9 Itso, 10 UltralightC. Enables work. Disable requests return status 0x74; handlers are not disabled at runtime. | +
-| 0xE5 | <- | ProxCardFunctionReply | ''%%00 id 00 00%%'' on enable, ''%%00 id 00 74%%'' on a failed disable | +
-| 0xE6 | -> | Girogo | not exercised; needs girogo keys and hardware | +
-| 0xE8 | -> | SecurityServices | sub 0 GetVersionOfKey, 1 RemoveX509Cert, 2 RemoveKeyBlock, 3 ImportX509Cert, 4 ExportX509Cert (device cert), 5 ImportKeyBlock, 6 ExportKeyBlock, 7 GenerateKSKPair. The writes need HSM keys that a surplus unit does not have. | +
-| 0xE9 | <- | SecurityServicesReply | | +
-| 0xEA | -> | Mifare Classic / wake | handler exists but often errors | +
-| 0xED | <- | Log | level byte plus null-terminated text | +
- +
-Directions are host to reader (''%%->%%'') and reader to host (''%%<-%%''). +
- +
-===== 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 | +
- +
-''%%struct.pack(">I", 0x0f)%%'' lights the four green status LEDs. ''%%0x00%%'' clears them. +
-The firmware also drives the LEDs during RF activity, so a host write holds only +
-until the next firmware update. Drive them from a loop if you need them steady. +
- +
-===== Reader filesystem ===== +
- +
-The reader exposes file operations over IPP. The two read operations are useful: +
- +
-<code> +
-0xA4 FileList  [u16 pathlen][path] +
-               -> 0xA5 [u32 len][name\0mtime\0...] +
- +
-0x98 GetFile   [u16 pathlen][path][u32 offset][u16 count] +
-               -> 0x99 [u32 len][data] +
-</code> +
- +
-''%%0x98%%'' returns one frame per call, so page with ''%%offset%%'' and use a ''%%count%%'' under +
-about 60 KB. ''%%0x9C FileInfo%%'' returns the status, size, and a CRC-32 that is +
-described below. +
- +
-Worth reading: +
- +
-  * ''%%/etc/fetpfrc%%'': JSON payment config with permitted SAM slots and crypto/token plugins. +
-  * ''%%/home/startup_config.conf%%'': ''%%STARTUP_APP="/home/app0"%%''. +
-  * ''%%/home/app0/run%%'': app launcher. +
-  * ''%%/home/app0/emv/transact-counter.dat%%'': EMV transaction counter. +
-  * ''%%/home/app0/config%%'': 160 bytes of zeros on the PM3. It is not the RF or power-timer blob. Those timers are still not located. +
- +
-Direct example for a directory listing: +
- +
-<code> +
-stty -F /dev/ttymxc3 115200 cs8 -cstopb -parenb raw -echo +
-printf '\274\001\000\244\000\014\174\000\012\057\150\157\155\145\057\141\160\160\060\227\022\347\031' > /dev/ttymxc3 +
-timeout -t 2 dd if=/dev/ttymxc3 bs=1 count=512 2>/dev/null | hexdump -C +
-</code> +
- +
-Direct example for reading ''%%/home/app0/version%%'', offset 0, count ''%%0x100%%'': +
- +
-<code> +
-printf '\274\001\000\230\000\032\131\000\022\057\150\157\155\145\057\141\160\160\060\057\166\145\162\163\151\157\156\000\000\000\000\001\000\370\354\104\170' > /dev/ttymxc3 +
-timeout -t 2 dd if=/dev/ttymxc3 bs=1 count=64 2>/dev/null | hexdump -C +
-</code> +
- +
-The reply length depends on the file. Increase ''%%count%%'' if a frame is truncated. +
-These examples also use sequence 1. Increment the sequence byte for each request. +
- +
-===== The 0x9C CRC ===== +
- +
-''%%0x9C%%'' hashes the file bytes in ''%%[off, off+len)%%'' with a reflected CRC-32: +
- +
-<code> +
-crc = 0x00000000 +
-for each byte b: +
-    crc ^= b +
-    8 times: crc = (crc >> 1) ^ 0xEDB88320 if crc & 1 else crc >> 1 +
-return crc ^ 0xFFFFFFFF +
-</code> +
- +
-That is polynomial ''%%0x04C11DB7%%'' reflected, initial value 0, final XOR +
-''%%0xFFFFFFFF%%''. It is not ISO-HDLC (which starts at ''%%0xFFFFFFFF%%'') and not +
-JAMCRC (which skips the final XOR). +
- +
-In C, one loop over the file: +
- +
-<code> +
-static uint32_t file_crc(const uint8_t *p, size_t n) +
-{ +
-    uint32_t crc = 0; +
-    while (n--) { +
-        crc ^= *p++; +
-        for (int i = 0; i < 8; i++) +
-            crc = (crc & 1) ? (crc >> 1) ^ 0xEDB88320 : crc >> 1; +
-    } +
-    return crc ^ 0xFFFFFFFF; +
-} +
-</code> +
- +
-The firmware's own routine takes the running CRC as a seed and inverts both ends, +
-so a 4 KB chunk loop composes correctly. The reply is big-endian: +
- +
-<code> +
-00 00                  status +
-00 00 00 06            size, 6 +
-04 40 bb d8            crc32 of "02.35\n" +
-</code> +
- +
-Verified against seven files and three ranged reads. +
- +
-''%%status%%'' is ''%%0x00%%'' for a normal file. ''%%/home/app0/config%%'' answers ''%%0x01%%'' +
-with size 160 and CRC ''%%0xffffffff%%'', yet GetFile still returns 160 zero bytes, +
-so ''%%0x01%%'' does not mean "missing". +
- +
-===== Sleep and recovery ===== +
- +
-The reader powers its RF field down after an idle timeout and can drop into a +
-sub-1 mA hardware standby. There is no host wake opcode in the documented FEIG +
-command set. A ''%%0x04%%'' Status frame does not reliably wake it. +
- +
-Leaving the tty open without a keepalive still scanned after 90 seconds. Either +
-the idle timeout is longer than that or an open host tty counts as stimulus. The +
-idle timeout is not established; keep the keepalive running if you need scanning. +
- +
-Symptoms: scanning stops, only the ''%%0x07%%'' heartbeat continues, and ''%%0xD1%%''/''%%0xBE%%'' +
-stop. +
- +
-Recovery: +
- +
-<code> +
-0x10 02 +
-</code> +
- +
-That restarts the application. On a healthy reader it emits ''%%0x11%%'' ResetReply, +
-aborts, re-initializes, and emits ''%%0x0F%%'' Startup after about 6 to 7 seconds. +
-The serial link is preserved. If no Startup arrives, power-cycle the reader. +
- +
-The first payload byte selects what Reset does: +
- +
-  * ''%%2%%'': the app breaks out of its main loop and exits. Whatever supervises it starts it again. This is the recovery command. +
-  * ''%%3%%'': calls ''%%fetrm_reboot()%%'', a full reader reboot. +
-  * ''%%4%%'': calls ''%%fetrm_poweroff()%%''. The reader stays off until it gets power. +
-  * ''%%33%%'' to ''%%36%%'' (''%%0x21%%'' to ''%%0x24%%''): reset SAM slot 1 to 4. Needs a fitted SAM. +
-  * anything else: no action, and the error above is logged. +
- +
-The handler reads the first payload byte, so do not send ''%%0x10%%'' with an empty +
-payload. That has left the reader unresponsive in testing. +
- +
-Subcode 3 replies ''%%0x11%%'', aborts card handling, and then stops answering. +
-''%%0x10 02%%'' did not recover it, and it had not returned after 20 seconds, so +
-that test ended with a physical power cycle. Treat 3 as "reboot the module", not +
-as a faster restart. +
- +
-===== nx handshake reference ===== +
- +
-Captured by an LD_PRELOAD shim on nx's serial traffic: +
- +
-<code> +
-0xEA 0100          wake/prime +
-0x02               version +
-0xE4 00 05 01 01   enable Mifare +
-0xE4 00 07 01 01   enable Desfire +
-0xE4 00 0a 01 01   enable UltralightC +
-0xAA <timestamp>   SetTime +
-0xE8 04fe0a0000    read device cert -> 0xE9 (~1.1 KB X.509) +
-</code> +
- +
-The ''%%0xE4%%'' enables and SetTime switch the reader from the autonomous base scan to +
-nx's handled-card mode. The certificate read is informational. nx does not send a +
-periodic poll after this. Continuous scanning is the reader's own behavior. +
- +
-The ''%%0x0F%%'' Startup frame gates the enables. Sends before it are silently dropped. +
-It does not gate raw UID reading. +
- +
-===== Reader internals ===== +
- +
-The ''%%feig%%'' binary is a 1.6 MB unstripped ARM C++ program. Every IPP opcode maps +
-to a named handler, and the binary carries INIT's source paths under +
-''%%//home/jah/git/init/proxcontroller-feig2/src/%%''. +
- +
-The reader has: +
- +
-  * a multi-application card controller (''%%RFIDReaderMultiApp%%'', ''%%ProxCardCtrl%%'') +
-  * DESFire, Mifare Classic, Ultralight-C, ISO-14443-4, VDV-KA, ITSO, Girogo, and EMV handlers +
-  * a MIFARE SAM AV1/AV2 interface on ''%%0xB6%%'' +
-  * a PKCS#11 HSM on ''%%0xE8%%'' +
-  * an ITSO ISAM path on ''%%0xAC%%''/''%%0xAE%%'' +
-  * EMVCo Entry Point and L2 kernels on ''%%0xD0%%'' +
- +
-Handlers register in their constructors: ''%%IppBaseTelegram%%'' owns ''%%0x02%%'', +
-''%%0x10%%'', the file ops, and ''%%0xAA%%''; ''%%IppHandling%%'' owns ''%%0x04%%'' and ''%%0xCE%%''; +
-''%%ProxCardCtrl%%'' owns ''%%0x32%%'', ''%%0x46%%'', ''%%0xB4%%'', and ''%%0xE4%%''; and the card +
-modules own their own opcodes (''%%ProxCardDesfire%%'' ''%%0xBA%%''/''%%0xBC%%'', +
-''%%ProxCardUltralightC%%'' ''%%0xD4%%'', ''%%ProxCardMifareClassic%%'' ''%%0xEA%%'', +
-''%%ItsoIppHandler%%'' ''%%0xAC%%''/''%%0xAE%%'', ''%%SamCtrl%%'' ''%%0xB6%%'', ''%%EmvIppHandler%%'' +
-''%%0xD0%%'', ''%%GirogoIppHandler%%'' ''%%0xE6%%'', ''%%SecurityServicesIppHandler%%'' +
-''%%0xE8%%''). +
- +
-The card handlers and crypto are present, but the SAM, ISAM, HSM keys, and EMV +
-configuration are not on a surplus unit. That is a key and provisioning +
-limit, not missing firmware. +
- +
-===== Telling transit cards apart ===== +
- +
-At the RF type layer the big agencies look the same. ORCA (Seattle), Compass +
-(Vancouver), Ventra (Chicago), Peggo (Winnipeg), and NFTA Metro (Buffalo) cards +
-are NXP DESFire, so a base-scan frame gives you: +
- +
-  * ''%%ATQA 0x0344%%'' +
-  * ''%%SAK 0x20%%'', meaning ISO14443-4 +
-  * an ATS such as ''%%06 75 77 81 02 80%%'' +
- +
-Nothing in that frame names the agency, the fare product, or the card +
-generation. The UID is the only per-card value, and it is NXP stock, not an +
-agency range. An app that wants to behave differently per agency either keeps a +
-UID list or gets past the type layer. +
- +
-Getting past it does not need the keys. Selecting a DESFire application, or an +
-ISO AID, answers success or "not found" without authentication. A probe for a +
-known transit application therefore tells agencies apart. That needs APDU +
-access, which the base scan does not give you. See ''%%0xD4%%'' below. +
- +
-Some cards are easier. A MIFARE Ultralight answers ''%%ATQA 0x0044%%'', +
-''%%SAK 0x00%%'', and no ATS. An NTAG sticker or an Ultralight key fob lands +
-there and is distinguishable without a list. MIFARE Classic is ''%%SAK 0x08%%'' +
-for 1K and ''%%0x18%%'' for 4K, which is what most older hotel keys use. DESFire +
-transit cards are the ones that look identical. +
- +
-===== 0xD4 UltralightCommand ===== +
- +
-The command is documented, but the host-driven read path does not work well. +
- +
-<code> +
-0x02 Read            [start_page u8][num_pages u8] +
-0x03 Write           [page u8][4 bytes] +
-0x04 Auth raw key    [16-byte key] +
-0x05 Auth key index  [key index, big-endian u16] +
-0x06 Auth index+key  [u16][16-byte key] +
-0x07 Abort           no payload +
-</code>+
  
-Read returns four bytes per page. An NTAG215 is 135 pages, so a full dump is 
-''%%0x02 00 87%%'' and 540 bytes of data. 
  
-The reply is ''%%0xD5 [subcmd][status][payload...]%%'', status 0x00 success, 0x01 no card, +Another one (same payloads as previous but with different ''seq''/''hdrCRC''): 
-0x02 bad parameters. With no card in the field the reader answers +  R:  BCBF00B9000B480C000000048A6EF29B149079CB8CF0 
-''%%[subcmd][0x01]%%'' without attempting the operation.+  H:  BC2400BC0001C4602A714F60 
 +  R:  BCC024BD001E0800000401013300160504010103001605048A6EF29B149020487330305022C98C7E9B 
 +  H:  BC2500BC0004365A2BC3F911A8A56A 
 +  R:  BCC125BD00027401FDE0523164 
 +   
 +   
 +Sample log message: 
 +  BCB000ED0068450330363A34383A3038204572726F723A206665636C725F7472616E7363656976652829206661696C65643A206572726F723A20302C207374617475733A2030783030303030303038200A205B524649445265616465724D756C74694170702E6370703A3135395D0002CD1533BCB100ED0046B40130363A34383A3038207472616E7363656976652065
  
-In practice, ''%%0xD4%%'' returns status 01 on this reader. The reader's internal 
-handler selects the card, runs its own transceive, and releases it in 
-milliseconds. Polling ''%%0xD4%%'' also suppresses the reader's own scan. The reader 
-services host commands or scans autonomously, not both. Use the internal handlers 
-instead: enable the type, let the reader transceive, and read ''%%0xD1%%''/''%%0xB1%%''/''%%0xD5%%''. 
  
-===== Open questions =====+  00000000  bc b0 00 ed 00 68 45 03 30 36 3a 34 38 3a 30 38  |¼°.í.hE.06:48:08| 
 +  00000010  20 45 72 72 6f 72 3a 20 66 65 63 6c 72 5f 74 72  | Error: feclr_tr| 
 +  00000020  61 6e 73 63 65 69 76 65 28 29 20 66 61 69 6c 65  |ansceive() faile| 
 +  00000030  64 3a 20 65 72 72 6f 72 3a 20 30 2c 20 73 74 61  |d: error: 0, sta| 
 +  00000040  74 75 73 3a 20 30 78 30 30 30 30 30 30 30 38 20  |tus: 0x00000008 | 
 +  00000050  0a 20 5b 52 46 49 44 52 65 61 64 65 72 4d 75 6c  |. [RFIDReaderMul| 
 +  00000060  74 69 41 70 70 2e 63 70 70 3a 31 35 39 5d 00 02  |tiApp.cpp:159]..| 
 +  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|
  
-  * What writes ''%%/home/app0/config%%'', and why it is 160 zero bytes. The path does not appear as a string in the app, so it is written by something else or left over from provisioning. 
-  * What ''%%status 0x01%%'' from ''%%0x9C%%'' means, given that the file still reads. 
-  * The three-byte ''%%0xB4%%'' tail: which bits of the flags byte are chaining and which are Le encoding. The length check and field order are known; the bit layout is not. 
-  * How long the idle timeout actually is, since 90 seconds with an open tty was not enough. 
-  * The SAM, ISAM, HSM key provisioning, and the EMV config format. 
  
cvend.1795390955.txt.gz · Last modified: by qkb