ajhahn.de
← FlashOS
Flash 29 lines
// USB gadget stub for the QEMU `virt` board.
//
// QEMU `-M virt` (and `raspi4b`) does not emulate the BCM2711 DWC2
// USB-OTG *device* path, so there is nothing to bring up. These no-ops
// keep the board API in parity with src/board/rpi4b/usb.zig so board.zig's
// comptime switch type-checks and the kernel's usb_init()/poll() call
// sites compile on both boards. The real driver lives in
// src/board/rpi4b/usb.zig.

// Nothing to initialize; report success so the kernel boot log reads
// clean on virt (the rpi4b driver fails soft with -1 on a missing core).
pub fn usb_init() i32 {
    return 0
}

// No controller to service.
pub fn poll() void {}

// Never enumerates on virt — the console mux falls back to UART.
pub fn enumerated() bool {
    return false
}

// No bulk-IN endpoint on virt; the console mux never routes here (enumerated()
// is always false). Present only so board.usb.cdc_tx type-checks on both boards.
pub fn cdc_tx(data []u8) void {
    _ = data
}