Skip to main content

hid_types/id/usage/
power.rs

1//! Well-known Usage ID values from the Power Usage Page.
2
3use num_enum::{IntoPrimitive, TryFromPrimitive};
4
5use crate::Ident;
6
7/// Well-known Usage ID values from the Power Usage Page.
8///
9/// See [HID Usage Tables for Universal Serial Bus](https://www.usb.org/document-library/hid-usage-tables-17),
10/// section 30.
11#[expect(missing_docs)]
12#[derive(Clone, Copy, Debug, Eq, PartialEq, TryFromPrimitive, IntoPrimitive)]
13#[repr(u16)]
14pub enum KnownUsage {
15    Undefined = 0,
16    IName = 0x01,
17    PresentStatus = 0x02,
18    ChangedStatus = 0x03,
19    Ups = 0x04,
20    PowerSupply = 0x05,
21    // 0x06-0x0F reserved
22    BatterySystem = 0x10,
23    BatterySystemId = 0x11,
24    Battery = 0x12,
25    BatteryId = 0x13,
26    Charger = 0x14,
27    ChargerId = 0x15,
28    PowerConverter = 0x16,
29    PowerConverterId = 0x17,
30    OutletSystem = 0x18,
31    OutletSystemId = 0x19,
32    Input = 0x1A,
33    InputId = 0x1B,
34    Output = 0x1C,
35    OutputId = 0x1D,
36    Flow = 0x1E,
37    FlowId = 0x1F,
38    Outlet = 0x20,
39    OutletId = 0x21,
40    Gang = 0x22,
41    GangId = 0x23,
42    PowerSummary = 0x24,
43    PowerSummaryId = 0x25,
44    // 0x26-0x2F reserved
45    Voltage = 0x30,
46    Current = 0x31,
47    Frequency = 0x32,
48    ApparentPower = 0x33,
49    ActivePower = 0x34,
50    PercentLoad = 0x35,
51    Temperature = 0x36,
52    Humidity = 0x37,
53    BadCount = 0x38,
54    // 0x39-0x3F reserved
55    ConfigVoltage = 0x40,
56    ConfigCurrent = 0x41,
57    ConfigFrequency = 0x42,
58    ConfigApparentPower = 0x43,
59    ConfigActivePower = 0x44,
60    ConfigPercentLoad = 0x45,
61    ConfigTemperature = 0x46,
62    ConfigHumidity = 0x47,
63    // 0x48-0x4F reserved
64    SwitchOnControl = 0x50,
65    SwitchOffControl = 0x51,
66    ToggleControl = 0x52,
67    LowVoltageTransfer = 0x53,
68    HighVoltageTransfer = 0x54,
69    DelayBeforeReboot = 0x55,
70    DelayBeforeStartup = 0x56,
71    DelayBeforeShutdown = 0x57,
72    Test = 0x58,
73    ModuleReset = 0x59,
74    AudibleAlarmControl = 0x5A,
75    // 0x5B-0x5F reserved
76    Present = 0x60,
77    Good = 0x61,
78    InternalFailure = 0x62,
79    VoltageOutOfRange = 0x63,
80    FrequencyOutOfRange = 0x64,
81    Overload = 0x65,
82    OverCharged = 0x66,
83    OverTemperature = 0x67,
84    ShutdownRequested = 0x68,
85    ShutdownImminent = 0x69,
86    // 0x6A reserved
87    SwitchOnOff = 0x6B,
88    Switchable = 0x6C,
89    Used = 0x6D,
90    Boost = 0x6E,
91    Buck = 0x6F,
92    Initialized = 0x70,
93    Tested = 0x71,
94    AwaitingPower = 0x72,
95    CommunicationLost = 0x73,
96    // 0x74-0xFC reserved
97    IManufacturer = 0xFD,
98    IProduct = 0xFE,
99    ISerialNumber = 0xFF,
100    // 0x0100-0xFFFF reserved
101}
102
103/// A __Usage ID__ value.
104pub type Usage = Ident<KnownUsage, u16>;