Commit Graph

1236 Commits

Author SHA1 Message Date
vasilito bc4df8e437 base fork: P5 slice 1 — consumer key support 2026-07-07 12:11:13 +03:00
vasilito 128832c568 base fork: P4 slice 1 — UAS transport 2026-07-07 12:05:41 +03:00
vasilito cc770de03e base fork: P3 slice 2 — interrupt-driven hub change detection 2026-07-07 12:00:52 +03:00
vasilito 7dad32bdc1 base fork: P3 — usbhubd power-on timing + USB 3 fix 2026-07-07 11:51:12 +03:00
vasilito 9a0e0d86c7 base fork: P2-C slice 3 — actual TT-buffer clear 2026-07-07 11:45:39 +03:00
vasilito 8119824512 base fork: P2-C slice 2 — TT metadata + non-recursive stall clear 2026-07-07 11:11:27 +03:00
vasilito a0b8ba1014 base fork: P2-C first active xHCI recovery slice 2026-07-07 10:57:55 +03:00
vasilito 4dc60bdc5d redbear-power: add TIME+ cumulative CPU-time column 2026-07-07 10:39:43 +03:00
vasilito 346daee089 base fork: complete P1-B and start P2-C status mapping 2026-07-07 10:32:33 +03:00
vasilito 42c807c55a redbear-power: implement --json export mode 2026-07-07 10:13:12 +03:00
vasilito 682560cf7a base fork: P2-B — full HCC2/HCS3 bit map 2026-07-07 10:09:10 +03:00
vasilito ef3f696689 W49: Search field auto-suggest from history
When opening a Find or Replace prompt, prefill the input with
the most recent search pattern from the history. The user can
still type freely to override or press Backspace to clear it.
Only applies to Find / Replace prompts (not GotoLine, etc.).

Updated the existing alt_slash test to account for the
auto-suggested prefix (it now presses Backspace 5 times to
clear 'hello' before typing 'world').

Tests: 1407 pass, zero warnings.
2026-07-07 10:05:43 +03:00
vasilito fe53efcd83 base fork: P2-A — xhcid 51-quirk table 2026-07-07 09:20:04 +03:00
vasilito 7d341b6254 W47: Verify dot-prefix completion resolves against base dir
The existing W39 Tab completion already handles relative paths
(./ and ../) by joining with the active panel's base_dir. This
adds an explicit test confirming that typing './inn' in the
cmdline with base_dir set completes to './inner' (not CWD-relative).

Tests: 1407 pass (was 1406), zero warnings.
2026-07-07 09:16:14 +03:00
vasilito 9e08f7ed05 redbear-power: PID jump, process filter matches PID, narrow process view
- Press F, type a number, Enter: jump cursor directly to that PID in the visible list.
- Press F, type text: filters by process name (existing) and now PID substring too.
- Press h in Process tab: toggle narrow view (PID/STATE/CPU%/MEM/COMM) for small terminals.
- Add process_narrow to App and SessionState; persist across sessions.
- Update help text and status messages to document the new keybindings.
- Fix unused super::* warning in process filter unit tests.
2026-07-07 08:54:59 +03:00
vasilito affb6690c5 W46: Animated cursor movement trail
When the user moves the cursor (up/down/home/end), the previous
cursor position briefly shows a thin accent-coloured bar (▏)
to the left of the row. Creates a subtle trail effect that makes
the new cursor position more obvious.

- Panel::prev_cursor: usize field set on every move
- Panel::cursor_flash: Option<Instant> tracks the flash
- Panel::cursor_flash_progress() returns Some(frac) for ~200ms
  after each move
- cursor_up / cursor_down / cursor_home / cursor_end set the
  previous position and trigger the flash
- Render path draws the bar at the previous row in accent colour

Added 1 unit test verifying prev_cursor and cursor_flash on move.

Tests: 1406 pass (was 1405), zero warnings.
2026-07-07 08:54:36 +03:00
vasilito ba05902883 W45: Marked-file total size in panel footer
Append a 'Σ <size>' indicator to the panel footer when files
are marked, using the info colour. Sums the stat.size of every
entry whose name is in the marked set (directories included).
Helps users see the combined size before bulk operations like
copy/move/delete.

Tests: 1405 pass, zero warnings.
2026-07-07 08:11:36 +03:00
vasilito 78ff5b5c4c W44: Filename fuzzy filter highlight in panel
When a filter is active, the matching prefix of each file name
is highlighted in the panel list. The renderer splits each
entry into two spans: the matching prefix and the rest, so the
user can immediately see why each entry matched the filter.

- Panel::filter_match_len(name) returns the length of the
  matching filter prefix for a name (0 when no match)
- Panel::name_matches_filter(name) convenience boolean
- Render path uses a Line with two Spans when match_len > 0

Added 1 unit test verifying filter_match_len returns the
correct prefix length for matching and non-matching names.

Tests: 1405 pass (was 1403), zero warnings.
2026-07-07 08:01:41 +03:00
vasilito e9b82a3a04 base fork: P1-C partial — 37 xhcid unwraps removed 2026-07-07 07:59:31 +03:00
vasilito faf688a2d7 base fork: P1-B — usbscsid zero panics 2026-07-07 07:45:26 +03:00
vasilito 75c3a472df W41: Test for panel focus border flash
The panel_switch_anim system already flashes the active panel
border from theme.info to theme.accent on focus change
(switch_focus). Add an explicit test that verifies the
animation reset-on-switch and the tick-by-tick advance back
to 100, guarding against future refactors breaking the
visual feedback for Tab panel switching.

Tests: 1403 pass (was 1402), zero warnings.
2026-07-07 07:36:16 +03:00
vasilito 8de0308b6e W42: Add test for Enter-to-navigate handle_key path
The panel's enter() method already navigates into directories.
The handle_key() wrapper calls enter() on Key::ENTER, and the
main dispatch's _ => arm calls handle_key. Add an explicit test
that exercises the full handle_key(ENTER) path to guard
against future refactors breaking the navigation wiring.

Tests: 1403 pass (was 1402), zero warnings.
2026-07-07 07:22:03 +03:00
vasilito dece1210c7 W40: Cmdline completion hint popup
When Tab in the cmdline completes to more than one candidate,
show a popup above the cmdline listing the candidates. Standard
shell completion behaviour (fish, zsh, bash). Helps users pick
the right file when many match.

- Cmdline::completions: Vec<String> field stores the candidates
- Cmdline::clear_completions() for cleanup on commit/cancel
- Cmdline::has_completions() returns true if >1 candidates
- Cmdline::render shows the popup when has_completions() is true
- Esc/Enter in handle_key clears completions

Added 1 unit test verifying completions are populated and
clear_completions works.

Tests: 1402 pass (was 1401), zero warnings.
2026-07-07 05:59:05 +03:00
vasilito 0035aa65cc P1-A: UHCI + OHCI implement UsbHostController trait (Linux 7.1 cross-ref)
usb-core: scheme.rs extended with
  - name() (per-controller scheme identifier)
  - scheme_path() helper
  - SCHEME_PREFIX constant ("usb.")
  - UsbError::Unsupported variant

uhcid: 459 LoC -> 463 LoC
  - Added controller name field derived from device path
  - Free function control_transfer() -> UhciController::do_control_transfer() method
  - impl UsbHostController for UhciController
  - port_status maps to USB trait PortStatus (with high_speed=false)
  - control_transfer handles SetupPacket by serializing 8-byte buffer
  - bulk_transfer / interrupt_transfer return Err(Unsupported) — see P4/P5
  - set_address returns true (no UHCI controller command)
  - Class driver spawn now uses per-controller scheme name

ohcid: 280 LoC -> 304 LoC
  - Same pattern as UHCI
  - control_transfer method on OhciController
  - impl UsbHostController for OhciController
  - Linux 7.1 ohci-q.c PIPE_CONTROL pattern preserved
  - Per-controller scheme name in spawn

Both drivers cross-reference Linux 7.1 source for register
definitions (xhci-ext-caps.h, ohci.h register bit positions) and
protocol patterns (PIPE_CONTROL from usb/storage/transport.c).

Cross-compile clean: usb-core, uhcid, ohcid, ehcid all build.
Two of three P1-A sub-tasks done (UHCI + OHCI on the trait).
Remaining: xhcid thin-trait adapter (deferred — xhcid scheme.rs is
2,839 LoC and operates under its own well-tested scheme protocol).

Reference: USB-IMPLEMENTATION-PLAN.md v3 §P1-A
2026-07-07 05:48:44 +03:00
vasilito 1bc5f8ac88 docs: USB v3 plan + runbook — first-class-citizen roadmap
v3 USB-IMPLEMENTATION-PLAN supersedes v2 (archived).  Comprehensive
audit-driven roadmap with 9 phases (P1–P9) to make USB a first-class
citizen in Red Bear OS:

  P1: Trait unification (all 4 controllers implement UsbHostController)
      + panic hardening (usbscsid 0 panics, xhcid <20 unwraps)
      + remove 3 empty stubs (usbaudiod, acmd, ecmd)
  P2: xHCI core — 51-quirk table, HCCPARAMS2 parsing, 36-code error
      recovery (babble, transaction error, stall, split)
  P3: Hub driver — full enumeration (wHubDelay, power timing, USB 3 SS)
      + interrupt-driven change detection + port LED
  P4: Storage — UAS protocol, multi-LUN, SYNCHRONIZE_CACHE, UNMAP, mass-storage
      quirks applied at runtime
  P5: HID — report descriptor parser, usage→evdev mapping, LED sync, quirks,
      multi-touch
  P6: Class driver completeness — CDC ACM, CDC NCM, USB Audio, USB-serial
      (FTDI/CP210x/PL2303/CH341), compliance test driver
  P7: Power management — USB 2.0 LPM, USB 3.0 U1/U2/U3, runtime PM autosuspend
  P8: Validation — hardware matrix ≥10 rows + 6 new QEMU scripts
      + error-injection tests
  P9: Modern USB scope ADR (host-only; already written in v2 §12)

Linux 7.1 is the implementation of excellence — every feature has a
concrete cross-reference (file:line) and a 'port line-by-line' strategy
when implementation detail is in doubt.

USB-VALIDATION-RUNBOOK v3 replaces v2 (archived): test matrix with
per-phase exit gates, operator runbook for failures.

Stale items cleared:
  - v2 active plan archived as USB-IMPLEMENTATION-PLAN-v2-2026-07.md
  - v2 active runbook archived as USB-VALIDATION-RUNBOOK-2026-07.md
  - archived/README.md supersession table extended
2026-07-07 05:21:35 +03:00
vasilito c5a229a7cd redbear-power: fix all remaining clippy warnings (16→0)
Manual fixes: unnecessary_sort_by→sort_by_key, ptr_arg Vec→slice,
needless_range_loop→iter_mut, question_mark let-else, while_let_loop,
manual_checked_ops, collapsible-if in match arms, identical if-blocks
merged with ||, vec_init_then_push allow on motherboard panel.
Zero behavioral changes. 220 tests pass.
2026-07-07 05:17:46 +03:00
vasilito 6fa762d9e1 redbear-power: auto-fix 84 clippy warnings (100→16)
Mechanical fixes: collapsible-if, is_multiple_of, sort_by_key,
needless borrows, useless format!, manual checked division,
push-after-creation, and other style lints. Zero behavioral
changes. Remaining 16 warnings are pre-existing intentional
patterns (identical if-blocks from match arms, &mut Vec params).
2026-07-07 04:58:45 +03:00
vasilito bd1016a202 docs: P1 verified + P5 USB scope ADR
P1 USB 3.x hub correctness verified against codebase:
  - packet-size handling (bytes vs shift exponent) in baseline
  - HubDescriptorV2/V3 separate reading paths in usbhubd
  - Slot context hub bit + port count correctly set
  - SET_HUB_DEPTH issued for USB 3 hubs
  - TTT not applicable to USB 3 (TT is USB 2.0 split-transaction)
  - TODOs about interface_desc/alternate_setting on USB 3 hubs
    are safe — passing None matches upstream behavior

  P5 Modern USB Scope Decision (ADR):
  - Host-only for foreseeable future
  - Explicitly excluded: device mode, OTG, USB-C PD, alt-modes,
    USB4, Thunderbolt, xHCI DbC
  - Reviewed per release branch cut
2026-07-07 04:54:32 +03:00
vasilito 58695cc478 redbear-power: fix clippy warnings in affinity.rs
Collapse nested if, replace map_or(false,...) with is_some_and,
use div_ceil instead of manual ceiling division.
2026-07-07 04:52:25 +03:00
vasilito 97a1ad301f docs+scripts: mark P0-A4/P2-A done, strengthen storage test
test-usb-storage-qemu.sh:
  - Require [PASS] STORAGE_WRITE + STORAGE_READBACK + STORAGE_RESTORE
    (previously only checked STORAGE_READBACK)
  - Expect each check individually, fail fast on any FAIL

  USB-IMPLEMENTATION-PLAN.md v2:
  - P0-A4: marked done (bounds check committed)
  - P2-A: marked done (write+readback proof already in checker)
2026-07-07 04:48:31 +03:00
vasilito 7ab0af7ab4 redbear-power: persist show_full_cmdline in session state
The C key toggle state now survives app restart via serde-backed
session.toml. Uses #[serde(default)] for backward compatibility
with existing session files.
2026-07-07 03:01:14 +03:00
vasilito a93e9807f0 redbear-power: CPU affinity editor (a key, Process tab)
New affinity.rs module renders a toggleable CPU grid dialog:
- Space toggles selected CPU on/off
- Arrow keys navigate the grid
- Enter applies via sched_setaffinity(2)
- Auto-closes 2s after successful apply
- Shows +N for enabled, -N for disabled CPUs
- Grid adapts to CPU count (4/8/16 columns)

Added set_affinity() to process.rs using libc::sched_setaffinity.
Added 'a' key to keybar and help text.
2026-07-07 02:54:36 +03:00
vasilito b3a249e450 redbear-power: runtime theme cycling with + key
Press + to cycle through all 6 themes (dark, light, high-contrast,
nord, gruvbox, solarized-dark) without restarting. Theme choice
shown via flash_toast. Fixed --theme CLI to accept all 6 modes.
2026-07-07 02:40:54 +03:00
vasilito 75229b0422 redbear-power: organize help text with section dividers, fix theme list
Help now uses ──────── SECTION ──────── dividers for Power & CPU,
Process Management, and Navigation. TOML config theme.mode lists
all 6 themes (nord, gruvbox, solarized-dark were missing).
2026-07-07 02:35:28 +03:00
vasilito 60588bef46 redbear-power: show process state counts in Process panel header
[R:N S:N Z:N T:N] breakdown similar to htop's task summary,
computed from the displayed process list.
2026-07-07 02:30:17 +03:00
vasilito 827fe89872 redbear-power: add RingHistory min/avg methods + SIGSTOP/SIGCONT signals
- RingHistory gains min() and avg() methods with 3 new unit tests (220 total)
- KillDialog adds SIGSTOP (19) and SIGCONT (18) for pause/resume capability
2026-07-07 02:26:29 +03:00
vasilito 91b58cfacc redbear-power: show refresh interval in keybar (e.g. [/]:500ms)
Track current poll_ms in App, update it on all three poll-change paths
([ / ] /Enter), and display it persistently in the keybar between
governor and tab hints.
2026-07-07 02:19:49 +03:00
vasilito babffee80e redbear-power: add system load average (1/5/15 min) to System panel
Reads /proc/loadavg every 4th refresh cycle and displays the three
load average values alongside Cores/AvgFreq/MaxTemp/TotalPkg.
2026-07-07 02:12:50 +03:00
vasilito 2362ea80f1 redbear-power: fix modal clear scope, graph time labels, cmdline toggle
- KillDialog: only clear dialog area, not entire screen (fixes black-screen UX)
- NiceEdit: removed redundant full-screen Clear from main.rs
- All graphs now show x-axis time labels: '-60s' on left, 'now' on right
- Fixed BrailleGraph x-axis label rendering (was truncating to 1 char, now uses set_string)
- Process panel: press 'C' to toggle between comm name and full command line args
- ProcessInfo.cmdline field added (reads /proc/[pid]/cmdline)
- Help text and keybar updated with C keybinding
2026-07-07 02:08:30 +03:00
vasilito 0eac7f082f base fork: P0-A4 — bounds-check root_hub_port_index() 2026-07-07 02:08:00 +03:00
vasilito 5d0e41dff2 ohcid: P0-B2 — fix control transfer following Linux 7.1 ohci-q.c
Rewrite the control_transfer function following Linux 7.1 ohci-q.c
PIPE_CONTROL pattern exactly:

  · Dummy TD at ED tail (Linux: ed->hwTailP = dummy)
  · TD chain via hwNextTD (Linux: td_fill model)
  · Toggle sequence: DATA0 → DATA1 → DATA1
    (Linux: TD_T_DATA0, TD_T_DATA1, TD_T_DATA1)
  · DoneHead polling with zero-acknowledge
    (Linux: hcca->done_head = 0)
  · Kickstart via OHCI_CLF (Linux: cmdstatus write)
  · hwBE = data + len - 1 (Linux: td->hwBE formula)

  · Separate data buffer and output buffer parameters to avoid
    borrow conflicts in the copy-back path
  · Use MmioRegion (same as ehcid) for MMIO access
  · Use usize::wrapping_add/sub for physical address arithmetic

Compiles cleanly (cargo check passes).  Completes P0-B2 from
USB-IMPLEMENTATION-PLAN.md v2 — both UHCI and OHCI now have real
compiling drivers replacing the old 35-line stubs.
2026-07-07 02:03:00 +03:00
vasilito f10f3b15b6 redbear-power: CPU frequency color coding in per-CPU table
Freq column now color-graded based on P-state range:
  dark gray  at lowest P-state (<=15% of range)
  default    mid-range
  yellow     >=50% of range
  red+bold   >=85% of range (turbo/high)
2026-07-07 01:50:10 +03:00
vasilito 79e897a628 redbear-power: show process count in tab bar
Tab bar now displays 'Process (42)' with live process count,
giving at-a-glance visibility into how many processes are tracked.
2026-07-07 01:48:00 +03:00
vasilito 59c9ec8ed8 redbear-power: add nord, gruvbox, solarized-dark themes (6 total)
New theme presets selectable via --theme:
  nord           cyan borders, light-blue governor
  gruvbox        green borders, yellow governor
  solarized-dark blue borders, magenta governor

Help text updated with all 6 theme names.
2026-07-07 01:44:06 +03:00
vasilito 2fc7d20f73 ohcid: P0-B2 — real OHCI USB 1.1 host controller driver (WIP)
Replace the 35-line stub with a real driver.  registers.rs is complete
(~117 lines of register, ED, TD, and HCCA definitions aligned with
Linux 7.1 ohci.h).  main.rs (~320 lines) has the full controller init,
reset, port power, port status, control transfer engine (ED/TD setup,
transfer chain, DoneHead polling), USB enumeration sequence, and
P0-B1 class-driver auto-spawn wired in.

Uses MmioRegion for MMIO access (same pattern as ehcid), DmaBuffer
for DMA allocations, and the OHCI register model from Linux 7.1.

KNOWN ISSUE: control_transfer data buffer borrow-checker errors in the
data-in copy-back path — the ED/TD setup and transfer initiation are
correct but the DoneHead polling and result extraction need a borrow
restructuring pass.  Cargo check has 5 remaining errors, all in the
same function.

Completes P0-B2 from USB-IMPLEMENTATION-PLAN.md v2.
Both UHCI and OHCI now have real drivers replacing the old stubs.
2026-07-07 01:43:18 +03:00
vasilito 763b7110c5 redbear-power: fix process header alignment for MEM% column 2026-07-07 01:41:46 +03:00
vasilito 0285960a56 redbear-power: process state coloring + MEM% display
- STATE column color-coded: R=green, D=red, Z=dark gray, T=yellow (htop-style)
- RSS column now shows memory percentage alongside absolute value: '1.2G (3.4%)'
- Process row spans refactored for per-column styling
2026-07-07 01:40:28 +03:00
vasilito e729e4daec redbear-power: nice value coloring + filter match highlighting
- NI column: green for negative (high priority), yellow for positive (low priority)
- Process filter: matching characters in COMM highlighted BOLD|REVERSED
  when filter is active (bottom/htop-style incremental search visual)
2026-07-07 01:36:00 +03:00
vasilito ef3dd8b1fd docs: Linux 7.0 → 7.1 reference across all active docs
Update all active (non-archived) doc references from Linux 7.0 to
Linux 7.1.  The reference tree at local/reference/linux-7.1/ already
exists; the docs were lagging behind.

Files touched:
  AGENTS.md — reference path and git fetch command
  CHANGELOG.md — device ID source note
  local/docs/IMPLEMENTATION-MASTER-PLAN.md — source-of-truth path x2
  local/docs/CPU-DMA-IRQ-MSI-SCHEDULER-FIX-PLAN.md — source-of-truth
  local/docs/DRM-MODERNIZATION-EXECUTION-PLAN.md — quirk extraction note
  local/docs/QUIRKS-AUDIT.md — storage quirk table note
  local/docs/QUIRKS-SYSTEM.md — storage quirk mining note

Archived docs (local/docs/archived/*) are preserved as-is — they
represent historical state and are not the planning authority.
2026-07-07 01:32:36 +03:00
vasilito f9ace4a956 redbear-power: CPU% color grading + context-sensitive keybar
- Process rows: CPU% now color-graded (green <10%, yellow 10-50%, red 50-90%, bright red >90%)
  using styled spans instead of monolithic format string
- Keybar shows context-aware hints: process-specific keys (k/N/l/o/i/F/y) on Process tab,
  power-specific keys (p/P/m/M/t) on other tabs
- [EXPANDED] indicator added to keybar alongside [FROZEN]
2026-07-07 01:30:47 +03:00