The tile that shows up on its own — and disappears just as fast
Log 1 closed with a promise: hotplug, and how a screen's tile appears the instant its dongle is plugged in and vanishes the instant it isn't. That behavior is what makes the home grid trustworthy — you never wonder if a tool is available, you just look. Here is how it works.
Why not udev rules and hope
The obvious tool for USB presence is udev: write a rule, get an event, react
to it. Scottina does not use it for tile visibility. devices.py polls
sysfs instead — cheap, no pyudev dependency, no rule files to keep in sync
across a Pi image rebuild. The launcher calls refresh() a few times a
second, and the tile grid shows a device's tile only while the check comes
back positive. Simple beats clever here: one function, one data source, one
place to look when a device does not show up.
A catalog of USB ids, and their opinions
Each device screen is gated on a set of (vendor, product) USB ids —
SDR_IDS for the RTL2832U dongles, ALFA_IDS for the Wi-Fi sniff adapter,
CANABLE_IDS for candleLight/gs_usb boards, FTDI_IDS for the serial
adapters. Most of these are a clean lookup. A few are not:
- The FX2LP logic analyzer changes identity mid-session. It enumerates
as a bare Cypress bootloader until firmware loads, then re-enumerates
under an fx2lafw id.
FX2LA_IDSmatches both, plus a couple of Saleae/ USBee clone EEPROM ids, because a board scanned once this session is sitting in its post-load state and the tile still has to recognize it. - CanTick shares its vendor id with every ESP32 board on the market. Espressif's VID is not enough to identify anything. Presence detection matches the USB product string instead — and on the ESP32-S3, that string is not even the firmware's own name; the built-in USB-serial-JTAG reports the fixed hardware string "USB JTAG/serial debug unit" regardless of what firmware is flashed. A string-less descriptor counts too, since that is what a fresh, unconfigured board reports.
None of this is guesswork. Every id in the table is a fact recorded on the
bench with the actual device in hand, not a datasheet guess — the comments
in devices.py say so, including the date for the CanTick case.
The tile follows the truth on the panel
Fixed screens — LAN Scan, Wi-Fi, Pi Health — are always on the grid. Device
tiles are not: they appear only while refresh() finds their id present,
and they carry a small green "live" badge so it is obvious at a glance which
tools are physically available right now versus which ones would need a
dongle first. Unplug the RTL-SDR mid-session and its tile is gone on the
next poll, no stale entry pointing at hardware that is not there anymore.
Adding a device is a known recipe, not a one-off
This pattern gets reused every time a new piece of hardware joins Scottina.
The logic-analyzer integration is the clearest recent example: Phase 2 of
that work is nothing but "add the FX2LP ids to devices.py using the same
mechanism the other screens use, gate the new screen's tile on that
presence, done." No new detection framework, no special case in the
launcher — just another entry in the same table. That reuse is the actual
payoff of building the mechanism once and keeping it boring.
Next log: what happens after a tile is tapped and the tool is a web app — how Scottina waits for Node-RED or Kismet to actually answer on their port before it tells you where to point a browser, instead of guessing that a spawned process is a serving one.
Scottsky
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.