homelabby/internal/usb
Mikkel Georgsen 82eaf6bed7 feat(04-01): USB Manager goroutine-per-device, poll loop, reconnect, leak-safe teardown
- Manager with injectable enumerateFunc and serialOpener for test isolation
- goroutine-per-device model: deviceLoop owns one serial port per device
- context+done-channel teardown: inner read goroutine exits on ctx.Done()
- Read buffer capped at 4096 bytes (T-04-01 threat mitigation)
- Poll loop reconciles prev/current snapshots for connect/disconnect events
- ErrDeviceNotConnected returned by Send() when device absent
- All 5 manager tests pass with -race flag; goroutine count stable across 5 replug cycles
- mockPort test helper blocks Read until Close() unblocks it (realistic behavior)
2026-04-10 06:45:26 +00:00
..
device.go feat(04-01): USB device types, KnownDevices registry, VID/PID enumeration 2026-04-10 06:43:43 +00:00
device_test.go feat(04-01): USB device types, KnownDevices registry, VID/PID enumeration 2026-04-10 06:43:43 +00:00
enumerate.go feat(04-01): USB device types, KnownDevices registry, VID/PID enumeration 2026-04-10 06:43:43 +00:00
manager.go feat(04-01): USB Manager goroutine-per-device, poll loop, reconnect, leak-safe teardown 2026-04-10 06:45:26 +00:00
manager_test.go feat(04-01): USB Manager goroutine-per-device, poll loop, reconnect, leak-safe teardown 2026-04-10 06:45:26 +00:00
mock_port_test.go feat(04-01): USB Manager goroutine-per-device, poll loop, reconnect, leak-safe teardown 2026-04-10 06:45:26 +00:00