Files
RedBear-OS/local/recipes/drivers/redbear-input-headers
vasilito cb424d7448 build: static patch-sanity linter (shift-left the malformed-patch class)
verify-patch-sanity.py validates every active recipe .patch has internally-
consistent hunk line counts — catching the 'malformed patch at line N' failure
at commit/CI/preflight time instead of hours into a cook. This cycle hit that
class three times (qtwaylandscanner, sddm, xwayland), each only discovered when
cookbook tried to apply the patch.

Running it across the repo found 29 latent malformed patches (validated against
GNU patch: e.g. relibc/P3-sysv-ipc reproduces 'malformed patch at line 22').
They were harmless only because they sit in vendored recipes (baked, not re-
applied) — but would fail on any version-bump re-derivation. --fix recounts the
hunk headers (body untouched) and repaired all 29.

Wired into build-preflight.sh (Phase 1.0D) and redbear-ci.yml, with a unit test
(test-patch-sanity.sh). Skips archived/legacy trees and unvalidatable formats
(empty placeholders, bare-@@ git hunks).
2026-08-01 05:13:02 +03:00
..

redbear-input-headers

Linux-compatible input event headers (input.h, evdev constants) for driver and compositor use.

Status: PRODUCTION-READY Category: drivers Build: cargo build --release --manifest-path source/Cargo.toml (N/A — pure C headers, no Cargo workspace)

Purpose

redbear-input-headers provides Linux-compatible input subsystem C headers for Red Bear OS, enabling libevdev, libinput, and Wayland compositors to compile against the same evdev constants they expect. These headers are a reference implementation — written from scratch using the Linux kernel UAPI headers as reference only. No Linux kernel source is bundled, extracted, or depended upon.

This crate implements the policy stated in local/AGENTS.md:

"If we need linux-input-headers then we must code redbear-input-headers."

It replaces the legacy recipes/wip/libs/linux-input-headers/ (which extracted Linux kernel input headers from the libevdev tarball — a policy violation).

Build Integration

Included in config/redbear-mini.toml. The recipe copies all headers into ${COOKBOOK_STAGE}/usr/include/linux/ at build time.

Protected recipe: listed in config/protected-recipes.toml.

Runtime

This is a pure C headers package — it has no binary, daemon, or library. Headers are staged to the sysroot so that downstream C/C++ packages (libevdev, libinput, libwayland) can #include <linux/input.h> during cross-compilation.

Headers Provided

Header Contents
linux/input.h Core input subsystem types: struct input_event, struct input_id, struct input_absinfo, struct input_keymap_entry, struct input_mask. EVIOCG*/EVIOCS* ioctl definitions. Event types (EV_SYN, EV_KEY, EV_REL, EV_ABS, EV_MSC, EV_SW, EV_LED, EV_SND, EV_REP, EV_FF, EV_PWR, EV_FF_STATUS).
linux/input-event-codes.h Key/button/axis/switch/LED/sound/force-feedback/repeat event code constants. Full Linux keycode table (KEY_*, BTN_*), relative/absolute axis codes (REL_*, ABS_*), switch codes (SW_*), LED codes (LED_*), and sound codes (SND_*).
linux/uinput.h uinput device creation API: struct uinput_setup, struct uinput_abs_setup, struct uinput_ff_*, UI_DEV_CREATE/UI_DEV_DESTROY ioctls, UI_SET_* ioctls, BUS_* bus type constants.
linux/kd.h Linux keyboard definition constants: K_RAW, K_XLATE, K_MEDIUMRAW, K_UNICODE, K_OFF, KDGKBMODE, KDSKBMODE, KDSETLED, etc. Required by libevdev for console keyboard mode ioctls (stubbed in non-Linux builds).
linux/vt.h Virtual terminal constants: VT_OPENQRY, VT_GETMODE, VT_SETMODE, VT_GETSTATE, VT_ACTIVATE, VT_WAITACTIVE, VT_RELDISP, VT_LOCKSWITCH, VT_UNLOCKSWITCH, etc. Required by libevdev for VT switching awareness.
linux/types.h Linux-compatible type aliases: __u8, __u16, __u32, __u64, __s8, __s16, __s32, __s64, __le16, __le32, etc. Ensures struct layouts match the Linux UAPI ABI that libevdev and libinput expect.

Architecture

The include/ tree follows the Linux UAPI directory layout (include/linux/linux/ nested structure) so that #include <linux/input.h> resolves identically to the Linux kernel header path. The headers are self-contained — input.h includes input-event-codes.h and types.h internally, so consumers need only a single include.

Consumers

  • libevdev — requires linux/input.h, linux/input-event-codes.h, linux/uinput.h, linux/kd.h, linux/vt.h
  • libinput — requires libevdev (transitive)
  • redbear-compositor (Wayland compositor) — requires libinput (transitive)
  • Any future HID-to-evdev bridge daemon (usbhidd) — uses these constants for evdev event emission

References

  • Linux kernel UAPI headers (reference only — not bundled): include/uapi/linux/input.h, include/uapi/linux/input-event-codes.h, include/uapi/linux/uinput.h
  • local/AGENTS.md § "linux-input-headers — Policy Violation"