pub struct HidDevice {
pub address: u8,
pub interface: u8,
pub device_type: HidDeviceType,
pub interrupt_endpoint: u8,
pub poll_interval_ms: u8,
pub max_packet_size: u16,
pub boot_protocol: bool,
pub capabilities: HidCapabilities,
/* private fields */
}Expand description
Represents a USB HID device with state tracking
Fields§
§address: u8USB device address on the bus
interface: u8Interface number within the USB configuration
device_type: HidDeviceTypeDetected device type
interrupt_endpoint: u8Interrupt IN endpoint address (for polling reports)
poll_interval_ms: u8Interrupt endpoint polling interval in milliseconds
max_packet_size: u16Maximum packet size for the interrupt endpoint
boot_protocol: boolWhether the device is in boot protocol mode
capabilities: HidCapabilitiesParsed device capabilities
Implementations§
Source§impl HidDevice
impl HidDevice
Sourcepub fn new_boot_keyboard(
address: u8,
interface: u8,
endpoint: u8,
interval: u8,
) -> Self
pub fn new_boot_keyboard( address: u8, interface: u8, endpoint: u8, interval: u8, ) -> Self
Create a new HID device with boot protocol configuration
Sourcepub fn new_boot_mouse(
address: u8,
interface: u8,
endpoint: u8,
interval: u8,
) -> Self
pub fn new_boot_mouse( address: u8, interface: u8, endpoint: u8, interval: u8, ) -> Self
Create a new HID device configured as a boot mouse
Sourcepub fn from_capabilities(
address: u8,
interface: u8,
endpoint: u8,
interval: u8,
caps: HidCapabilities,
) -> Self
pub fn from_capabilities( address: u8, interface: u8, endpoint: u8, interval: u8, caps: HidCapabilities, ) -> Self
Create a HID device from parsed capabilities
Sourcepub fn submit_report(&mut self, data: &[u8]) -> Result<(), KernelError>
pub fn submit_report(&mut self, data: &[u8]) -> Result<(), KernelError>
Submit report data received from an interrupt transfer.
Stores the data in the internal buffer for subsequent
process_report calls.
Sourcepub fn process_report(&mut self) -> Result<InputEventBatch, KernelError>
pub fn process_report(&mut self) -> Result<InputEventBatch, KernelError>
Process the current report buffer and generate input events.
Returns a small array of events. For keyboards this includes key press/release deltas compared to the previous report; for mice this includes movement, button changes, and scroll.
Sourcepub fn poll_device(&mut self) -> Option<InputEvent>
pub fn poll_device(&mut self) -> Option<InputEvent>
Poll the device for new input (stub).
In a real implementation this would issue an interrupt transfer
to the device’s interrupt IN endpoint via the host controller
and return the first event from the resulting report. This stub
always returns None.