Commit Graph

30 Commits

Author SHA1 Message Date
Robert McMahon 957078039d Fi-Wi: site setup, relay module, map/SSH consolidation
- Add site_setup entry (root shim + fiwi.site_setup) with SiteSetupApp and in-process
  relay/calibrate; FiWiRelayBootstrapApp in fiwi_relay/relay_app.py.
- CLI: run_panel_calibrate, parse_panel_calibrate_argv, shared BrainStem load helper;
  fiber_map_io.resolve_calibrate_ssh_targets for one merge of calibrate SSH hosts.
- Maps default under maps/; config and remote_ssh.env.example updates; concentrator
  and panel calibrate fixes; radiohead refactor; tests/docs refresh.
- Remove fiber_radio_port.py (unused example), empty fiwi_link stub, orphan peak_detect.reflex.

Made-with: Cursor
2026-04-04 18:18:27 -07:00
Robert McMahon 93cd346a07 Panel calibrate UX, check_concentrator extras, power summary AC hint
- Panel calibrate: Ctrl-C saves map during patch panel; skip/quit aliases (s/skip/., q/quit/exit); clearer prompts and help.
- PCIe prompt: s/skip keeps metadata; note Ctrl-C in calibrate.
- check_concentrator: --panel-calibrate, --inrush and options; compact Power line with 120V/220V AC amp hint from total W.
- docs/brainstem-sdk.md: find How_To_Build.txt examples.

Made-with: Cursor
2026-04-03 16:33:44 -07:00
Robert McMahon a488dc2ed0 Add Reflex CLI, inrush Reflex program, and hub stem discovery
- Wire fiwi.py reflex (help/doc/which/compile) through reflex_lang.py; discover arc and Reflex includes from BRAINSTEM2_DEV_ROOT and repo brainstem_sdk paths.
- Add reflex/inrush.reflex, compile script, reflex/.gitignore for generated .map files.
- Add tests/check_inrush.py; extend tests/check_concentrator.py.
- FiWiConcentrator: prefer defs.model_name(spec.model) stem class, then legacy MODEL_* order, then alternate 3p/3c/2x4 retries.
- Add fiwi_link/fiwi_relay package entrypoint stub.

Made-with: Cursor
2026-04-03 15:54:26 -07:00
Robert McMahon 0b4de5ba67 Vendor BrainStem Linux SDK tarball and document unpack/build
Track only the official .tgz under brainstem_sdk/; ignore extracted trees.
Add docs/brainstem-sdk.md with untar steps, udev, C++ examples, and Reflex/arc notes.

Made-with: Cursor
2026-04-03 15:48:02 -07:00
Robert McMahon 442774b976 check_concentrator: Power(N) ON count; per-port mA, V, W columns.
- Summary line uses Power(N) where N is ports with metrics power ON.
- Port table drops Pwr column; add W column; widen mA; remove executable bit drift.

Made-with: Cursor
2026-04-03 15:01:03 -07:00
Robert McMahon 3ea65d9271 check_concentrator: panel order, Power totals line; README + post-commit hook.
- Port table: sort by panel; Power: Total W / mA (per port follows) as sole header;
  dash alignment; fiber_map panel column unchanged.
- Add README.md with git hook setup; githooks/post-commit (opt-in push + remote pull);
  scripts/install-git-hooks.sh sets core.hooksPath.

Made-with: Cursor
2026-04-03 14:54:40 -07:00
Robert McMahon 31485b0019 check_concentrator: panel column, dash alignment, powercycle per-port snapshot.
- Per-port table: leading Panel column from fiber_map.json (hub/port/ssh vs consolidated rows).
- Match separator line lengths to table headers; shared _CONSOLIDATED_HUB_HDR / _PER_PORT_PWR_HDR.
- Extract _print_per_port_power_table; run after --powercycle with title override.
- Location/USB column labeling and per-port table layout tweaks.

Made-with: Cursor
2026-04-03 14:35:10 -07:00
Robert McMahon 63bb205383 check_concentrator: USB identity column, TTY in Location, powercycle test.
- usb_probe: sysfs scan for 24ff hubs (bus/dev, VID:PID, strings) plus ttyUSB/ttyACM;
  usb_acroname_hub_identity_list(); usb-hub-tty-json returns full records.
- check_concentrator: Location stays host+TTY; new USB column (lsusb-style line);
  enrich via local sysfs and remote usb-hub-tty-json per SSH host.
- Add --powercycle: all ports OFF/verify then ON/verify (local + remotes), restore on failure.

Made-with: Cursor
2026-04-03 14:11:35 -07:00
Robert McMahon 64a3e5a604 cli: emit fiwi: start only when stderr is a TTY.
Avoids interleaving the banner with captured stdout (e.g. SSH
port-metrics-json and check_concentrator table output).

Made-with: Cursor
2026-04-03 13:39:55 -07:00
Robert McMahon 6a4fc3dfee Add port-metrics-json CLI and per-port metrics in check_concentrator.
Expose FiWiConcentrator.port_metrics_snapshot() for machine-readable
per-port power, current (mA), and voltage (V). Add fiwi.py
port-metrics-json for SSH checks. check_concentrator prints a second
table aligned with the consolidated hub list; stale remotes get
upgrade instructions when the subcommand is missing.

Made-with: Cursor
2026-04-03 13:36:53 -07:00
Robert McMahon 91818781df check_concentrator: single hub table with Location (local vs remote IP).
Collect local rows via concentrator discovery; parse remote show_hostcards tables;
renumber globally. Location is 'local' or resolved IPv4 (fallback host string).

Made-with: Cursor
2026-04-03 13:23:55 -07:00
Robert McMahon f3e514ffdf check_concentrator: consolidated local + remote USB hub report.
Single banner, SSH summary aligned with check_remote, one USB section with
local hostcards then each remote show_hostcards, PCIe catalog last; exit 1
if any remote SSH run fails.

Made-with: Cursor
2026-04-03 13:19:36 -07:00
Robert McMahon 8427176974 Fix SSH remote bash -lc: one quoted argv for sh -c.
OpenSSH runs the remote command through sh -c with space-joined words; passing
bash, -lc, and an if/then/fi script as separate argv tokens broke discover
and stdbuf wrapper. Use bash -lc with shlex.quote(inner) as a single token;
apply in SshNode, probe_remote_hub_readiness, and FiWiRelay._ssh_argv.

Made-with: Cursor
2026-04-03 13:16:55 -07:00
Robert McMahon 1a01a63a5d Rename test scripts: check_remote.py and check_concentrator.py.
Former tests/test_read_remote.py and tests/test_concentrator_instantiate.py; update
docstring examples and pytest entry test_concentrator.

Made-with: Cursor
2026-04-03 13:14:37 -07:00
Robert McMahon bca18ecf1e Line-buffer remote fiwi output: stdbuf + reconfigure stdout/stderr.
SSH remote command uses stdbuf -oL -eL when available so libc-backed I/O
flushes on newlines; fiwi.py enables line_buffering on TextIO stdout/stderr
for Python prints over pipes.

Made-with: Cursor
2026-04-03 13:11:46 -07:00
Robert McMahon 066dbc1d39 SSH remote fiwi: run Python with -u for captured stdout over pipes.
Without a TTY, libc/BrainStem output can stay block-buffered while the SSH
client captures the remote stdout pipe, so discover could exit 0 with an
empty transcript. Unbuffered mode fixes test_read_remote and invoke_capture.

Made-with: Cursor
2026-04-03 13:09:01 -07:00
Robert McMahon 91a2bee58b Consolidate SSH and hub relay under fiwi; improve remote readiness tooling.
Move SSH transport into fiwi.ssh (replacing fiwi.ssh_node) and add fiwi.fiwi_relay
with FiWiRelay for venv and pip bootstrap over SSH or locally. Update imports,
docs, and remote_ssh.env.example for python -m fiwi.fiwi_relay.

Extend test_read_remote with a single-SSH readiness probe (brainstem via
FIWI_REMOTE_PYTHON and env/bin/python3), clearer setup hints, and --list-only.
Add probe helpers on fiwi.fiwi_relay.host and unittest for marker parsing.

Merge [remote_hubs] hosts in config INI; set uax24 remote_python to the hub
venv after relay setup.

Made-with: Cursor
2026-04-03 13:04:24 -07:00
Robert McMahon 179477702f SSH remote: ~/ paths via $HOME; discover hub/port table; test_read_remote
- ssh_node: quote remote python/script so tilde expands (remote_path_bash_word)
- config: remote_python python3 by default; Pi ~/Code/FiWiManager script paths
- tests/test_read_remote.py: probe + discover; timeouts; vendor-neutral labels
- concentrator: always print Hub|Serial|Ports after discover/show_hostcards; infer
  port counts from stem class when connectFromSpec fails
- Docs/strings: USB power-control wording; requirements comment; usb_probe doc

Made-with: Cursor
2026-04-03 12:05:34 -07:00
Robert McMahon c361cbf17d config: Pi paths ~/Code/FiWiManager; venv python; SSH bash -lc for remote tilde
Made-with: Cursor
2026-04-03 11:45:08 -07:00
Robert McMahon 5b04560241 Rename harness to FiWiConcentrator; config profiles and smoke test
- Replace FiWiHarness with FiWiConcentrator (fiwi/concentrator.py); update CLI, exports, and docs.
- Add config/default.ini, uax24.ini, uax4.ini under config/ with paths, patch_panel default_ports, remote_ssh, and [remote_hubs] hosts; load via fiwi.config (FIWI_CONFIG profile). Merge FIWI_REMOTE_HUBS with FIWI_CALIBRATE_REMOTES in SshNodeConfig.
- Extend fiwi.paths: configure loads remote_ssh.env then INI; fiber_map_path respects FIWI_FIBER_MAP; add config_dir().
- CLI: GNU-style global options (getopt + SSH shield), show_hostcards / show_radioheads, help text updates.
- patch_panel: default_panel_ports from env; adnacom print_adnacom_host_card_table.
- tests/test_concentrator_instantiate.py: --config, local + remote show_hostcards inventory.
- Example map/SSH strings use rjmcmahon@192.168.1.39; remote_script points at ~/Code/FiWiManager/fiwi.py in profiles.
- .gitignore: drop root fiwi.ini; document config layout.

Made-with: Cursor
2026-04-03 11:35:24 -07:00
Robert McMahon e9ddcd7b2b docs: FiWiManager example path; drop hub_manager references
Use FiWiManager in remote_ssh.env.example. Remove obsolete hub_manager
mentions from design and CLI docs.

Made-with: Cursor
2026-03-30 18:18:50 -07:00
Robert McMahon a030549f61 feat(fiwi): Fi-Wi package, SSH transport, diagnostics, and docs
Replace the hubmgr layout with the fiwi package and fiwi.py entry point.
Add SshNode with deferred remote subprocess overlap, async capture helpers,
and a central diag timeline (dmesg, lspci, kernel-dump event placeholder).

Document design, CLI, and test/automation authoring under docs/.
Refresh fiber_map.example.json and remote_ssh.env.example; widen .gitignore
for Python tooling and local operator files.

Made-with: Cursor
2026-03-30 18:16:57 -07:00
Robert McMahon 86e73bcff2 Calibrate: PCIe while port ON, Ctrl-C save; fix remote ON tracking.
- Keep hub port powered through fiber id + PCIe prompts; power off after.
- Ctrl-C saves fiber_map.json, turns off current port, exits 130; handle during PCIe.
- Remote calibrate: set step_powered only when SSH on succeeds; skip step if remote
  ON failed (was incorrectly treating failed ON as powered).
- power() returns False when hubs cannot connect; CLI on/off exits 1 so SSH sees failures.
- remote_hub_port_power: merge stdout+stderr for diagnostics; ssh_forward_capture uses stdin=DEVNULL.
- Warn when calibrate_remotes yields zero remote steps; clarify remote_ssh.env.example.

Made-with: Cursor
2026-03-29 18:15:13 -07:00
Robert McMahon 6d2fb4b957 Calibrate PCIe metadata, Adnacom catalog, hybrid calibrate env.
Add optional fiber_ports.pcie (board_serial, sfp_serial) and PCIe column in
panel/fiber status. During panel calibrate, prompt to pick known H3 cards 1–6
and SFP lane 1–4 from adnacom_pcie_catalog, or manual/clear/keep.

HUB_MANAGER_CALIBRATE_REMOTES in remote_ssh.env merges into calibrate SSH
hosts so one panel calibrate run can cover local and remotes without repeating
--ssh. Document in remote_ssh.env.example and help.

Made-with: Cursor
2026-03-29 17:36:05 -07:00
Robert McMahon e7869dd9f2 Refactor hub manager into hubmgr package for maintainability.
Move AcronameManager, CLI, fiber map I/O, USB probe, remote SSH, and path
configuration into hubmgr/. hub_manager.py only configures map paths next to
the script and delegates to hubmgr.cli.main. Clarify remote_ssh.env.example
for Pi-side paths. Add fiber_map and panel_map example presets.

Made-with: Cursor
2026-03-27 18:33:55 -07:00
Robert McMahon 4ecf1c00b9 fiber panel calibrate 2026-03-27 18:10:07 -07:00
Robert McMahon 00bd562d25 mapping 2026-03-27 17:18:45 -07:00
Robert McMahon 0d90434ee4 Add hub discovery, panel map, SSH remote helper, and Pi deps.
Support USBHub2x4 and USBHub3p discovery with correct downstream port counts,
patch-panel mapping via panel_map.json, lazy brainstem import and diagnostics,
SSH forwarding with optional remote_ssh.env defaults, and requirements.txt
for brainstem. Ignore local panel_map.json, remote_ssh.env, and __pycache__.

Made-with: Cursor
2026-03-25 22:44:56 -07:00
Robert McMahon 4b9010de87 add discovery 2026-03-25 17:33:16 -07:00
Bob McMahon 2650ca4b5e first commit 2026-03-07 15:59:12 -08:00