summaryrefslogtreecommitdiff
path: root/test/hil/tinyusb-sudoer
AgeCommit message (Collapse)Author
2026-07-07usbtest: negotiated-speed int/iso refill + harden HIL sudoershathach
Copilot review: - tud_vendor_int_tx_cb/iso_tx_cb submitted sizeof(chunk) (the HS-capacity buffer) instead of the negotiated-speed mps, diverging from usbtest_pump() on an HS-capable build enumerated at full speed. Factor the length into shared usbtest_int_len()/usbtest_iso_len() helpers used by the pump and both callbacks. - Reword the usb_descriptors.h comment that still called the plain mps macro 'live operating speed' — it is the compile-time capability maximum. Claude review (test/hil/tinyusb-sudoer): drop the two grants that bypassed the file's root-owned-helper boundary and gave uid 1000 passwordless root: - /sbin/debugfs (unused; permits '!/bin/sh' shell escape + raw root-disk write). - /home/*/actions-runner/svc.sh (user-writable script). Replace with a root-owned, argument-restricted 'systemctl stop/start actions.runner.*' grant. Also tighten the dmesg/uhubctl runas from (ALL) to (root). Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HeF2gZ1M7GWkz6Av4BpKPg
2026-07-07address Codex/Copilot review findings (9 fixed, 3 refuted with evidence)hathach
- dcd(rp2040): rewind IN staging before the clear-halt re-issue. Staging advances user_buf/remaining_len when packets are copied into DPRAM, before the host has consumed them; aborting and re-issuing from the advanced pointer silently skipped the staged-but-unsent bytes. - dcd(ip3511): dcd_edpt_iso_activate aborts a transfer still armed from the previous altsetting (clear Active on both buffer slots) so the hardware can't keep servicing the old descriptor against the class's fresh queueing. - dcd(rusb2): reuse an endpoint's existing pipe in dcd_edpt_open. usbd_edpt_close is a no-op on ISO_ALLOC ports, so a class's close/open across SET_INTERFACE would allocate a second pipe with the same EPNUM and leak pipes. - class(vendor): the buffered-mode free-slot check also tests the interrupt endpoints, so an interrupt-only vendor interface isn't clobbered as "free". - bsp(ch32v30x): board_get_unique_id respects max_len and copies bytes (alignment-safe) instead of writing 12 bytes through a uint32_t cast. - test/hil/usbtest.py: treat same-serial multi-matches as ambiguous and retry until the dual-port stale node drops (nanoch32v203/ch32v307 variants); reprobe a binding that predates the dynamic-id re-registration so a stale capability profile can't survive; skip the remove_id/unbind cleanup after an unrecovered kernel-side hang (it would join the D-state convoy and deadlock the bus). - usbtest skip.txt: add the families whose DCD refuses dcd_edpt_iso_alloc (CXD56, FT90X, LPC175X_6X, LPC40XX, NUC100/120/505, PIC32MZ, SAMG, SAMX7X, VALENTYUSB_EPTRI) — tier 4 cannot enumerate there. - test/hil/tinyusb-sudoer: note that '#1000' is a sudoers UID specifier, not a comment (the review misread the grants as commented out). Refuted in review threads: nrf5x ISOSPLIT keeps reserve-max per-configuration allocation semantics (iso_alloc is per-config, not per-alt); the LPC EP-number claim (default descriptor uses EP1-3; lpcxpresso11u37 passes 30/30 on HW); the vendor alt-0 "abort" concern (host cannot address endpoints outside the active altsetting; usbd_edpt_iso_activate resets state on re-entry). Verified on hardware: raspberry_pi_pico, lpcxpresso11u37, ra4m1_ek all 30/30 through the HIL battery after the changes; builds clean incl. buffered-mode vendor (webusb_serial). Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HeF2gZ1M7GWkz6Av4BpKPg
2026-07-04hil: harden rig USB recovery (pci-bind, --force reboot, sudoers)hathach
usb_recover.sh: add `pci-bind <addr> [drv]` to re-attach a driver to a controller left driverless (e.g. after a pci-rebind whose re-bind hung on an unkillable D-state URB); auto-tries xhci-pci-renesas then xhci_hcd. usb-recover skill: document the Renesas uPD720201 pci-reset ENOTTY (no FLR), the pci-rebind-strands-driverless footgun, and reboot as the last-resort D-state cure with an @reboot one-shot session auto-resume. Recovery reboot uses `systemctl reboot --force` -- a graceful reboot stalls in shutdown waiting for the wedged D-state process to exit; --force reboots immediately. tinyusb-sudoer: grant `systemctl reboot --force` (and plain reboot), the actions- runner svc.sh stop/start around manual HW runs, and testusb; grants stay generic- by-UID (#1000). usb-debug skill: sync the deploy one-liner. Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_01HeF2gZ1M7GWkz6Av4BpKPg
2026-07-03docs(hil): svc.sh is sudoers-allowed; run it from the runner roothathach
Add the actions-runner/svc.sh NOPASSWD grant to test/hil/tinyusb-sudoer and correct the hil skill: svc.sh must be invoked from ~/actions-runner (cd first) or it errors 'Must run from runner root'. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HeF2gZ1M7GWkz6Av4BpKPg
2026-07-03usbtest: FS-sized ep buffers + host runner hardeninghathach
- example: interrupt/iso endpoint buffers track the per-speed max packet size instead of a fixed 512, saving ~1.6 KB of USB DMA RAM on FS builds. - test/hil/usbtest.py: re-resolve the device node after a mid-battery re-enumeration (stale node was misreported as NOTRUN); reject an out-of-range tier (a tier-0 device would run an empty battery and read green); validate --tests case numbers; run cleanup in a try/finally so a crash can't leave the dynamic id registered to hijack the next device; guard set_pattern and the pci-reset placeholder; report a sudo-password failure on the testusb fallback instead of a misleading NOTRUN. - tinyusb-sudoer: allow the foreign-driver unbind path and the testusb fallback used by the runner. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HeF2gZ1M7GWkz6Av4BpKPg
2026-07-02docs: version HIL rig tooling in-repo with deploy instructionshathach
- test/hil/tinyusb-sudoer: consolidated sudoers grants (deploys to /etc/sudoers.d/tinyusb-sudoer), documenting what each grant is for - usb-recover skill: version usb_recover.sh under scripts/, deploy section - new usb-debug skill: usb_dyndbg.sh (allowlisted kernel dynamic-debug toggle for USB host modules) + workflow and deploy instructions Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HeF2gZ1M7GWkz6Av4BpKPg