1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
use packed_struct::prelude::*;
pub const USB_CLASS_HID: u8 = 0x03;
pub const SPEC_VERSION_1_11: u16 = 0x0111; pub const COUNTRY_CODE_NOT_SUPPORTED: u8 = 0x0;
#[derive(Clone, Copy, Debug, PartialEq, Eq, Ord, PartialOrd)]
#[repr(u8)]
pub enum InterfaceProtocol {
None = 0x00,
Keyboard = 0x01,
Mouse = 0x02,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, PrimitiveEnum)]
#[repr(u8)]
pub enum DescriptorType {
Hid = 0x21,
Report = 0x22,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum InterfaceSubClass {
None = 0x00,
Boot = 0x01,
}
impl From<InterfaceProtocol> for InterfaceSubClass {
fn from(protocol: InterfaceProtocol) -> Self {
if protocol == InterfaceProtocol::None {
InterfaceSubClass::None
} else {
InterfaceSubClass::Boot
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, PrimitiveEnum)]
#[repr(u8)]
pub enum HidProtocol {
Boot = 0x00,
Report = 0x01,
}