| 1 |
#![cfg(feature = "derive")] |
| 2 |
|
| 3 |
/// HID-IO Packet Buffer Struct |
| 4 |
/// |
| 5 |
/// # Remarks |
| 6 |
/// Used to store HID-IO data chunks. Will be chunked into individual packets on transmission. |
| 7 |
#[repr(C)] |
| 8 |
#[derive(PartialEq, Eq, Clone, Debug, bincode::Encode)] |
| 9 |
pub struct HidIoPacketBuffer<const H: usize> { |
| 10 |
/// Type of packet (Continued is automatically set if needed) |
| 11 |
pub ptype: u32, |
| 12 |
/// Packet Id |
| 13 |
pub id: u32, |
| 14 |
/// Packet length for serialization (in bytes) |
| 15 |
pub max_len: u32, |
| 16 |
/// Payload data, chunking is done automatically by serializer |
| 17 |
pub data: [u8; H], |
| 18 |
/// Set False if buffer is not complete, True if it is |
| 19 |
pub done: bool, |
| 20 |
} |
| 21 |
|
| 22 |
#[repr(u32)] |
| 23 |
#[derive(PartialEq, Eq, Clone, Copy, Debug, bincode::Encode)] |
| 24 |
#[allow(dead_code)] |
| 25 |
/// Requests for to perform a specific action |
| 26 |
pub enum HidIoCommandId { |
| 27 |
SupportedIds = 0x00, |
| 28 |
GetInfo = 0x01, |
| 29 |
TestPacket = 0x02, |
| 30 |
ResetHidIo = 0x03, |
| 31 |
Reserved = 0x04, // ... 0x0F |
| 32 |
|
| 33 |
GetProperties = 0x10, |
| 34 |
KeyState = 0x11, |
| 35 |
KeyboardLayout = 0x12, |
| 36 |
KeyLayout = 0x13, |
| 37 |
KeyShapes = 0x14, |
| 38 |
LedLayout = 0x15, |
| 39 |
FlashMode = 0x16, |
| 40 |
UnicodeText = 0x17, |
| 41 |
UnicodeState = 0x18, |
| 42 |
HostMacro = 0x19, |
| 43 |
SleepMode = 0x1A, |
| 44 |
|
| 45 |
KllState = 0x20, |
| 46 |
PixelSetting = 0x21, |
| 47 |
PixelSet1c8b = 0x22, |
| 48 |
PixelSet3c8b = 0x23, |
| 49 |
PixelSet1c16b = 0x24, |
| 50 |
PixelSet3c16b = 0x25, |
| 51 |
|
| 52 |
OpenUrl = 0x30, |
| 53 |
TerminalCmd = 0x31, |
| 54 |
GetInputLayout = 0x32, |
| 55 |
SetInputLayout = 0x33, |
| 56 |
TerminalOut = 0x34, |
| 57 |
|
| 58 |
HidKeyboard = 0x40, |
| 59 |
HidKeyboardLed = 0x41, |
| 60 |
HidMouse = 0x42, |
| 61 |
HidJoystick = 0x43, |
| 62 |
HidSystemCtrl = 0x44, |
| 63 |
HidConsumerCtrl = 0x45, |
| 64 |
|
| 65 |
ManufacturingTest = 0x50, |
| 66 |
ManufacturingResult = 0x51, |
| 67 |
|
| 68 |
Unused = 0xFFFF, |
| 69 |
} |