fix(nfc): make the Bolt Card reader an opt-in machine capability #115
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/nfc-opt-in"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The douro has been hard-wedged since it was flashed, and this is why.
nfc-pcsc's pcsclite binding does not fail when pcscd isn't running — it retriesSCardEstablishContextin a tight loop on the calling thread, which is Electron's main thread. Measured on the douro: 76,011 failingnewfstatat("/run/pcscd/pcscd.comm")in 6 seconds, main thread pinned at its 80% CPUQuota ceiling for 11 hours, renderer a zombie that was never reaped, nothing in the journal after[StateStore], and SIGTERM ignored sosystemctl stophad to time out and SIGKILL. The watchdog couldn't help: all three layers need the event loop that's blocked.pcscd was enabled in
hardware/batm3.nixandhardware/upboard.nix, which can't express "is a reader fitted" —upboard.nixis shared by sintra (OMNIKEY 5022) and tejo (nothing fitted), so tejo inherited pcscd it has no use for, while the douro, with its own hardware file, got none and wedged.Two commits:
services.bitspire.nfc.enableowns pcscd, the polkit rules and the wedge-recovery unit, and hands the appBITSPIRE_NFC_ENABLEDso it doesn't initialise nfc-pcsc at all without a reader. Per-model truth isnfcReaderForModelin flake.nix, next tofiatCodeForModelandupgradeWindowForModel. batm3 and sintra true; douro and tejo flip when readers are fitted.The flag goes through the unit's
Environment, not/var/lib/bitspire/.env— .env is only written when absent, so an already-provisioned machine would never pick up a new value.Verified:
pcscd/BITSPIRE_NFC_ENABLED/nfc-reader-resetevaluate true for batm3-installed and sintra-installed, false for douro-installed and tejo-installed. tsc clean on the electron tsconfig, nfc-service tests pass, prettier clean.Behaviour is unchanged on batm3 and sintra, but note batm3 can't pick this up yet — its nightly upgrade has been failing since Sep 24, filed separately.