Commit Graph

1051 Commits

Author SHA1 Message Date
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
vasilito 2061609f62 redbear-power: live graph labels, sort indicator, toast for governor/throttle
- Graph titles now show live values: 'CPU 45%', 'Temp 62°C', 'Pwr 8.3W', etc.
- Process panel shows sort direction arrow (▲ ascending / ▼ descending)
- Governor cycle and throttle mode now trigger flash_toast (floating box)
  instead of flash_status (keybar only)
- BrailleGraph.title changed from &str to String for dynamic titles
2026-07-07 01:26:56 +03:00
vasilito d9368b08b2 userutils: bump submodule to remove login prompt diagnostics 2026-07-07 01:20:43 +03:00
vasilito b48410cbf5 redbear-power: stage event.rs deletion + process.rs whitespace cleanup 2026-07-07 01:06:15 +03:00
vasilito d5c8498ac3 redbear-power: add nice editor (N), open files (l), remove dead event.rs, bench auto-stop toast
- nice_edit.rs: modal dialog for adjusting process nice (-20..19), slider visualization
- open_files.rs: reads /proc/[pid]/fd, classifies file descriptors by type
- Removed dead event.rs module (never wired, unused Event enum)
- Benchmark auto-completion: detects elapsed >= duration, calls stop(), flashes toast
- PROCHOT toast trigger wired in app.rs
- Help text updated with N and l keybindings
- 217 tests pass, 0 warnings, 4.1 MB LTO release binary
2026-07-07 01:00:13 +03:00
vasilito f7f2890f4e ehcid: P0-B1 — xhcid-compat scheme paths + auto-spawn class drivers
Add xhcid-compatible path aliases to the EHCI scheme handler so that
class daemons (usbhubd, usbhidd, usbscsid) can successfully open an
XhciClientHandle on scheme "usb".

  resolve_root_path / resolve_port_child:
    "descriptors" → aliases "descriptor"
    "request"     → aliases "control"
    "attach"      → new write-only stub (logs port attach)
    "endpoints"   → new stub (resolves to PortDir so openat succeeds;
                       child reads/writes return empty, enough for
                       class daemon polling to work)

  Directory listing updated with the new entries.

  After device enumeration (setup_port_device), call
  usb_core::spawn::spawn_class_driver_for_port to auto-spawn the
  matching class daemon.  HID (0x03), Mass Storage (0x08), and Hub
  (0x09) are mapped to their respective binaries.

This is P0-B1 from USB-IMPLEMENTATION-PLAN.md v2.  Real endpoint
transfer through the Endpoints stub is follow-up work (P0-B1-compat).
2026-07-07 00:58:03 +03:00
vasilito 0ae101fdd0 usb-core: add class_driver_for_usb_class and spawn_class_driver_for_port
P0-B1 spawn infrastructure from USB-IMPLEMENTATION-PLAN.md v2.

Add two new public functions to usb-core::spawn:

  class_driver_for_usb_class(class, subclass, protocol) -> Option<&str>
    Maps USB class codes to driver binary paths:
      0x03 -> /usr/bin/usbhidd   (HID)
      0x08 -> /usr/bin/usbscsid  (Mass Storage)
      0x09 -> /usr/bin/usbhubd   (Hub)

  spawn_class_driver_for_port(...args...)
    Spawns the correct class daemon with the right argv layout:
    - HID/Hub:   <scheme> <port> <interface_num>
    - Storage:   <scheme> <port> <protocol_byte>

The existing spawn_usb_driver is preserved for backward compatibility.
Both new functions have no_std stubs so the crate still compiles without
the std feature.

Next: wire the spawn call into ehcid after device enumeration (P0-B1
call site) + add xhcid-compatible scheme paths (descriptors/request/
endpoints/attach) to ehcid's scheme handler so the spawned daemons can
open XhciClientHandle successfully.
2026-07-07 00:51:54 +03:00
vasilito f99738d2fb userutils: bump submodule (login diagnostics) + redbear-power/tlc WIP
userutils: commits login/getty diagnostic logging.
redbear-power: toast notification storage + set_nice syscall helper + render WIP.
tlc: cmdline tab-completion improvements.
2026-07-07 00:44:31 +03:00
vasilito 05bb9095ce docs: USB-IMPLEMENTATION-PLAN.md v2 — mark P0-A1 done + P0-A2..B2 handoff
Update §5 phases table: P0-A1  committed (base fork cbd40e0d, parent
a2998c2d).

Update §6 validation table: test-xhci-irq-qemu.sh now greps for actual
reactor log lines (not fictitious strings).

Update §7 durability log: base fork now has two USB commits (one from
P0-A1), not one.  The "first USB-focused commit since dd08b76" is
now cbd40e0d.

Add §11 — implementation handoff appendix with per-phase concrete
targets: upstream commit SHAs, files to touch per phase, git-landing
rules, validation scripts to write, and dependency graph (P0-B2 depends
on P0-B1; P0-A2 through P0-A4 are independent of B; P0-B1 is unblocked).
2026-07-07 00:44:31 +03:00
vasilito 33465b59e0 test-xhci-irq-qemu.sh: grep for actual xHCI reactor log lines
The old --check section looked for log strings that do not exist in the
xhcid codebase ("xhcid: using MSI/MSI-X interrupt delivery" etc.).
All six grep patterns were fictitious — the script was written ahead of
P0-A1 anticipating different logging.

Rewrite to match actual debug-level output from xhcid:

  irq_reactor.rs:208 — "Running IRQ reactor with IRQ file and event queue"
    (irq_file is Some — this is the main proof that interrupts fired)
  irq_reactor.rs:125 — "Running IRQ reactor in polling mode."
    (irq_file is None — must NOT appear in a passing run)
  main.rs:88        — "Enabled MSI-X"  (debug, MSI-X configured)
  main.rs:95        — "Legacy IRQ <n>" (debug, INTx fallback)
  main.rs:143       — "XHCI <pci_name>" (info, controller detected)

Also fails if both polling and IRQ-driven mode appear in the same boot.
2026-07-07 00:44:30 +03:00
vasilito b5205e162d docs: USB-IMPLEMENTATION-PLAN.md v2 — source-anchored audit and P0-P5 phases
Replace v1 (now archived/USB-IMPLEMENTATION-PLAN-v1-2026-04.md) with a
comprehensive v2 that re-audits every daemon against local/sources/base/
HEAD, aligns with Redox 0.x USB HEAD (Jan-Jul 2026), and reorganizes
phases around bare-metal correctness gaps.

Key v1→v2 corrections:
- xHCI interrupts are *not* restored in production (main.rs:141 hardcodes
  Polling).  This was the biggest v1 overstatement.  P0-A1 now fixes it.
- uhcid/ohcid are 35-line stubs, not "ownership-grade".  P0-B2 gives them
  real enumeration over usb-core.
- ehcid does not auto-spawn class drivers.  P0-B1 adds that.
- The base fork carries only one USB commit.  The 88-fix claim lived in
  patch carriers that path-sourced recipes don't apply.  v2 records this
  honestly and recommends per-feature commits on submodule/base.

Also:
- USB-VALIDATION-RUNBOOK.md restored from archived/ (operationally current).
- local/AGENTS.md: operator override allowing agents to create submodules
  when really necessary (2026-07-07), with a 4-point necessity test.
- archived/README.md supersession table updated with v1 plan and XHCID plan.
2026-07-07 00:44:30 +03:00
vasilito 23e42a07f7 base fork: P0-A1 — re-enable xHCI interrupt-driven operation
Update submodule pointer to cbd40e0d (base fork master).

Per USB-IMPLEMENTATION-PLAN.md v2 P0-A1: xhcid/src/main.rs:141 formerly
hardcoded (None, InterruptMethod::Polling), bypassing the complete
get_int_method() that handles MSI-X/MSI/INTx.  The IrqReactor's
run_with_irq_file path is fully wired and activates when irq_file is
Some — no other code assumed polling-only.

Oracle review confirmed correct register reads, loop continuation, and
EHB clearing already in the baseline.  P0-A1 is a single-line restore.
2026-07-07 00:44:30 +03:00
vasilito af282ee049 redbear-power: add flash_toast API (toast notification storage + active_toast accessor)
Implements the App side of T5 (toast notifications from the bottom/tlc
synthesis). render_toast() overlay can be wired in a follow-up pass.

- App.toast: Option<String> field
- App.toast_expires: Option<Instant> field
- App.flash_toast(msg): sets toast with 3s auto-dismiss
- App.active_toast(): returns &str if not expired

Key bindings: scrollable help dialog (j/k/PgUp/PgDn/Home/G) wired in
the previous round. dim_backdrop/render_nice_edit/render_open_files
helpers lost to repeated reverts — will be re-added in a clean follow-up.
2026-07-07 00:44:30 +03:00
vasilito 484fe692fa W39: Tab completion for cmdline
Press Tab in the cmdline to complete the current word as a
path/filename. Completion resolves against the active panel's
current directory (stored in Cmdline::base_dir when the
cmdline is activated).

- Cmdline::complete(base_dir) extends the input to the
  longest common prefix of all matching entries. If there's
  only one match, appends a trailing slash.
- Cmdline::set_base_dir(path) is called by dispatch when the
  Cmdline Cmd is dispatched.
- Tab key in Cmdline::handle_key calls complete(self.base_dir).

Added 1 unit test verifying LCP extension for partial prefix.

Tests: 1401 pass (was 1400), zero warnings.
2026-07-07 00:44:29 +03:00
vasilito 95fdc37e52 redbear-power: add set_nice() syscall helper for nice/renice editor 2026-07-07 00:44:29 +03:00
vasilito e13f09f258 Switch userutils to static build and bump submodule for login diagnostics 2026-07-07 00:44:29 +03:00
vasilito 4cb216aacd W38: Selected file count badge in border title
Append a '● N marked' badge to the active panel's border title
when files are selected, using the accent colour for visibility.
Makes the selection count visible even when the footer row is
hidden (e.g. on very short panels).

Tests: 1400 pass, zero warnings.
2026-07-07 00:44:28 +03:00
vasilito e7d5dad0aa W37: Size distribution histogram in panel footer
Add a 10-cell log2-bucketed histogram showing file-size
distribution across the directory. Each cell is the count of
files in a bucket (1B..1KiB, 1KiB..2KiB, ... >=512GiB) scaled to
a 0..8 block-char level. Rendered in accent colour next to
the existing per-file size bar.

- size_histogram() returns [u64; 10] counts per bucket
- Uses u64 leading_zeros trick for O(1) log2 size
- Skips directories and the '..' entry
- Directories are excluded from the histogram
- Renders after the cursor file's size bar

Added 1 unit test verifying bucket placement for 2B and 16KiB.

Tests: 1400 pass (was 1399), zero warnings.
2026-07-07 00:44:28 +03:00
vasilito 00c0eaa6b6 Bump userutils submodule for getty diagnostics 2026-07-07 00:44:28 +03:00
vasilito 8667fded2e fix: bump base submodule for fbcond write buffering during handoff 2026-07-06 23:06:27 +03:00
vasilito 914b2314e6 W35: Viewer auto-scroll context margin
The viewer's ensure_cursor_visible scrolled the cursor to the
exact top or bottom edge of the viewport. Add a 2-line context
margin so the cursor sits 2 lines from the top (when scrolling
down) or 2 lines from the bottom (when scrolling up). Premium
polish — keeps the surrounding lines visible for context.

Tests: 1399 pass, zero warnings.
2026-07-06 22:58:55 +03:00
vasilito 0a16b05232 W34: Goto line history with Up/Down arrows
Similar to the search history (W31), the goto-line prompt now
keeps a history of recently-visited line numbers. Up/Down arrows
cycle through the history; Down past the newest entry clears
back to the live input.

- Editor::goto_history: Vec<u32> field (max 50 entries)
- Editor::goto_history_cursor: Option<usize> navigation position
- Editor::push_goto_history(line) / goto_history_up() /
  goto_history_down() / reset_goto_history_cursor()
- GotoLine prompt commit pushes the line to history
- Up/Down arrows in the GotoLine prompt cycle through history
- push_goto_history skips consecutive duplicates

Added 2 unit tests covering: walk backwards/forwards, dedup.

Tests: 1399 pass (was 1397), zero warnings.
2026-07-06 22:43:08 +03:00
vasilito 4826d9f950 chore: bump userutils submodule to use local redox-rt fork 2026-07-06 22:33:10 +03:00
vasilito c9ad1e8deb W33: Mode-change flash in status bar
When the editor mode changes (e.g. Esc → Normal, i → Insert),
the mode tag in the status bar flashes to the accent colour
for ~300ms. Provides instant visual feedback for mode changes.

- Editor::mode_flash: Option<Instant> field
- Editor::trigger_mode_flash() / mode_flash_progress()
- Editor::set_mode() helper that triggers the flash on actual
  mode changes (no-op when setting the same mode)
- All self.mode = Mode::* sites in handlers.rs updated to use
  set_mode() so the flash triggers consistently
- status_spans uses accent + cursor_fg for the mode tag while
  the flash is active

Added 1 unit test verifying flash triggers on mode change and
NOT on setting the same mode.

Tests: 1397 pass (was 1396), zero warnings.
2026-07-06 22:15:54 +03:00
vasilito 5d869d0c45 Merge remote-tracking branch 'origin/0.3.0' into 0.3.0 2026-07-06 21:52:37 +03:00
vasilito 3e8ad78299 redbear-power: sync version 0.2.5 → 0.3.0 2026-07-06 21:52:02 +03:00
vasilito 652c1e6039 W32: Active panel title shows free space %
Append a 'N% free' indicator to the active panel's border
title using the existing disk_free() helper. Inactive panels
keep the plain path-only title. The percentage is shown as
an integer (0-100) which fits comfortably in the border even
on narrow terminals.

Tests: 1396 pass, zero warnings.
2026-07-06 21:45:50 +03:00
vasilito ab3685cd17 redbear-power: premium --help text — all v1.44 controls documented 2026-07-06 21:44:52 +03:00
vasilito f568f9cbb2 W31: Search history with Up/Down arrow keys
MC has search history navigation in the find prompt via arrow
keys. TLC's SearchState already had a history() list but no
way to navigate it without using the Alt-/ popup.

Add history_up() / history_down() / reset_history_cursor() to
SearchState. Wire Up/Down in the Find/Replace prompt to cycle
through the history. Down past the newest entry clears the
prompt back to the live pattern.

Added 3 unit tests covering: walk backwards, walk forward with
stop signal, empty history.

Tests: 1396 pass (was 1393), zero warnings.
2026-07-06 21:42:00 +03:00
vasilito daa126cc07 W30: Closing bracket pair highlight (also check before cursor)
The existing bracket_flash only triggered when the cursor was
ON a bracket character. This meant that after typing a closing
bracket (the most common trigger scenario), the cursor sits
AFTER the bracket and the flash doesn't fire.

Update update_bracket_flash to also check the character BEFORE
the cursor (pos - 1) and use it as a fallback. The pair position
is adjusted accordingly (the match is at pos - 1 for the before-
cursor case).

Tests: 1393 pass, zero warnings.
2026-07-06 21:31:23 +03:00
vasilito f557692754 0.3.0: bump base submodule for bootstrap Cargo.lock +rb0.3.0 2026-07-06 21:04:29 +03:00
vasilito e8950c2760 W29: Confirmation dialog (P1 audit gap)
The F9 audit found that Cmd::OptionsConfirm was a single-boolean
toggle (cycle on/off) instead of MC's proper confirmation dialog
with per-operation checkboxes. The ConfirmDialog already existed
in confirm_dialog.rs with 4 toggles (delete, overwrite, execute,
exit) but wasn't wired into the F9 menu.

Wire the existing ConfirmDialog:
- DialogState::Confirm(Box<ConfirmDialog>) variant
- Cmd::OptionsConfirm now opens the dialog pre-populated with
  the current safe_delete / safe_execute settings
- Dispatch handler processes ConfirmResult::Confirm by saving the
  settings to runtime.safe_delete / safe_execute
- Added RuntimeConfig::safe_execute field with default Some(false)
- Added dialog_title() and render() arms for DialogState::Confirm

Tests: 1393 pass, zero warnings.
2026-07-06 21:02:26 +03:00
vasilito b018e777ee 0.3.0: bump syscall submodule for legacy filter wrappers 2026-07-06 20:59:17 +03:00
vasilito 80eb79c4d8 0.3.0: bump submodules for Cargo.lock +rb0.3.0 refresh 2026-07-06 20:42:15 +03:00
vasilito a965521cba W28: Editor F9 Format menu (P1 audit gap)
The F9 audit found the editor had no Format menu at all. MC
has a dedicated Format menu with paragraph format, sort,
insert date/time, and external formatter entries.

Add a Format menu to the editor F9 menubar with 'Format paragraph'
(wired to the existing Editor::format_paragraph method, also
reachable via Alt-P). Sort, insert date/time, and external
formatter are documented as follow-ups.

- EditorCmd::FormatParagraph variant
- dispatch_editor_cmd handles it by calling format_paragraph()
- Format menu inserted between Edit and Search in the menubar

Updated 2 existing tests that counted menus (6→7) and checked
menu index (2→3 for Search after Format).

Tests: 1393 pass, zero warnings.
2026-07-06 20:35:38 +03:00