⚠️ VeridianOS Kernel Documentation - This is low-level kernel code. All functions are unsafe unless explicitly marked otherwise. no_std

HidDevice

Struct HidDevice 

Source
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: u8

USB device address on the bus

§interface: u8

Interface number within the USB configuration

§device_type: HidDeviceType

Detected device type

§interrupt_endpoint: u8

Interrupt IN endpoint address (for polling reports)

§poll_interval_ms: u8

Interrupt endpoint polling interval in milliseconds

§max_packet_size: u16

Maximum packet size for the interrupt endpoint

§boot_protocol: bool

Whether the device is in boot protocol mode

§capabilities: HidCapabilities

Parsed device capabilities

Implementations§

Source§

impl HidDevice

Source

pub fn new_boot_keyboard( address: u8, interface: u8, endpoint: u8, interval: u8, ) -> Self

Create a new HID device with boot protocol configuration

Source

pub fn new_boot_mouse( address: u8, interface: u8, endpoint: u8, interval: u8, ) -> Self

Create a new HID device configured as a boot mouse

Source

pub fn from_capabilities( address: u8, interface: u8, endpoint: u8, interval: u8, caps: HidCapabilities, ) -> Self

Create a HID device from parsed capabilities

Source

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.

Source

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.

Source

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.

Trait Implementations§

Source§

impl Debug for HidDevice

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for HidDevice

§

impl RefUnwindSafe for HidDevice

§

impl Send for HidDevice

§

impl Sync for HidDevice

§

impl Unpin for HidDevice

§

impl UnwindSafe for HidDevice

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.