//! system/services/input-source — a hardware-free synthetic input source, used to exercise //! the input service end to end without a real PS/2 controller (the `input` test case, and //! any bring-up where there is no hardware). It stands in for a driver: it connects to the //! input service and publishes a rolling stream that cycles through all device classes — //! keyboard, mouse, and joystick/gamepad — which the service routes to interested //! subscribers. //! //! It stays silent after startup (no per-event logging) so it can share the boot serial //! transcript with a subscriber whose output is the test's success marker. The real //! keyboard and mouse drivers publish their own synthetic streams today; swapping in //! decoded hardware is a follow-up (see docs/input.md). const runtime = @import("runtime"); const input = runtime.input; const system = runtime.system; pub fn main() void { var source = input.connectSource() orelse { _ = system.write("input-source: input service unavailable\n"); return; }; _ = system.write("input-source: publishing synthetic input events\n"); var step: usize = 0; while (true) : (step +%= 1) { // Rotate across the device classes so every publish path (and the service's // per-device routing) is exercised. switch (step % 3) { 0 => _ = source.publishKeyboardEvent(input.syntheticKeyEvent(step)), 1 => _ = source.publishMouseEvent(input.syntheticMouseEvent(step)), else => _ = source.publishJoystickEvent(input.syntheticJoystickEvent(step)), } system.sleep(200); } } pub const panic = runtime.panic; comptime { _ = &runtime.start._start; }