reorg: move the USB client to library/device/usb (drop runtime.usb)

The USB class-driver transfer client was library/runtime/usb.zig, re-exported
as runtime.usb — which compiled the USB client and usb-transfer-protocol into
every user binary (init, fat, the compositor…), none of which speak USB. It is
bus-family logic, not core runtime.

Move it to its domain home, library/device/usb/usb.zig (module "usb"), alongside
the usb-abi and usb-ids data modules; fix its internal imports to go through the
runtime module; and re-export usb.abi / usb.ids so a class driver reaches the
whole USB domain through one import. runtime.usb and runtime's
usb-transfer-protocol import are removed; the three class drivers
(usb-hid keyboard/mouse, usb-storage) import module "usb" directly.

zig build + test green; usb-hid, usb-storage pass.
This commit is contained in:
Daniel Samson
2026-07-22 20:46:51 +01:00
parent a7f0c1a450
commit 1d1234c963
6 changed files with 48 additions and 25 deletions
@@ -16,10 +16,16 @@
//! the service harness drops buffered-message payloads — see service.zig).
const std = @import("std");
const ipc = @import("ipc.zig");
const system = @import("system.zig");
const runtime = @import("runtime");
const ipc = runtime.ipc;
const system = runtime.system;
const protocol = @import("usb-transfer-protocol");
/// The USB chapter-9 wire ABI and the class taxonomy, re-exported so a class driver reaches
/// the whole USB domain through its one `usb` import (`usb.abi.getDescriptor`, `usb.ids.Class`).
pub const abi = @import("usb-abi");
pub const ids = @import("usb-ids");
pub const Endpoint = protocol.Endpoint;
pub const InterruptReport = protocol.InterruptReport;
pub const max_report_data = protocol.max_report_data;
+3 -3
View File
@@ -46,9 +46,9 @@ pub const dma = @import("dma.zig");
/// and docs/display-v2.md.
pub const shared_memory = @import("shared-memory.zig");
/// USB class-driver client: open a device on the xHCI bus and drive it
/// (control / interrupt / bulk transfers). See library/runtime/usb.zig.
pub const usb = @import("usb.zig");
// The USB class-driver client moved to its domain home, library/device/usb (module
// "usb"): it is bus-family logic, not core runtime, and re-exporting it here compiled it
// into every binary. USB class drivers import it directly with @import("usb").
/// Block-device client: read/write a block device (a USB stick, via
/// usb-storage). See library/runtime/block.zig.