The Dingtian DT-008's Windows-only config tool speaks a small binary UDP protocol (reader :24680 unicast get/set, :24582 broadcast search/set-network), reversed in wiki/raw/dingtian_qr_linux (PROTOCOL.md + dingtian_qr.py, copied to scripts/). Reading park-2's readers with it from the booth found both in WG26 output mode — the "beeps but captures nothing" enrolment failure: they never pushed HTTP at all. The app now speaks the protocol itself (packages/devices dingtian-qr-config.ts, Node dgram, host-network container) and the dingtian-qr-reader driver uses it: - discover(): first driver to implement the wizard's Scan capability; rows show serial, IP, output mode, current server target, card format, firmware. - preconditions: output type must be HTTP (fixable — save switches it); typed serial must equal the reported one and the reader must answer on UDP (both block the save). - configureInputPush(): set-network the reader's server to this booth's IP + listen port, confirmed by polling (the reader applies it without an ack and is silent for seconds). - usesPushAuth=false: the scan GET carries no credentials, so no push secret is stored. - a reader saved without an IP warns instead of failing (legacy vendor-tool setup). Verified on the bench unit: WG26→HTTP, target 8080→8081→8080, struct byte-identical after. 15 protocol tests against a fake reader + 17 adapter tests. Wiki: device-discovery, first-run-setup, dingtian-dt008-reader, site-device-installation §2 (SSH procedure; the "needs a Windows laptop" claim withdrawn), new source page dingtian-qr-linux-tool.
5.4 KiB
type, tags, sources, updated
| type | tags | sources | updated | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| source |
|
|
2026-10-08 |
Source: Dingtian QR reader — Linux configuration tool + reversed UDP protocol
raw/dingtian_qr_linux/ (README.md, PROTOCOL.md, dingtian_qr.py; October 2026). A
reverse engineering of QRCode_v1_6_5.exe (qrcode-sdk) — static analysis of the Qt binary
plus captures against the bench reader HC002721 and a fake reader — and a dependency-free
Python 3 replacement for the Windows tool. The script is copied to scripts/dingtian_qr.py
for use on booths. Entity: dingtian-dt008-reader; runbook: site-device-installation §2.
Why it matters
Until now a DT-008's settings (IP, server target, output type, prefixes, card format) could only
be read or changed with the vendor's Windows exe on a laptop plugged into the device VLAN. The
exe's "Search device" / "Get parameter" / "Set" are a small binary UDP protocol; get and
set are unicast, so they run from the booth itself over SSH/Netbird. The 2026-10-08
park-2 enrolment failure (site-device-installation §2 trap) was diagnosed in one command
this way instead of a site visit.
Protocol (PROTOCOL.md §2–4)
- Frame:
'XXXX'+ id u32 + cmd u32 + len u32 + checksum byte (0xFF − Σpayload) + payload; all little-endian. Even cmd = request, reply = cmd+1. - Quirk: the exe sends header and payload as two datagrams; a single-datagram frame is silently ignored by the reader. The script mimics this.
- Ports: reader listens on 24680/udp (unicast: 0 firmware info → 64 B, 30 get params → 720 B struct, every write) and 24582/udp (broadcast: 2 search → 3 with a 96 B DeviceInfo, 32 set-network matched by serial). Replies come from arbitrary source ports — a host firewall must allow inbound UDP to the tool's socket.
- Writes: one small command per field group (6 output type, 8 card input format, 10 enter/
newline, 38 serial+QR format, 12/14 QR prefix/suffix, 44 card output+prefix/suffix, 28 Wiegand
pulses; 40 fill light, 18 work mode, 16 restart interval, 22 buzzer). Ack = cmd+1 with one
status byte (0 applied immediately, 1 rejected). The exe's Format Set button sends 6, 8, 10,
38, 12, 14, 44, 28 back to back; External Set sends 40, 18, 16, 22;
setreproduces whichever group owns the changed field, after reading the struct so untouched fields are re-sent as-is. - Enumerations on the wire: output type 1 USB keyboard, 2 USB serial, 3 HTTP, 4 MQTT, 5 RS232, 6 WG26, 7 WG34, 8 RS485, 9 AC Output, 10 TCP; card input 1 6H, 2 8H, 3 8H10D, 4 6H10D, 5 2H3D+4H5D; HTTP language 0 PHP, 1 JSP, 2 C#, 3 ASP, 4 CGI.
- IPv4 fields are little-endian u32 (bytes of
inet_atonreversed). - DHCP is never transmitted by the exe (its set-network code overwrites the DHCP word with the serial) — the combobox has no effect; the script cannot write it either.
- Not understood: Params
0x1f4and the reserved area0x050–0x197(probably MQTT/TCP settings). Symbologies are not in this protocol (the exe has no such field) — the phantom-read fix in dingtian-dt008-reader still has no known configuration path.
Verification status
- By the author: search/info/get and the ack format captured from the real reader; the write payloads matched against the exe talking to a fake reader; commands 18, 22, 40 proven on the real reader by diffing the struct.
- Ours, 2026-10-08, bench
HC002721@10.0.10.12:set --output-type 6then--output-type 3— all eight Format commands acked with status 0, the diff of the 720 B struct was exactly byte0x198(3 → 6 → 3), final struct byte-identical to the original. So the full Format sequence (6, 8, 10, 38, 12, 14, 44, 28) is now proven on real hardware too. - Ours, park-2, read-only from the booth over SSH: both readers answered
info+get(HC009E84@.7,HC00D3B0@.8, firmwarever_client1_1.1, chipv3s, hwh42). - Still unverified on a real reader:
set-network(cmd 32).
In the app
packages/devices/src/drivers/dingtian-qr-config.ts is a TypeScript port of the protocol
(frame, DeviceInfo/Firmware/Params codecs, two-datagram writes, discover, set-network) with a
fake-reader test suite; reader.ts uses it for the DT-008 driver's discover(),
preconditions and configureInputPush() (first-run-setup, device-discovery). Extra
hardware facts learned while wiring it (2026-10-08, bench HC002721): cmd 6 alone (no Format
group) is accepted and applied; set-network is applied but never acknowledged, and the
reader answers nothing for ~2–6 s afterwards (poll the params; the driver waits up to 12 s);
the Python and TS tools build byte-identical set-network payloads.
Usage (from a booth)
python3 -I scripts/dingtian_qr.py discover --broadcast 10.0.10.255 # LAN search (same L2 only)
python3 -I scripts/dingtian_qr.py get 10.0.10.7 # full config, human-readable
python3 -I scripts/dingtian_qr.py get 10.0.10.7 --raw --hexdump # numeric codes + 720 B dump
python3 -I scripts/dingtian_qr.py set 10.0.10.7 --output-type 3 # HTTP mode (reads first, re-sends the Format group)
Booth hosts ship Python 3 (park-2: 3.14); copy the one file over scp and run it on the host
(the server container has no Python). Readers are per-site on 10.0.10.x; set-network needs the
L2 broadcast, so it works from the booth but not across Netbird.