| Both sides previous revisionPrevious revisionNext revision | Previous revision |
| nx [2026-01-16 12:28 UTC (11 months ago)] – watchdog->pic32 doof | nx [2026-11-23 02:02 UTC (5 days ago)] (current) – split NxExe from the nx shell, added the .X72 update zip and build steps qkb |
|---|
| NX is the stock UI of the device. | ====== NX ====== |
| |
| It interacts with: | nx is the stock UI and validator, ''%%/init/efad/pgm/NxProx%%''. It opens [[framebuffer|/dev/fb0]], [[alsa|ALSA card 0]], the [[cvend|cVEND reader]] on ''%%/dev/ttymxc3%%'', the [[barcode|barcode scanner]] on ''%%/dev/ttyUSB0%%'', the [[pic32|PIC32]] on ''%%/dev/ttymxc2%%'', and the local ABT API on ''%%127.0.0.1:80%%'' ([[init-abtproxy]]). |
| * [[framebuffer]] | |
| * [[alsa]] | Config lives in ''%%/init/efad/pgm/%%'': ''%%env.ini%%'', ''%%gui.ini%%''/''%%gui.xml%%'', ''%%opscript.nxs%%'', ''%%prox.ini%%'', ''%%pay.ini%%'', ''%%proto.ini%%'', ''%%sto.ini%%'', ''%%nixe.ini%%'', ''%%vendor.ini%%'', ''%%NvValues.ini%%'', ''%%inittab.ini%%'', ''%%out.ini%%'', and ''%%rc5.tab%%''/''%%rc6.tab%%''. ''%%rc5.tab%%'' is the service table. ''%%opscript.nxs%%'' holds the tap policy, result codes, and DCC commands, so fare behavior is scripted rather than compiled. The operator plugin for the ABM1 config is ''%%libnxk_ABM1.so%%''. |
| * [[cvend]] | |
| * [[barcode]] | ===== Stopping and starting ===== |
| * [[pic32]] | |
| * [[init-abtproxy]] | <code> |
| | systemctl stop nx |
| | NxExe watchdog 0 |
| | systemctl stop init-abtproxy |
| | </code> |
| | |
| | On the stock image, ''%%init-abtproxy%%'' is enabled. ''%%nx.service%%'' may be disabled; the unit configuration decides whether it starts. nx feeds the PIC32 watchdog, so stopping it without ''%%watchdog 0%%'' power-cycles the unit about 60 seconds later. Do both in one go. ''%%nx.service%%'' has ''%%FailureAction=poweroff%%'', so a crash can take the unit down; use a ''%%FailureAction=none%%'' drop-in while experimenting. |
| | |
| | To start it again: |
| | |
| | <code> |
| | systemctl start init-abtproxy |
| | systemctl start nx |
| | </code> |
| | |
| | nx stays OUT OF SERVICE without a vehicle address. On a bus it comes from AVL/J1708. On the bench it comes from ''%%vehicle.dat%%'' in the parameter archive or a nonzero ''%%Fahrzeugadresse%%'' in the mounting-plate EEPROM. |
| | |
| | ===== Running it by hand ===== |
| | |
| | <code> |
| | systemctl stop nx |
| | cd /init/efad/pgm |
| | QWS_MOUSE_PROTO=tslib:/dev/input/event0 LD_LIBRARY_PATH=/init/efad/pgm ./NxProx |
| | </code> |
| | |
| | This starts the whole app in the foreground, log on the terminal. The run also starts ''%%NxShellPromptService%%'', the console login. The login needs a password that a surplus unit does not carry. ''%%QWS_MOUSE_PROTO%%'' comes from INIT's template; there is no touchscreen and nx opens no input device. |
| | |
| | Do not leave it running this way. The hand-started copy holds the hardware, so it can block ''%%nx.service%%'' from starting, and it dies with the SSH session. If the watchdog is armed, that powers the unit off. Run it under systemd. |
| | |
| | ===== NxExe and the nx shell ===== |
| | |
| | ''%%/bin/NxExe%%'' is root-only and needs no login. ''%%prox2%%'' handles the board ports: ''%%portinfo%%'', ''%%phy%%'', ''%%prox%%'', ''%%amp%%'', ''%%barcode%%'', ''%%usb%%'', ''%%wlan%%'', ''%%backlight%%'', and raw ''%%read%%''/''%%write%%''. ''%%pic32%%'' reads and writes the PIC32 value keys. The top level also has ''%%eepromdump%%'', ''%%watchdog%%'', ''%%setrtc%%'', ''%%setsystime%%'', ''%%timestamp%%'', ''%%crc%%'', ''%%aes%%'', ''%%fpga%%'', and ''%%pic%%''; run ''%%NxExe%%'' with no arguments for the rest. ''%%NxExe prox%%'' is a separate command for the older external PROX reader and does not initialize against the cVEND reader. |
| | |
| | The nx shell runs on ''%%127.0.0.1:26%%'' (''%%NxRemoteShellService%%'') while nx is up. Starting NxProx in a terminal also gives its login prompt. The login checks an FVSCrypt value provisioned at the factory or operator; that value is not stored on a surplus unit, so root SSH is the practical way in, not the shell. Its familiar commands are ''%%state%%'', ''%%config%%'', ''%%network%%'', ''%%neighbors%%'', ''%%memoryUsage%%'', ''%%reboot%%''/''%%rebootAll%%'', and ''%%extshell <cmd> <timeout>%%''. The rest include ''%%exprfile%%'', ''%%uploadStatus%%'', the LED and clock tests, ''%%list%%'', the ''%%load*%%'' flashers, the VDV-KA session commands, and the ''%%emvPay%%'' sub-shell. Some only exist on other hardware; ''%%loadpic%%'' needs ''%%sc.hex%%'', which is not on the unit. |
| | |
| | ===== In service without the cloud ===== |
| | |
| | nx fetches keys and labels from ''%%http://127.0.0.1:80/v1/device/keys%%'' and ''%%/v1/device/labels%%''. That is normally abtproxy, which will not serve without a Bytemark OAuth token. A local server that returns the cached ''%%/init/abtproxy/keys.json%%'' and ''%%labels.json%%'' on port 80 is enough. |
| | |
| | <code> |
| | systemd-run --unit=keyserve --collect /path/to/your-keyserver |
| | systemctl start nx |
| | </code> |
| | |
| | With those files, nx can go into SCAN/TAP. Raw UIDs do not need them; this is only for nx's handled reads. A server that only returns the two files never talks to Bytemark and needs no credentials. |
| | |
| | ===== ISI and file queues ===== |
| | |
| | ''%%0.0.0.0:51001%%'' is ''%%NxIsiService%%'', an XML interface into the on-board model. ''%%IsiGet%%'' and ''%%IsiRegister%%'' answer any AppName. ''%%IsiPut%%'' and ''%%IsiExecute%%'' are gated per client by ''%%ISIAPP.dat%%'' in the parameter archive, so an unknown AppName can read but not write or execute. |
| | |
| | The IMS file queue is ''%%/init/ims/toveh/%%'', with results in ''%%/init/ims/frveh/%%''. The Kafka telemetry client is dormant. |
| | |
| | ===== Screen states ===== |
| | |
| | OUT OF SERVICE, SCAN/TAP, and a maintenance page. A tap ends in a fare result or a barcode prompt depending on the card and backend. nx drives the cVEND LEDs and buzzer through those transitions. |
| | |
| | ===== The Nx update zip ===== |
| | |
| | ''%%/init/install/archive/%%'' holds the update packages. They are ordinary ZIPs with an ''%%.X72%%'' or ''%%.x72%%'' suffix. The ''%%X%%'' is the data domain; the ''%%72%%'' is the distribution channel from ''%%VertriebsWeg%%'' in ''%%env.ini%%''. A stock one is ''%%V2325.X72%%'', about 11 MB. |
| | |
| | Opening ''%%V2325.X72%%'' gives ''%%NxProx%%'', the config set, ''%%libnxk_ABM1.so%%'', ''%%_install.sh%%'', ''%%arcinfo.dat%%'', and an ''%%abtproxy_installation/%%'' subtree with ''%%proxy_server%%'', ''%%config.json%%'', the systemd unit, and a ''%%.p72%%''/''%%.g72%%'' pair. The app and its config sit at the top level; the abtproxy files are optional. |
| | |
| | ''%%arcinfo.dat%%'' is a small INI. The copy in ''%%/init/efad/pgm/%%'' is the one the next boot compares against: |
| | |
| | <code> |
| | [arcinfo] |
| | KEY:S VALUE:S |
| | DevClass 72 |
| | DataDomain X |
| | BaseVersion 2325 |
| | UpdateVersion 0 |
| | Name V2325.X72 |
| | BaseRef "" |
| | CreationTime 20240702113801 |
| | </code> |
| | |
| | At boot, ''%%/init/tools/initexec.sh%%'' sorts ''%%*.X72%%''/''%%*.x72%%'', takes the version from characters 2-5 of the name (''%%V2325.X72%%'' is 2325), and skips anything below the installed ''%%BaseVersion%%''. It also skips a package if ''%%/init/install/log/<name>.log%%'' exists. Otherwise it unpacks into ''%%/init/tmp/install%%'', runs ''%%_install.sh%%'' there as root, and moves the log into place. A nonzero exit deletes the archive. |
| | |
| | To make one, start with a staging directory holding ''%%NxProx%%'', the configs, and ''%%libnxk_ABM1.so%%'' at the top level. Add an ''%%_install.sh%%'' that runs as root from that directory: |
| | |
| | <code> |
| | #!/bin/sh |
| | PGM=/init/efad/pgm |
| | cp -prf ./* "$PGM/" || exit 1 |
| | rm -f "$PGM/_install.sh" |
| | chmod +x "$PGM/NxProx" |
| | exit 0 |
| | </code> |
| | |
| | Then an ''%%arcinfo.dat%%'' whose ''%%BaseVersion%%'' matches the filename. The next boot reads the installed copy, so keep them in step: |
| | |
| | <code> |
| | [arcinfo] |
| | KEY:S VALUE:S |
| | DevClass 72 |
| | DataDomain X |
| | BaseVersion 2401 |
| | UpdateVersion 0 |
| | Name V2401.X72 |
| | BaseRef "" |
| | CreationTime 20260101120000 |
| | </code> |
| | |
| | Zip the contents, not the directory, with ''%%cd staging && zip -r ../V2401.X72 .%%'', copy it to ''%%/init/install/archive/%%'', and reboot. Check ''%%/init/install/log/V2401.X72.log%%'' afterwards. If it failed, the archive is already gone; fix it, bump the version, and try again. |
| | |
| | A bad ''%%_install.sh%%'' runs as root before the application starts. Keep a known-good copy of ''%%/init/efad/pgm%%'' and of the current ''%%.X72%%'' before testing one. |
| |
| It can be disabled with ''systemctl stop nx''. If you do this, you almost certainly also want to ''NxExe watchdog 0'' so that the PIC32 won't power the system off 60 seconds later. You may also want to ''systemctl stop init-abtproxy''. | |