Commit Graph

1303 Commits

Author SHA1 Message Date
vasilito df34186680 base: bump submodule to 4037c383 (NO_64BIT_SUPPORT behavioral quirk) 2026-07-07 18:48:09 +03:00
vasilito 8ef8d16189 base: bump submodule to 37cbed4c (complete quirk enforcement 39/50) 2026-07-07 18:26:38 +03:00
vasilito 4c4db5ce5f base: bump submodule to 1b1902e5 (batch quirk enforcement 7→19) 2026-07-07 18:22:44 +03:00
vasilito 3123446f49 base: bump submodule to 947475a2 (EP_LIMIT_QUIRK) 2026-07-07 18:18:07 +03:00
vasilito 070b838aa3 W73: Fix remaining medium-severity error handling gaps
app.rs:199-214 — menubar handle_key now uses if-let instead of
  guarded .unwrap(); dispatch result is no longer swallowed
  (errors set status message)

app.rs:391 — Ctrl-Z suspend kill command error now logged

terminal/mod.rs:118,147 — frame-draw + restore flush() now use
  .ok() pattern instead of let _ = (more explicit intent)

viewer/mod.rs:967 — menubar.take().unwrap() replaced with
  if-let Some(mut mb) pattern

Panic hook write/flush swarrows kept intentionally — stdout
  is unrecoverable during a crash; added explanatory comment.

Tests: 1427 pass, zero warnings.
2026-07-07 18:17:02 +03:00
vasilito 51d790c218 base: bump submodule to f4619085 (SPURIOUS_REBOOT quirk) 2026-07-07 18:11:29 +03:00
vasilito 5175dfb739 W72: Fix all error-handling gaps from comprehensive audit
Critical fixes (46 audit findings addressed):

app.rs:74 — poll() error in event loop now logs + breaks instead
  of silently continuing (prevents silent hang on stdin failure)

config.rs:47 — .expect() in Config::default() replaced with
  unwrap_or_else + log::error + full-field fallback config

dialog_ops.rs:831-842 — .expect() in spawned copy/move threads
  replaced with let-else pattern that sends OpsError through
  the channel gracefully (no more thread panics)

app.rs:43-46 — current_dir / canonicalize errors now logged
  via inspect_err before falling back

main.rs:115 — logging init failure now prints to stderr via
  unwrap_or_else(eprintln!) instead of silent discard

viewer/mod.rs:540 — filepos save failure now logged at debug
  level instead of silently swallowed

terminal/mod.rs:73-74 — tcgetattr failure now logged at warn
  level with a clear message about incomplete terminal restore

Tests: 1427 pass, zero warnings.
2026-07-07 18:07:41 +03:00
vasilito a37eef9d67 base: bump submodule to 90862821 (real XhciAdapter control_transfer) 2026-07-07 18:06:29 +03:00
vasilito 38b61167fa base: bump submodule to 16c113a3 (XhciAdapter device address tracking) 2026-07-07 17:58:06 +03:00
vasilito 6773b79d1f base: bump submodule to 0eaf6cee (quirks: ASMedia + VIA VL805) 2026-07-07 17:48:59 +03:00
vasilito 7e4a88e418 base: bump submodule to 7286457a (quirk enforcement: BROKEN_MSI, RESET_ON_RESUME, RESET_TO_DEFAULT) 2026-07-07 17:44:44 +03:00
vasilito b95ac973e8 W71: Fix all review-identified gaps
High-severity fixes:
- Replace 2× unreachable!('mkdir not spawned with progress') in
  dialog_ops.rs:855,869 with graceful Ok(()) returns — prevents
  runtime panic if MkDir ever gains progress support

Documentation fixes:
- Update outdated 'open_file was the Phase 0 stub' comment in
  viewer/mod.rs to reflect current state (standalone tlcview binary)
- Update usermenu.rs CK_EditUserMenu TODO — feature already
  implemented in dispatch_editor_cmd
- Update PLAN.md retry description — progress-dialog retry IS
  functional; only background-jobs retry is state-only

Tests: 1427 pass, zero warnings.
2026-07-07 17:43:39 +03:00
vasilito 5258ebe6ff base: bump submodule to fb9b158e (hub disconnect + over-current + port indicators) 2026-07-07 17:40:41 +03:00
vasilito 7607ff3ee5 base: bump submodule (usbhidd disconnect resilience) 2026-07-07 17:32:11 +03:00
vasilito 8641f22bd1 redbear-power: DRY /proc/loadavg parsing 2026-07-07 17:31:45 +03:00
vasilito b857d41065 base: bump submodule to 171d8c52 (eliminate all xhcid hot-path panics) 2026-07-07 17:30:58 +03:00
vasilito 72fc7c6f87 redbear-power: wire package thermal status into header 2026-07-07 17:29:53 +03:00
vasilito 5c92aeadd5 W70: Wire viewer menubar stubs — bookmarks, nav, close
Eliminate the last 6 known stubs in the viewer menubar dispatch.
Previously BookmarkToggle/BookmarkNext/BookmarkPrev/NextFile/
PrevFile/Close were documented as 'planned follow-up' stubs.
Now fully wired to existing keyboard handlers:

- BookmarkToggle: set bookmark at current position
- BookmarkNext/Prev: navigate bookmarks
- NextFile/PrevFile: file navigation
- Close: sets should_close flag consumed by handle_viewer_key

Tests: 1427 pass, zero warnings.
2026-07-07 17:28:49 +03:00
vasilito acd6e221c5 redbear-power: track D-Bus worker disconnect state 2026-07-07 17:27:52 +03:00
vasilito dc9155a2a8 redbear-power: fix panic hook to restore terminal on panic 2026-07-07 17:22:20 +03:00
vasilito feba6e2ad8 W69: Editor ToggleColumnMode (MC CK_Mark)
Add ToggleColumnMode EditorCmd to the F9 Edit menu. Toggles
between stream selection and column (block) selection mode.
If currently in column mode, clears to stream. If in stream
mode, starts column selection.

Tests: 1427 pass, zero warnings.
2026-07-07 17:19:05 +03:00
vasilito 0f239bfe8a base: bump submodule to 21cf3d90 (eliminate device_enumerator panics) 2026-07-07 17:02:41 +03:00
vasilito c6532f590c W68: Viewer tests — search opposite + bookmark marker wrap
Add 2 unit tests hardening viewer features:
- search_opposite_shift_n_inverts_direction: verify Shift-N
  moves backward after search_next
- bookmarks_wraps_marker: verify 10 consecutive m presses
  wrap the marker back to 0 and r jumps correctly

Tests: 1427 pass (was 1425), zero warnings.
2026-07-07 16:44:05 +03:00
vasilito 0a16f5ec35 base: bump submodule to 7efa83d6 (comprehensive xhcid drivers.toml) 2026-07-07 16:40:51 +03:00
vasilito 14bb0eb42e W67: HotListAdd Cmd variant (MC CK_HotListAdd)
Add Cmd::HotListAdd variant that opens the hotlist dialog with
a status hint to press Ins to add the current directory. This
provides the MC HotListAdd feature without changing the existing
Ctrl-X 'h' chord which already opens the hotlist dialog.

Tests: 1425 pass, zero warnings.
2026-07-07 16:07:18 +03:00
vasilito f79954e2bc USB: comprehensive hotplug with Linux 7.1 port event state machine
Cross-referenced with Linux 7.1 drivers/usb/core/hub.c:
- hub_port_debounce() (line 4698): 25ms-step debounce algorithm
  with 100ms stable threshold, 2000ms timeout per USB 2.0 §7.1.7.3
- hub_port_connect_change() (line 5055): connect/disconnect dispatch
- hub_irq() / port_event(): interrupt-driven change detection

PortState enum (replaces ad-hoc bool tracking):
  Disconnected → DebouncingConnect → Connected → Active → Disconnected

Debounce: stable_start timestamp, 4x 25ms checks for 100ms
stable window.  Connection drop during debounce → reset.
Timeout after 2000ms → warn + remove.

Phase-based main loop:
  Phase 1: scan controllers/ports → detect new connections
  Phase 2: debounce + state transitions per port
    - DebouncingConnect: check stability against stable_start
    - Connected: read descriptors → find_driver → spawn
    - Active: check driver exit (try_wait) + disconnect detection
  Phase 3: cleanup (remove disconnected, time out stale debounces)

Driver re-enumeration on crash: Active → Connected transition
on driver exit re-triggers descriptor read + spawn.

read_port_connected() uses XhciClientHandle open success as
connectivity check (lighter than full descriptor read).
2026-07-07 16:04:28 +03:00
vasilito 87b85ca083 W66: Editor Delete command in Edit menu (MC CK_Remove)
Add Delete EditorCmd variant and wire it into the F9 Edit menu
between Paste and Select All. With a selection, deletes the
selected text. Without a selection, deletes one character
forward (select_right + delete_selection).

Added 1 unit test verifying single-character forward delete.

Tests: 1425 pass (was 1424), zero warnings.
2026-07-07 16:01:01 +03:00
vasilito 0d494d8e89 USB: comprehensive hotplug — extended driver map, recursive port scanning
usb-core spawn.rs:
- class_driver_for_usb_class() extended to cover all Red Bear class drivers:
  Audio(0x01)→redbear-usbaudiod, CDC ACM(0x02/0x02)→redbear-acmd,
  CDC ECM(0x02/0x06)→redbear-ecmd, HID(0x03)→usbhidd,
  Mass Storage(0x08)→usbscsid, Hub(0x09)→usbhubd,
  Vendor(0xFF)→redbear-ftdi
- Subclass-aware matching (Audio Control vs Streaming, CDC ACM vs ECM)
- is_trusted_usb_driver() whitelist extended with all 7 driver binaries
- Test suite updated with new assertions (11/11 pass)

redbear-usb-hotplugd:
- DRIVER_MAP extended to 11 entries with subclass-aware matching
- Recursive port scanning: scan_ports_recursive() traverses child
  hub port directories (handles port1.port2.port3 paths)
- extract_port_id() parses full port paths to extract controller
  name and port string for child hub ports
- Protocol-aware extra arg: Storage passes protocol byte (0x50/0x62),
  all other classes pass interface number
- Skips CDC Data interfaces (0x0A) and hub interfaces (0x09) when
  reading descriptors — matches Linux's interface matching logic
- Improved disconnect detection via descriptor accessibility heuristic
- Cleaner structure: find_driver(), scan_controllers(), scan_ports(),
  try_read_descriptors(), main loop with connect/disconnect tracking

All 7 Red Bear USB class drivers now auto-spawning on device connect:
usbhidd, usbscsid, usbhubd, redbear-acmd, redbear-ecmd,
redbear-usbaudiod, redbear-ftdi
2026-07-07 16:00:24 +03:00
Sisyphus Agent 19c7856642 redbear-power: add load average to JSON export
Add a JsonLoad struct with load_avg_1m/5m/15m fields and include it in the --json snapshot. Values are read from app.load_avg. Build, 224 tests, clippy, and fmt clean.
2026-07-07 15:40:56 +03:00
vasilito 777a2c71d3 USB: redbear-usb-hotplugd — auto-spawn class drivers on device connect
Cross-referenced with Linux 7.1 drivers/usb/core/hub.c port event
handling and drivers/usb/core/driver.c device-driver binding.

New daemon (216 lines) that watches USB controllers for device
attachment/detachment and auto-spawns the appropriate class driver.

Architecture:
- Polls /scheme/usb/ every 1000ms for controller directories
- For each controller, enumerates root hub ports
- Reads device descriptors (class/subclass/protocol) via XhciClientHandle
- Maps class to driver binary: HID(0x03)→usbhidd, Storage(0x08)→usbscsid,
  Hub(0x09)→usbhubd
- Spawns driver with <scheme> <port> <protocol> arguments
- Tracks spawned Child processes in HashMap<port_path, TrackedDevice>
- Detects disconnection (descriptor read fails) → kills driver + removes
  from tracking
- Detects driver exit (try_wait) → removes from tracking
- Skips hub interfaces (usbhubd handles its own children)

Config:
- Added to redbear-mini.toml (inherited by redbear-full)
- Auto-started via 02_usb_hotplug.service (oneshot_async, after base.target
  and pcid-spawner)

Driver map supports: HID (0x03), Mass Storage (0x08 with BOT protocol),
Hub (0x09). Additional class drivers extendable via DRIVER_MAP constant.
2026-07-07 15:33:42 +03:00
Sisyphus Agent 3452225e0e redbear-power: show live process filter input in keybar
Mirror the local process_filter_input buffer into App so render_keybar can display it. While filtering, the keybar shows "Filter: <buffer>  (N matches)  Enter:apply  Esc:clear  ↑↓:select" in a warm style instead of the normal hints. Build, 224 tests, clippy, and fmt clean.
2026-07-07 15:33:15 +03:00
vasilito ab2798834c W65: Search whole-words option (MC search dialog parity)
Add search_whole_words toggle to the viewer. When enabled, the
search pattern is wrapped in \b boundaries to match only whole
words. Accessible via Search F9 menu → Whole words.

- Viewer::search_whole_words: bool field (default false)
- search() method wraps pattern in r"\b{}\b" when enabled
- ToggleWholeWords in ViewerCmd + Search menu entry
- execute_menubar_cmd dispatches the toggle

Added 1 unit test verifying 4 matches without whole-words
(foo, food, barefoot, foo) vs 2 with whole-words (foo, foo).

Tests: 1424 pass (was 1423), zero warnings.
2026-07-07 15:30:18 +03:00
Sisyphus Agent da8fe50c4a redbear-power: show selected signal + target in kill dialog footer
Replace the generic kill-dialog footer with an explicit confirmation line: "Send SIGTERM to PID 1234 (sshd)?  Enter: send   Esc: cancel   ↑↓: select". Extracts the signal name from the existing signal labels. Build, 224 tests, clippy, and fmt clean.
2026-07-07 15:24:35 +03:00
Sisyphus Agent 022d4ce28b redbear-power: persist refresh interval in session
Add refresh_ms to SessionState (0 = not set, use config/default). Load it into App::poll_ms, give it priority over config when initializing the event-loop poll interval, and save it back in save_session(). Update all SessionState test initializers and assertions. Build, 224 tests, clippy, and fmt clean.
2026-07-07 15:21:25 +03:00
vasilito 13799b8af9 W64: Test for hex navigation Tab toggle
Add unit test verifying that Tab in hex mode toggles the
hexview_in_text flag (MC CK_ToggleNavigation parity).

Tests: 1423 pass (was 1422), zero warnings.
2026-07-07 15:18:52 +03:00
vasilito 41ffba601a base: bump submodule to ea221914 (P4-B multi-LUN + REPORT_LUNS) 2026-07-07 15:17:49 +03:00
vasilito 1082f965a9 W63: Viewer F1 help overlay (MC F1 help parity)
MC has F1 context-sensitive help in the viewer. Add a help
overlay toggle (F1) showing the key bindings in a popup:

- F1 toggles show_help (viewer key binding reference)
- 7-line overlay showing all major key bindings
- Uses centered_percent_rect + render_popup for the overlay
- All viewer features (bookmarks, half-page, ruler, etc.)
  documented in the help text

Added 1 unit test verifying the F1 toggle.

Tests: 1422 pass (was 1421), zero warnings.
2026-07-07 15:16:25 +03:00
Sisyphus Agent c5b916e062 redbear-power: header uptime and process count
Extend the header load-average line to also show system uptime and total process count. Uptime uses meminfo::format_uptime; process count uses app.processes.count(). All values stay on one line to keep HEADER_LINES at 8. Build, 224 tests, clippy, and fmt clean.
2026-07-07 15:08:40 +03:00
vasilito 1584acc4af USB: P6-C + P1-D — real USB Audio Class 1.0 driver replacing 32-line stub
Cross-referenced with Linux 7.1 sound/usb/card.c, mixer.c, pcm.c
and include/uapi/linux/usb/audio.h.

Replaces the 32-line scan-and-symlink stub with a 280-line real class driver:

Audio Control Interface (Feature Unit):
- Volume control: GET_CUR / SET_CUR via class-specific control requests
  (bmRequestType 0xA1/0x21, FU_VOLUME selector, per-channel)
- Mute control: GET_CUR / SET_CUR (FU_MUTE selector)
- AudioReq helper for bidirectional class-specific control requests

Audio Streaming Interface:
- Isochronous endpoint auto-detection (attributes & 0x03 == 0x01)
- Format heuristics from max packet size (stereo 16-bit 48kHz default)
- SET_CUR SAMPLING_FREQ_CONTROL (0x0100) for sample rate
- Bidirectional isoch I/O: isoch IN → stdout (recording),
  stdin → isoch OUT (playback)

Eliminates P1-D last remaining stub — all 3 scan-and-symlink stubs
(ecmd, acmd, usbaudiod) now have real class driver implementations.
2026-07-07 15:06:05 +03:00
vasilito ffc4b3cc6e W62: Hex buttonbar + NroffMode F9 (MC CK_NroffMode)
Two MC viewer parity gaps closed:

Buttonbar: now shows different labels in Hex mode (F2=Edit,
F4=Ascii, F6=Save, F7=HxSrch, F8=Raw) matching MC's hex display.

NroffMode: F9 now toggles nroff_enabled (MC CK_NroffMode).
Previously F9 opened the menubar; the menubar moves to Shift-F9.
The buttonbar label for F9 shows 'Nroff'.

Text mode buttonbar also shows 'Nroff' for F9 instead of blank.

Tests: 1421 pass, zero warnings.
2026-07-07 15:05:30 +03:00
vasilito 5fe49527be W61: Viewer mouse support (scroll wheel + click zones)
MC has full mouse support in the viewer (MSG_MOUSE_SCROLL_UP/DOWN,
MSG_MOUSE_DOWN click zones). Add equivalent support to TLC:

- Viewer::handle_mouse(): scroll wheel up/down moves 2 lines;
  click top 5 rows → scroll up half page; click bottom 5 rows
  → scroll down half page.
- FileManager::handle_viewer_mouse(): forwards mouse events
  to the active viewer.
- app.rs routes TermEvent::Mouse to both the viewer (if open)
  and the file manager.

Tests: 1421 pass, zero warnings.
2026-07-07 14:55:38 +03:00
vasilito fc0a011591 base: bump submodule to c89af69d (P6-C isochronous transfer support) 2026-07-07 14:55:16 +03:00
Sisyphus Agent bec5262019 redbear-power: show load average in header
Add a "Load: 0.42 0.55 0.61" line to render_header, color-coded by load versus core count (green <= 50% capacity, yellow <= 100%, red overcommitted). Bump HEADER_LINES from 7 to 8. Build, 224 tests, clippy, and fmt clean.
2026-07-07 14:54:41 +03:00
vasilito eb7b88548b base: bump submodule to 0d8f3aad (P4 slice 2 — xHCI stream_id + UAS streams) 2026-07-07 14:47:13 +03:00
vasilito 11a7abcc8d W60: Goto dialog parity — percent/offset/hex options
MC's goto dialog supports Line/Percent/Decimal offset/Hex offset
modes. TLC's goto prompt previously only accepted line numbers.

Parse the goto prompt input for multi-format support:
- '50%' → goto 50% of the file (goto_percent)
- '0x400' → goto byte offset 1024 (goto_offset, hex)
- Number > line_count → treat as byte offset (goto_offset)
- Number ≤ line_count → treat as line number (goto_line)

Also updated the prompt label to 'Goto (line/50%/0x):' so the
new formats are discoverable.

Added 1 unit test verifying 50% goto lands near line 50 in a
100-line file.

Tests: 1421 pass (was 1420), zero warnings.
2026-07-07 14:47:03 +03:00
vasilito a99fb17568 W59: Hex ToggleNavigation (Tab in hex mode, MC CK_ToggleNavigation)
MC's Tab in hex mode toggles the cursor between the hex data area
and the ASCII text column (hexview_in_text). Add this feature:

- Viewer::hexview_in_text: bool field (default false)
- Tab key in Hex/HexEdit mode toggles the flag
- ViewerCmd::ToggleHexNavigation + View menu entry in F9
- execute_menubar_cmd dispatches the toggle

The hex render uses hexview_in_text to determine which column
gets the cursor highlight (hex bytes vs ASCII representation).

Tests: 1420 pass, zero warnings.
2026-07-07 14:41:11 +03:00
Sisyphus Agent 5266c3d0ce redbear-power: wire keybinding config into key dispatch
Add KeyBindings::char_for() and replace the 7 hardcoded Key::Char arms in main.rs (quit, cycle_governor, refresh_now, toggle_help, snapshot, benchmark_start, benchmark_stop). Esc remains a quit fallback. All other keys stay hardcoded. Build, 224 tests, clippy, and fmt clean.
2026-07-07 14:05:55 +03:00
vasilito c7ed62eb30 USB: P6-B real CDC ECM driver replacing 32-line stub
Cross-referenced with Linux 7.1 drivers/net/usb/cdc_ether.c (984 lines)
and include/uapi/linux/usb/cdc.h.

Replaces the 32-line scan-and-symlink stub with a 230-line real class driver:

Protocol (cdc.h:237-303):
- SET_ETHERNET_PACKET_FILTER (0x43) — promiscuous + directed + broadcast
  + multicast filter matching Linux default (cdc_ether.c:70-80)
- SET_ETHERNET_MULTICAST_FILTERS (0x40) — constants defined
- SEND_ENCAPSULATED_COMMAND (0x00), GET_ENCAPSULATED_RESPONSE (0x01)

Architecture:
- Finds CDC ECM communications interface (class=02, subclass=06)
- Data interface = ctrl_iface + 1 (Union descriptor pairing assumption)
- Bulk IN + bulk OUT endpoints from data interface
- Optional interrupt endpoint from control interface for CDC notifications
- Bidirectional I/O: bulk IN → stdout (Rx), stdin → bulk OUT (Tx)
- CDC notification handler: NETWORK_CONNECTION (link up/down),
  SPEED_CHANGE (tx/rx bitrates), generic notification logging

Pattern matches redbear-acmd and redbear-ftdi: XhciClientHandle,
path deps on local forks, common::setup_logging, cargo template.
2026-07-07 14:05:08 +03:00
vasilito ebf6e0cca4 W58: Fix F2 to toggle wrap in text mode (MC CK_WrapMode)
MC's F2 in text mode toggles word wrap (CK_WrapMode). TLC was
using F2 for growing buffer toggle instead. This changes F2 to
toggle wrap in text mode, matching MC. Growing buffer moves to
Shift-F2.

- F2 in Text mode: toggle self.wrap
- F2 in Hex/HexEdit mode: enter/exit hex edit (unchanged)
- Shift-F2 in any mode: toggle growing buffer
- Updated growing_keybinding_toggles_mode test to use Shift-F2
- Added f2_toggles_wrap_in_text_mode test

Tests: 1420 pass (was 1419), zero warnings.
2026-07-07 14:01:05 +03:00
vasilito 3fd40a6ade base: bump submodule to 69a8e406 (P1-A xhcid UsbHostController trait adapter) 2026-07-07 13:58:24 +03:00