New release branch per the release-branch model (operator decision; local/AGENTS.md reserves branch creation to the operator). sync-versions.sh, driven by bump-release.sh, rewrites: - Cat 1 in-house crates -> version = 0.3.2 - Cat 2 upstream forks -> <upstream-tag>+rb0.3.2 Labels only; no fork source was rebased in this commit. bump-release.sh reports these forks as having newer upstream tags, to be taken next: relibc 0.2.5 -> 0.6.0 syscall 0.9.0 -> 0.9.1 libredox 0.1.18 -> 0.1.19 redoxfs and redox-scheme are already current. kernel, bootloader and installer are 'diverged' in the fork map and stay report-only (manual rebase); bootloader additionally has no merge-base with upstream.
redbear-hid-core
Pure-Rust USB HID Report Descriptor parser for Red Bear OS.
Status: PRODUCTION-READY
Category: drivers
Build: cargo build --release --manifest-path source/Cargo.toml
Purpose
redbear-hid-core is a zero-dependency, OS-agnostic parser for USB HID Report Descriptors (HID 1.11 §6.2). It turns raw descriptor byte streams into structured trees of collections, fields, and reports that HID class drivers can walk. The parser is total over untrusted input — every malformed descriptor yields a structured ParseError with no panic paths.
Semantics are cross-checked against Linux 7.1 drivers/hid/hid-core.c (hid_parser_global, hid_parser_local, hid_parser_main, hid_add_field), ensuring sign rules, push/pop stack behavior, collection nesting, and usage-range resolution match what real devices expect. Long items (HID 1.11 §6.2.1.2) are explicitly rejected — there is no silent-skip fallback for unhandled descriptor elements.
Build Integration
Included in config/redbear-mini.toml. Builds as both an rlib and staticlib (crate-type = ["rlib", "staticlib"]). Zero external dependencies — the crate is usable from no_std + alloc environments (kernels, boot loaders, userspace daemons).
Recipe output: libredbear_hid_core.a staged to /usr/lib/.
Runtime
This is a library crate only — it has no binary, daemon, or CLI. Consumers link against it at build time.
Architecture
| Module | Purpose |
|---|---|
lib.rs |
Public API re-exports: parse(), Walker, ReportDescriptor, Collection, Field, Usage, ParseError, and the raw submodule for low-level item decoding |
parser.rs |
State machine implementing HID 1.11 §6.2.2 item semantics: Global/Local/Main item classes, Push/Pop stack, field emission, collection open/close |
item.rs |
Low-level item decoder: decode_item() turns raw bytes into RawItem structs with sign extension, tag/type extraction, and data-size handling |
model.rs |
Domain types: ReportDescriptor, Collection, Field, FieldFlags, FieldKind, Report, Usage, Unit |
walker.rs |
Walker API: renders the flat parsed model into shapes for downstream consumers (usage → evdev mapping, LED sync, quirk tables, multi-touch) |
error.rs |
ParseError enum with ItemClass discriminant for structured error reporting |
Key design decisions:
GLOBAL_STACK_MAX = 4(matches LinuxHID_GLOBAL_STACK_SIZE)COLLECTION_STACK_MAX = 256(generous bound to prevent memory exhaustion)LOCAL_USAGE_MAX = 12240(matches LinuxHID_MAX_USAGES)REPORT_SIZE_MAX = 256(matches Linux maximum)- Sign rules follow Linux exactly: Logical/Physical Minimum are signed; Maximum is signed only if the corresponding Minimum was negative
Consumers
redbear-input-headers— a futureusbhiddHID-class driver will use this parser to map HID reports to evdev events- Any HID class driver (keyboard, mouse, gamepad, sensor) that needs to interpret USB HID Report Descriptors
References
- HID 1.11 Specification §6.2 (Report Descriptor)
- Linux 7.1
drivers/hid/hid-core.c(reference implementation)