Files
parking_solution/wiki/raw/dingtian_qr_linux/README.md
T
julian b7efa081ec
Build & push images / images (push) Successful in 3m7s
feat(devices): DT-008 reader discovery + auto-configuration over the vendor UDP protocol
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.
2026-10-08 15:22:33 +02:00

64 lines
3.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Dingtian QR reader – Linux configuration tool
Replacement for the Windows-only `QRCode_v1_6_5.exe` shipped in the Dingtian QR code
reader SDK. Lets you find readers on the LAN, read their configuration and change
network, output-format and behaviour settings from Linux (or any OS with Python 3).
| file | purpose |
|------|---------|
| `PROTOCOL.md` | the reverse engineered UDP protocol: frame format, command list, field tables, 720 byte parameter struct, verification status |
| `dingtian_qr.py` | reference implementation and CLI (`discover`, `info`, `get`, `set`, `set-network`); importable as a module |
## Requirements
* Python 3.6 or newer, standard library only.
* The PC must be on the same layer 2 network as the readers for `discover` and
`set-network` (they use UDP broadcast). `info`, `get` and `set` are unicast and work
across routers.
* Host firewall: allow inbound UDP replies to the tool's socket. Readers reply from
arbitrary source ports, so do not filter on the reader's source port.
## Usage
```
python3 dingtian_qr.py discover --broadcast 192.168.1.255 # list readers (serial, ip, server...)
python3 dingtian_qr.py info 192.168.1.99 # model / firmware / serial
python3 dingtian_qr.py get 192.168.1.99 # full configuration (add --raw for numeric codes)
python3 dingtian_qr.py set 192.168.1.99 --output-type 3 --buzzer 1 --qr-suffix "hex:0d"
python3 dingtian_qr.py set-network --serial HC002721 --ip 192.168.1.50 --netmask 255.255.255.0 \
--gateway 192.168.1.1 --dns1 8.8.8.8 --dns2 8.8.4.4 --server 192.168.1.10 \
--server-port 8080 --http-language 0 --broadcast 192.168.1.255
python3 dingtian_qr.py set --help # every field with its numeric codes
```
`set` reads the current configuration first and only changes the fields you pass; it
then sends the same command sequence as the exe's Set button that owns those fields
(Format group and/or External group). `set-network`
broadcasts and the reader whose serial matches applies the new values, so it also works
for a reader whose current IP is in the wrong subnet.
A factory reset (pin in the RESET hole on the back) returns the reader to 192.168.1.99.
## Using it from your own code
```python
import dingtian_qr as dq
for ip, info in dq.discover(broadcast='192.168.1.255'):
print(info['serial'], ip)
params = dq.get_params('192.168.1.99') # dict, keys documented in parse_params()
params['output_type'] = 3 # HTTP
params['buzzer'] = 1
dq.set_format('192.168.1.99', params) # commands 6,8,10,38,12,14,44,28
dq.set_external('192.168.1.99', params) # commands 40,18,16,22
```
## Caveats
* The DHCP setting cannot be written: the original exe never transmits it (see
PROTOCOL.md), so the reader's behaviour for it is unknown.
* The External commands (buzzer, work mode, fill light, restart interval) were verified
on a real reader. The Format commands and set-network were validated only against
the exe's own packets and a simulated reader. Test on one reader before rolling out.
* Parameter struct words 0x1f4 and the area 0x050–0x197 are not understood (the exe
does not use them either).