pub struct KeyboardReport {
pub modifiers: u8,
pub keycodes: [u8; 6],
}Expand description
Keyboard report in the boot protocol layout (8 bytes).
All standard USB keyboards support this layout when placed in boot protocol
mode via HidHost::set_protocol with
HidProtocolMode::Boot.
Fields§
§modifiers: u8Modifier keys bitmask.
Bit 0: Left Ctrl | Bit 1: Left Shift | Bit 2: Left Alt | Bit 3: Left GUI Bit 4: Right Ctrl | Bit 5: Right Shift | Bit 6: Right Alt | Bit 7: Right GUI
keycodes: [u8; 6]Up to 6 simultaneously pressed key codes (HID usage page 0x07). A value of 0x00 means “no key”; 0x01 means “rollover error”.
Implementations§
Source§impl KeyboardReport
impl KeyboardReport
Sourcepub const DESCRIPTOR: &'static [u8]
pub const DESCRIPTOR: &'static [u8]
Report descriptor for a keyboard sending this report.
It also declares a 1-byte LED output report, which the host sends with SET_REPORT or on the interrupt OUT endpoint. Bit 0: Num Lock | Bit 1: Caps Lock | Bit 2: Scroll Lock | Bit 3: Compose | Bit 4: Kana
Sourcepub fn parse(buf: &[u8]) -> Option<Self>
pub fn parse(buf: &[u8]) -> Option<Self>
Parse a boot-protocol keyboard report from an 8-byte buffer.
Returns None if the buffer is shorter than 8 bytes.
Sourcepub fn is_pressed(&self, keycode: u8) -> bool
pub fn is_pressed(&self, keycode: u8) -> bool
Returns true if the given HID key code is currently pressed.
Trait Implementations§
Source§impl Clone for KeyboardReport
impl Clone for KeyboardReport
Source§fn clone(&self) -> KeyboardReport
fn clone(&self) -> KeyboardReport
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more