usbd_human_interface_device/
page.rs

1//! USB HID usage pages
2//!
3//! See Universal Serial Bus (USB) HID Usage Tables Version 1.12
4//! <https://www.usb.org/sites/default/files/documents/hut1_12v2.pdf>
5
6use core::hash::Hash;
7use num_enum::{FromPrimitive, IntoPrimitive};
8use packed_struct::prelude::*;
9
10// Notes for converting .upg files to rust enum
11// * Trim header
12// * Flip and format: ([0-9A-F]*)\t(.*) - $2=0x$1,
13// * Fix casing: (\b[a-z]) - \u$1
14// * Squash spaces and punctuation: [^\w=,]
15// * Unmangle reserved: (.*)(reserved)=(.*) - //0x$1-$3 $2
16
17/// LEDs usage page
18///
19/// See [Universal Serial Bus (USB) HID Usage Tables Version 1.12](<https://www.usb.org/sites/default/files/documents/hut1_12v2.pdf>):
20/// Section 11 LED Page (0x08)
21#[cfg_attr(feature = "defmt", derive(defmt::Format))]
22#[derive(
23    Debug,
24    Copy,
25    Clone,
26    Eq,
27    PartialEq,
28    Ord,
29    PartialOrd,
30    PrimitiveEnum,
31    Hash,
32    IntoPrimitive,
33    FromPrimitive,
34)]
35#[repr(u8)]
36pub enum Leds {
37    #[num_enum(default)]
38    Undefined = 0x00,
39    NumLock = 0x01,
40    CapsLock = 0x02,
41    ScrollLock = 0x03,
42    Compose = 0x04,
43    Kana = 0x05,
44    Power = 0x06,
45    Shift = 0x07,
46    DoNotDisturb = 0x08,
47    Mute = 0x09,
48    ToneEnable = 0x0A,
49    HighCutFilter = 0x0B,
50    LowCutFilter = 0x0C,
51    EqualizerEnable = 0x0D,
52    SoundFieldOn = 0x0E,
53    SurroundFieldOn = 0x0F,
54    Repeat = 0x10,
55    Stereo = 0x11,
56    SamplingRateDetect = 0x12,
57    Spinning = 0x13,
58    CAV = 0x14,
59    CLV = 0x15,
60    RecordingFormatDetect = 0x16,
61    OffHook = 0x17,
62    Ring = 0x18,
63    MessageWaiting = 0x19,
64    DataMode = 0x1A,
65    BatteryOperation = 0x1B,
66    BatteryOK = 0x1C,
67    BatteryLow = 0x1D,
68    Speaker = 0x1E,
69    HeadSet = 0x1F,
70    Hold = 0x20,
71    Microphone = 0x21,
72    Coverage = 0x22,
73    NightMode = 0x23,
74    SendCalls = 0x24,
75    CallPickup = 0x25,
76    Conference = 0x26,
77    StandBy = 0x27,
78    CameraOn = 0x28,
79    CameraOff = 0x29,
80    OnLine = 0x2A,
81    OffLine = 0x2B,
82    Busy = 0x2C,
83    Ready = 0x2D,
84    PaperOut = 0x2E,
85    PaperJam = 0x2F,
86    Remote = 0x30,
87    Forward = 0x31,
88    Reverse = 0x32,
89    Stop = 0x33,
90    Rewind = 0x34,
91    FastForward = 0x35,
92    Play = 0x36,
93    Pause = 0x37,
94    Record = 0x38,
95    Error = 0x39,
96    UsageSelectedIndicator = 0x3A,
97    UsageInUseIndicator = 0x3B,
98    UsageMultiModeIndicator = 0x3C,
99    IndicatorOn = 0x3D,
100    IndicatorFlash = 0x3E,
101    IndicatorSlowBlink = 0x3F,
102    IndicatorFastBlink = 0x40,
103    IndicatorOff = 0x41,
104    FlashOnTime = 0x42,
105    SlowBlinkOnTime = 0x43,
106    SlowBlinkOffTime = 0x44,
107    FastBlinkOnTime = 0x45,
108    FastBlinkOffTime = 0x46,
109    UsageIndicatorColor = 0x47,
110    Red = 0x48,
111    Green = 0x49,
112    Amber = 0x4A,
113    GenericIndicator = 0x4B,
114    //0x4C-0xFFFF Reserved
115}
116
117impl Default for Leds {
118    fn default() -> Self {
119        Self::Undefined
120    }
121}
122
123/// Consumer usage page
124///
125/// See [Universal Serial Bus (USB) HID Usage Tables Version 1.12](<https://www.usb.org/sites/default/files/documents/hut1_12v2.pdf>):
126/// Section 15 Consumer Page (0x0C)
127#[cfg_attr(feature = "defmt", derive(defmt::Format))]
128#[derive(
129    Debug,
130    Copy,
131    Clone,
132    Eq,
133    PartialEq,
134    Ord,
135    PartialOrd,
136    PrimitiveEnum,
137    Hash,
138    IntoPrimitive,
139    FromPrimitive,
140)]
141#[repr(u16)]
142pub enum Consumer {
143    #[num_enum(default)]
144    Unassigned = 0x00,
145    ConsumerControl = 0x01,
146    NumericKeyPad = 0x02,
147    ProgrammableButtons = 0x03,
148    Microphone = 0x04,
149    Headphone = 0x05,
150    GraphicEqualizer = 0x06,
151    //0x07-0x1F Reserved
152    Plus10 = 0x20,
153    Plus100 = 0x21,
154    AmPm = 0x22,
155    //0x23-0x3F Reserved
156    Power = 0x30,
157    Reset = 0x31,
158    Sleep = 0x32,
159    SleepAfter = 0x33,
160    SleepMode = 0x34,
161    Illumination = 0x35,
162    FunctionButtons = 0x36,
163    //0x37-0x3F Reserved
164    Menu = 0x40,
165    MenuPick = 0x41,
166    MenuUp = 0x42,
167    MenuDown = 0x43,
168    MenuLeft = 0x44,
169    MenuRight = 0x45,
170    MenuEscape = 0x46,
171    MenuValueIncrease = 0x47,
172    MenuValueDecrease = 0x48,
173    //0x49-0x5F Reserved
174    DataOnScreen = 0x60,
175    ClosedCaption = 0x61,
176    ClosedCaptionSelect = 0x62,
177    VcrTv = 0x63,
178    BroadcastMode = 0x64,
179    Snapshot = 0x65,
180    Still = 0x66,
181    //0x67-0x7F Reserved
182    Selection = 0x80,
183    AssignSelection = 0x81,
184    ModeStep = 0x82,
185    RecallLast = 0x83,
186    EnterChannel = 0x84,
187    OrderMovie = 0x85,
188    Channel = 0x86,
189    MediaSelection = 0x87,
190    MediaSelectComputer = 0x88,
191    MediaSelectTV = 0x89,
192    MediaSelectWWW = 0x8A,
193    MediaSelectDVD = 0x8B,
194    MediaSelectTelephone = 0x8C,
195    MediaSelectProgramGuide = 0x8D,
196    MediaSelectVideoPhone = 0x8E,
197    MediaSelectGames = 0x8F,
198    MediaSelectMessages = 0x90,
199    MediaSelectCD = 0x91,
200    MediaSelectVCR = 0x92,
201    MediaSelectTuner = 0x93,
202    Quit = 0x94,
203    Help = 0x95,
204    MediaSelectTape = 0x96,
205    MediaSelectCable = 0x97,
206    MediaSelectSatellite = 0x98,
207    MediaSelectSecurity = 0x99,
208    MediaSelectHome = 0x9A,
209    MediaSelectCall = 0x9B,
210    ChannelIncrement = 0x9C,
211    ChannelDecrement = 0x9D,
212    MediaSelectSAP = 0x9E,
213    //0x9F Reserved
214    VCRPlus = 0xA0,
215    Once = 0xA1,
216    Daily = 0xA2,
217    Weekly = 0xA3,
218    Monthly = 0xA4,
219    //0xA5-0xAF Reserved
220    Play = 0xB0,
221    Pause = 0xB1,
222    Record = 0xB2,
223    FastForward = 0xB3,
224    Rewind = 0xB4,
225    ScanNextTrack = 0xB5,
226    ScanPreviousTrack = 0xB6,
227    Stop = 0xB7,
228    Eject = 0xB8,
229    RandomPlay = 0xB9,
230    SelectDisc = 0xBA,
231    EnterDisc = 0xBB,
232    Repeat = 0xBC,
233    Tracking = 0xBD,
234    TrackNormal = 0xBE,
235    SlowTracking = 0xBF,
236    FrameForward = 0xC0,
237    FrameBack = 0xC1,
238    Mark = 0xC2,
239    ClearMark = 0xC3,
240    RepeatFromMark = 0xC4,
241    ReturnToMark = 0xC5,
242    SearchMarkForward = 0xC6,
243    SearchMarkBackwards = 0xC7,
244    CounterReset = 0xC8,
245    ShowCounter = 0xC9,
246    TrackingIncrement = 0xCA,
247    TrackingDecrement = 0xCB,
248    StopEject = 0xCC,
249    PlayPause = 0xCD,
250    PlaySkip = 0xCE,
251    //0xCF-0xDF Reserved
252    Volume = 0xE0,
253    Balance = 0xE1,
254    Mute = 0xE2,
255    Bass = 0xE3,
256    Treble = 0xE4,
257    BassBoost = 0xE5,
258    SurroundMode = 0xE6,
259    Loudness = 0xE7,
260    MPX = 0xE8,
261    VolumeIncrement = 0xE9,
262    VolumeDecrement = 0xEA,
263    //0xEB-0xEF Reserved
264    SpeedSelect = 0xF0,
265    PlaybackSpeed = 0xF1,
266    StandardPlay = 0xF2,
267    LongPlay = 0xF3,
268    ExtendedPlay = 0xF4,
269    Slow = 0xF5,
270    //0xF6-0xFF Reserved
271    FanEnable = 0x100,
272    FanSpeed = 0x101,
273    LightEnable = 0x102,
274    LightIlluminationLevel = 0x103,
275    ClimateControlEnable = 0x104,
276    RoomTemperature = 0x105,
277    SecurityEnable = 0x106,
278    FireAlarm = 0x107,
279    PoliceAlarm = 0x108,
280    Proximity = 0x109,
281    Motion = 0x10A,
282    DuressAlarm = 0x10B,
283    HoldupAlarm = 0x10C,
284    MedicalAlarm = 0x10D,
285    //0x10E-0x14F Reserved
286    BalanceRight = 0x150,
287    BalanceLeft = 0x151,
288    BassIncrement = 0x152,
289    BassDecrement = 0x153,
290    TrebleIncrement = 0x154,
291    TrebleDecrement = 0x155,
292    //0x156-0x15F Reserved
293    SpeakerSystem = 0x160,
294    ChannelLeft = 0x161,
295    ChannelRight = 0x162,
296    ChannelCenter = 0x163,
297    ChannelFront = 0x164,
298    ChannelCenterFront = 0x165,
299    ChannelSide = 0x166,
300    ChannelSurround = 0x167,
301    ChannelLowFrequencyEnhancement = 0x168,
302    ChannelTop = 0x169,
303    ChannelUnknown = 0x16A,
304    //0x16B-0x16F Reserved
305    SubChannel = 0x170,
306    SubChannelIncrement = 0x171,
307    SubChannelDecrement = 0x172,
308    AlternateAudioIncrement = 0x173,
309    AlternateAudioDecrement = 0x174,
310    //0x175-0x17F Reserved
311    ApplicationLaunchButtons = 0x180,
312    ALLaunchButtonConfigurationTool = 0x181,
313    ALProgrammableButtonConfiguration = 0x182,
314    ALConsumerControlConfiguration = 0x183,
315    ALWordProcessor = 0x184,
316    ALTextEditor = 0x185,
317    ALSpreadsheet = 0x186,
318    ALGraphicsEditor = 0x187,
319    ALPresentationApp = 0x188,
320    ALDatabaseApp = 0x189,
321    ALEmailReader = 0x18A,
322    ALNewsreader = 0x18B,
323    ALVoicemail = 0x18C,
324    ALContactsAddressBook = 0x18D,
325    ALCalendarSchedule = 0x18E,
326    ALTaskProjectManager = 0x18F,
327    ALLogJournalTimecard = 0x190,
328    ALCheckbookFinance = 0x191,
329    ALCalculator = 0x192,
330    ALAvCapturePlayback = 0x193,
331    ALLocalMachineBrowser = 0x194,
332    ALLanWanBrowser = 0x195,
333    ALInternetBrowser = 0x196,
334    ALRemoteNetworkingISPConnect = 0x197,
335    ALNetworkConference = 0x198,
336    ALNetworkChat = 0x199,
337    ALTelephonyDialer = 0x19A,
338    ALLogon = 0x19B,
339    ALLogoff = 0x19C,
340    ALLogonLogoff = 0x19D,
341    ALTerminalLockScreensaver = 0x19E,
342    ALControlPanel = 0x19F,
343    ALCommandLineProcessorRun = 0x1A0,
344    ALProcessTaskManager = 0x1A1,
345    ALSelectTaskApplication = 0x1A2,
346    ALNextTaskApplication = 0x1A3,
347    ALPreviousTaskApplication = 0x1A4,
348    ALPreemptiveHaltTaskApplication = 0x1A5,
349    ALIntegratedHelpCenter = 0x1A6,
350    ALDocuments = 0x1A7,
351    ALThesaurus = 0x1A8,
352    ALDictionary = 0x1A9,
353    ALDesktop = 0x1AA,
354    ALSpellCheck = 0x1AB,
355    ALGrammarCheck = 0x1AC,
356    ALWirelessStatus = 0x1AD,
357    ALKeyboardLayout = 0x1AE,
358    ALVirusProtection = 0x1AF,
359    ALEncryption = 0x1B0,
360    ALScreenSaver = 0x1B1,
361    ALAlarms = 0x1B2,
362    ALClock = 0x1B3,
363    ALFileBrowser = 0x1B4,
364    ALPowerStatus = 0x1B5,
365    ALImageBrowser = 0x1B6,
366    ALAudioBrowser = 0x1B7,
367    ALMovieBrowser = 0x1B8,
368    ALDigitalRightsManager = 0x1B9,
369    ALDigitalWallet = 0x1BA,
370    //0x-0x1BB Reserved
371    ALInstantMessaging = 0x1BC,
372    ALOemFeaturesTipsTutorialBrowser = 0x1BD,
373    ALOemHelp = 0x1BE,
374    ALOnlineCommunity = 0x1BF,
375    ALEntertainmentContentBrowser = 0x1C0,
376    ALOnlineShoppingBrowser = 0x1C1,
377    ALSmartCardInformationHelp = 0x1C2,
378    ALMarketMonitorFinanceBrowser = 0x1C3,
379    ALCustomizedCorporateNewsBrowser = 0x1C4,
380    ALOnlineActivityBrowser = 0x1C5,
381    ALResearchSearchBrowser = 0x1C6,
382    ALAudioPlayer = 0x1C7,
383    //0x1C8-0x1FF Reserved
384    GenericGUIApplicationControls = 0x200,
385    ACNew = 0x201,
386    ACOpen = 0x202,
387    ACClose = 0x203,
388    ACExit = 0x204,
389    ACMaximize = 0x205,
390    ACMinimize = 0x206,
391    ACSave = 0x207,
392    ACPrint = 0x208,
393    ACProperties = 0x209,
394    ACUndo = 0x21A,
395    ACCopy = 0x21B,
396    ACCut = 0x21C,
397    ACPaste = 0x21D,
398    ACSelectAll = 0x21E,
399    ACFind = 0x21F,
400    ACFindAndReplace = 0x220,
401    ACSearch = 0x221,
402    ACGoTo = 0x222,
403    ACHome = 0x223,
404    ACBack = 0x224,
405    ACForward = 0x225,
406    ACStop = 0x226,
407    ACRefresh = 0x227,
408    ACPreviousLink = 0x228,
409    ACNextLink = 0x229,
410    ACBookmarks = 0x22A,
411    ACHistory = 0x22B,
412    ACSubscriptions = 0x22C,
413    ACZoomIn = 0x22D,
414    ACZoomOut = 0x22E,
415    ACZoom = 0x22F,
416    ACFullScreenView = 0x230,
417    ACNormalView = 0x231,
418    ACViewToggle = 0x232,
419    ACScrollUp = 0x233,
420    ACScrollDown = 0x234,
421    ACScroll = 0x235,
422    ACPanLeft = 0x236,
423    ACPanRight = 0x237,
424    ACPan = 0x238,
425    ACNewWindow = 0x239,
426    ACTileHorizontally = 0x23A,
427    ACTileVertically = 0x23B,
428    ACFormat = 0x23C,
429    ACEdit = 0x23D,
430    ACBold = 0x23E,
431    ACItalics = 0x23F,
432    ACUnderline = 0x240,
433    ACStrikethrough = 0x241,
434    ACSubscript = 0x242,
435    ACSuperscript = 0x243,
436    ACAllCaps = 0x244,
437    ACRotate = 0x245,
438    ACResize = 0x246,
439    ACFlipHorizontal = 0x247,
440    ACFlipVertical = 0x248,
441    ACMirrorHorizontal = 0x249,
442    ACMirrorVertical = 0x24A,
443    ACFontSelect = 0x24B,
444    ACFontColor = 0x24C,
445    ACFontSize = 0x24D,
446    ACJustifyLeft = 0x24E,
447    ACJustifyCenterH = 0x24F,
448    ACJustifyRight = 0x250,
449    ACJustifyBlockH = 0x251,
450    ACJustifyTop = 0x252,
451    ACJustifyCenterV = 0x253,
452    ACJustifyBottom = 0x254,
453    ACJustifyBlockV = 0x255,
454    ACIndentDecrease = 0x256,
455    ACIndentIncrease = 0x257,
456    ACNumberedList = 0x258,
457    ACRestartNumbering = 0x259,
458    ACBulletedList = 0x25A,
459    ACPromote = 0x25B,
460    ACDemote = 0x25C,
461    ACYes = 0x25D,
462    ACNo = 0x25E,
463    ACCancel = 0x25F,
464    ACCatalog = 0x260,
465    ACBuyCheckout = 0x261,
466    ACAddToCart = 0x262,
467    ACExpand = 0x263,
468    ACExpandAll = 0x264,
469    ACCollapse = 0x265,
470    ACCollapseAll = 0x266,
471    ACPrintPreview = 0x267,
472    ACPasteSpecial = 0x268,
473    ACInsertMode = 0x269,
474    ACDelete = 0x26A,
475    ACLock = 0x26B,
476    ACUnlock = 0x26C,
477    ACProtect = 0x26D,
478    ACUnprotect = 0x26E,
479    ACAttachComment = 0x26F,
480    ACDeleteComment = 0x270,
481    ACViewComment = 0x271,
482    ACSelectWord = 0x272,
483    ACSelectSentence = 0x273,
484    ACSelectParagraph = 0x274,
485    ACSelectColumn = 0x275,
486    ACSelectRow = 0x276,
487    ACSelectTable = 0x277,
488    ACSelectObject = 0x278,
489    ACRedoRepeat = 0x279,
490    ACSort = 0x27A,
491    ACSortAscending = 0x27B,
492    ACSortDescending = 0x27C,
493    ACFilter = 0x27D,
494    ACSetClock = 0x27E,
495    ACViewClock = 0x27F,
496    ACSelectTimeZone = 0x280,
497    ACEditTimeZones = 0x281,
498    ACSetAlarm = 0x282,
499    ACClearAlarm = 0x283,
500    ACSnoozeAlarm = 0x284,
501    ACResetAlarm = 0x285,
502    ACSynchronize = 0x286,
503    ACSendReceive = 0x287,
504    ACSendTo = 0x288,
505    ACReply = 0x289,
506    ACReplyAll = 0x28A,
507    ACForwardMsg = 0x28B,
508    ACSend = 0x28C,
509    ACAttachFile = 0x28D,
510    ACUpload = 0x28E,
511    ACDownloadSaveTargetAs = 0x28F,
512    ACSetBorders = 0x290,
513    ACInsertRow = 0x291,
514    ACInsertColumn = 0x292,
515    ACInsertFile = 0x293,
516    ACInsertPicture = 0x294,
517    ACInsertObject = 0x295,
518    ACInsertSymbol = 0x296,
519    ACSaveAndClose = 0x297,
520    ACRename = 0x298,
521    ACMerge = 0x299,
522    ACSplit = 0x29A,
523    ACDistributeHorizontally = 0x29B,
524    ACDistributeVertically = 0x29C,
525    //0x29D-0xFFFF Reserved
526}
527
528impl Default for Consumer {
529    fn default() -> Self {
530        Self::Unassigned
531    }
532}
533
534/// Generic Desktop usage page
535///
536/// See [Universal Serial Bus (USB) HID Usage Tables Version 1.12](<https://www.usb.org/sites/default/files/documents/hut1_12v2.pdf>):
537/// Section 4 Desktop Page (0x01)
538#[cfg_attr(feature = "defmt", derive(defmt::Format))]
539#[derive(
540    Debug,
541    Copy,
542    Clone,
543    Eq,
544    PartialEq,
545    Ord,
546    PartialOrd,
547    Hash,
548    PrimitiveEnum,
549    IntoPrimitive,
550    FromPrimitive,
551)]
552#[repr(u8)]
553pub enum Desktop {
554    #[num_enum(default)]
555    Undefined = 0x00,
556    Pointer = 0x01,
557    Mouse = 0x02,
558    //0x03 Reserved
559    Joystick = 0x04,
560    GamePad = 0x05,
561    Keyboard = 0x06,
562    Keypad = 0x07,
563    MultiAxisController = 0x08,
564    TabletPcSystemControls = 0x09,
565    //0x0A-0x2F Reserved
566    X = 0x30,
567    Y = 0x31,
568    Z = 0x32,
569    Rx = 0x33,
570    Ry = 0x34,
571    Rz = 0x35,
572    Slider = 0x36,
573    Dial = 0x37,
574    Wheel = 0x38,
575    HatSwitch = 0x39,
576    CountedBuffer = 0x3A,
577    ByteCount = 0x3B,
578    MotionWakeup = 0x3C,
579    Start = 0x3D,
580    Select = 0x3E,
581    //0x3F-0x3F Reserved
582    Vx = 0x40,
583    Vy = 0x41,
584    Vz = 0x42,
585    Vbrx = 0x43,
586    Vbry = 0x44,
587    Vbrz = 0x45,
588    Vno = 0x46,
589    FeatureNotification = 0x47,
590    ResolutionMultiplier = 0x48,
591    //0x49-0x7F Reserved
592    SystemControl = 0x80,
593    SystemPowerDown = 0x81,
594    SystemSleep = 0x82,
595    SystemWakeUp = 0x83,
596    SystemContextMenu = 0x84,
597    SystemMainMenu = 0x85,
598    SystemAppMenu = 0x86,
599    SystemHelpMenu = 0x87,
600    SystemMenuExit = 0x88,
601    SystemMenuSelect = 0x89,
602    SystemMenuRight = 0x8A,
603    SystemMenuLeft = 0x8B,
604    SystemMenuUp = 0x8C,
605    SystemMenuDown = 0x8D,
606    SystemColdRestart = 0x8E,
607    SystemWarmRestart = 0x8F,
608    DPadUp = 0x90,
609    DPadDown = 0x91,
610    DPadRight = 0x92,
611    DPadLeft = 0x93,
612    //0x94-0xFFFF Reserved
613}
614
615impl Default for Desktop {
616    fn default() -> Self {
617        Self::Undefined
618    }
619}
620
621/// Game Controls usage page
622///
623/// See [Universal Serial Bus (USB) HID Usage Tables Version 1.12](<https://www.usb.org/sites/default/files/documents/hut1_12v2.pdf>):
624/// Section 4 Game Controls Page (0x05)
625#[cfg_attr(feature = "defmt", derive(defmt::Format))]
626#[derive(
627    Debug,
628    Copy,
629    Clone,
630    Eq,
631    PartialEq,
632    Ord,
633    Hash,
634    PartialOrd,
635    PrimitiveEnum,
636    IntoPrimitive,
637    FromPrimitive,
638)]
639#[repr(u8)]
640pub enum Game {
641    #[num_enum(default)]
642    Undefined = 0x00,
643    Game3DController = 0x01,
644    PinballDevice = 0x02,
645    GunDevice = 0x03,
646    //0x04-0x1F Reserved
647    PointOfView = 0x20,
648    TurnRightLeft = 0x21,
649    PitchRightLeft = 0x22,
650    RollForwardBackward = 0x23,
651    MoveRightLeft = 0x24,
652    MoveForwardBackward = 0x25,
653    MoveUpDown = 0x26,
654    LeanRightLeft = 0x27,
655    LeanForwardBackward = 0x28,
656    HeightOfPOV = 0x29,
657    Flipper = 0x2A,
658    SecondaryFlipper = 0x2B,
659    Bump = 0x2C,
660    NewGame = 0x2D,
661    ShootBall = 0x2E,
662    Player = 0x2F,
663    GunBolt = 0x30,
664    GunClip = 0x31,
665    GunSelector = 0x32,
666    GunSingleShot = 0x33,
667    GunBurst = 0x34,
668    GunAutomatic = 0x35,
669    GunSafety = 0x36,
670    GamePadFireJump = 0x37,
671    GamePadTrigger = 0x39,
672    //0x3A-0xFFFF Reserved
673}
674
675impl Default for Game {
676    fn default() -> Self {
677        Self::Undefined
678    }
679}
680
681/// Keyboard usage page
682///
683/// See [Universal Serial Bus (USB) HID Usage Tables Version 1.12](<https://www.usb.org/sites/default/files/documents/hut1_12v2.pdf>):
684/// Section 10 Keyboard/Keypad Page (0x04)
685///
686/// Naming from the specification has been preserved where possible but some names
687/// have been shortened or transliterated to be valid rust identifiers
688#[cfg_attr(feature = "defmt", derive(defmt::Format))]
689#[derive(
690    Debug,
691    Copy,
692    Clone,
693    Eq,
694    PartialEq,
695    Ord,
696    PartialOrd,
697    Hash,
698    PrimitiveEnum,
699    IntoPrimitive,
700    FromPrimitive,
701)]
702#[repr(u8)]
703pub enum Keyboard {
704    #[num_enum(default)]
705    NoEventIndicated = 0x00,
706    ErrorRollOver = 0x01,
707    POSTFail = 0x02,
708    ErrorUndefine = 0x03,
709    A = 0x04,
710    B = 0x05,
711    C = 0x06,
712    D = 0x07,
713    E = 0x08,
714    F = 0x09,
715    G = 0x0A,
716    H = 0x0B,
717    I = 0x0C,
718    J = 0x0D,
719    K = 0x0E,
720    L = 0x0F,
721    M = 0x10,
722    N = 0x11,
723    O = 0x12,
724    P = 0x13,
725    Q = 0x14,
726    R = 0x15,
727    S = 0x16,
728    T = 0x17,
729    U = 0x18,
730    V = 0x19,
731    W = 0x1A,
732    X = 0x1B,
733    Y = 0x1C,
734    Z = 0x1D,
735    Keyboard1 = 0x1E,
736    Keyboard2 = 0x1F,
737    Keyboard3 = 0x20,
738    Keyboard4 = 0x21,
739    Keyboard5 = 0x22,
740    Keyboard6 = 0x23,
741    Keyboard7 = 0x24,
742    Keyboard8 = 0x25,
743    Keyboard9 = 0x26,
744    Keyboard0 = 0x27,
745    ReturnEnter = 0x28,
746    Escape = 0x29,
747    DeleteBackspace = 0x2A,
748    Tab = 0x2B,
749    Space = 0x2C,
750    Minus = 0x2D,
751    Equal = 0x2E,
752    LeftBrace = 0x2F,
753    RightBrace = 0x30,
754    Backslash = 0x31,
755    NonUSHash = 0x32,
756    Semicolon = 0x33,
757    Apostrophe = 0x34,
758    Grave = 0x35,
759    Comma = 0x36,
760    Dot = 0x37,
761    ForwardSlash = 0x38,
762    CapsLock = 0x39,
763    F1 = 0x3A,
764    F2 = 0x3B,
765    F3 = 0x3C,
766    F4 = 0x3D,
767    F5 = 0x3E,
768    F6 = 0x3F,
769    F7 = 0x40,
770    F8 = 0x41,
771    F9 = 0x42,
772    F10 = 0x43,
773    F11 = 0x44,
774    F12 = 0x45,
775    PrintScreen = 0x46,
776    ScrollLock = 0x47,
777    Pause = 0x48,
778    Insert = 0x49,
779    Home = 0x4A,
780    PageUp = 0x4B,
781    DeleteForward = 0x4C,
782    End = 0x4D,
783    PageDown = 0x4E,
784    RightArrow = 0x4F,
785    LeftArrow = 0x50,
786    DownArrow = 0x51,
787    UpArrow = 0x52,
788    KeypadNumLockAndClear = 0x53,
789    KeypadDivide = 0x54,
790    KeypadMultiply = 0x55,
791    KeypadSubtract = 0x56,
792    KeypadAdd = 0x57,
793    KeypadEnter = 0x58,
794    Keypad1 = 0x59,
795    Keypad2 = 0x5A,
796    Keypad3 = 0x5B,
797    Keypad4 = 0x5C,
798    Keypad5 = 0x5D,
799    Keypad6 = 0x5E,
800    Keypad7 = 0x5F,
801    Keypad8 = 0x60,
802    Keypad9 = 0x61,
803    Keypad0 = 0x62,
804    KeypadDot = 0x63,
805    NonUSBackslash = 0x64,
806    Application = 0x65,
807    Power = 0x66,
808    KeypadEqual = 0x67,
809    F13 = 0x68,
810    F14 = 0x69,
811    F15 = 0x6A,
812    F16 = 0x6B,
813    F17 = 0x6C,
814    F18 = 0x6D,
815    F19 = 0x6E,
816    F20 = 0x6F,
817    F21 = 0x70,
818    F22 = 0x71,
819    F23 = 0x72,
820    F24 = 0x73,
821    Execute = 0x74,
822    Help = 0x75,
823    Menu = 0x76,
824    Select = 0x77,
825    Stop = 0x78,
826    Again = 0x79,
827    Undo = 0x7A,
828    Cut = 0x7B,
829    Copy = 0x7C,
830    Paste = 0x7D,
831    Find = 0x7E,
832    Mute = 0x7F,
833    VolumeUp = 0x80,
834    VolumeDown = 0x81,
835    LockingCapsLock = 0x82,
836    LockingNumLock = 0x83,
837    LockingScrollLock = 0x84,
838    KeypadComma = 0x85,
839    KeypadEqualSign = 0x86,
840    Kanji1 = 0x87,
841    Kanji2 = 0x88,
842    Kanji3 = 0x89,
843    Kanji4 = 0x8A,
844    Kanji5 = 0x8B,
845    Kanji6 = 0x8C,
846    Kanji7 = 0x8D,
847    Kanji8 = 0x8E,
848    Kanji9 = 0x8F,
849    LANG1 = 0x90,
850    LANG2 = 0x91,
851    LANG3 = 0x92,
852    LANG4 = 0x93,
853    LANG5 = 0x94,
854    LANG6 = 0x95,
855    LANG7 = 0x96,
856    LANG8 = 0x97,
857    LANG9 = 0x98,
858    AlternateErase = 0x99,
859    SysReqAttention = 0x9A,
860    Cancel = 0x9B,
861    Clear = 0x9C,
862    Prior = 0x9D,
863    Return = 0x9E,
864    Separator = 0x9F,
865    Out = 0xA0,
866    Oper = 0xA1,
867    ClearAgain = 0xA2,
868    CrSelProps = 0xA3,
869    ExSel = 0xA4,
870    //0xA5-0xDF Reserved
871    LeftControl = 0xE0,
872    LeftShift = 0xE1,
873    LeftAlt = 0xE2,
874    LeftGUI = 0xE3,
875    RightControl = 0xE4,
876    RightShift = 0xE5,
877    RightAlt = 0xE6,
878    RightGUI = 0xE7,
879    //0xE8-0xFFFF Reserved
880}
881
882impl Default for Keyboard {
883    fn default() -> Self {
884        Self::NoEventIndicated
885    }
886}
887
888/// Simulation Controls usage page
889///
890/// See [Universal Serial Bus (USB) HID Usage Tables Version 1.12](<https://www.usb.org/sites/default/files/documents/hut1_12v2.pdf>):
891/// Section 5 Simulation Controls Page (0x02)
892#[cfg_attr(feature = "defmt", derive(defmt::Format))]
893#[derive(
894    Debug,
895    Copy,
896    Clone,
897    Eq,
898    PartialEq,
899    Ord,
900    Hash,
901    PartialOrd,
902    PrimitiveEnum,
903    IntoPrimitive,
904    FromPrimitive,
905)]
906#[repr(u8)]
907pub enum Simulation {
908    #[num_enum(default)]
909    Undefined = 0x00,
910    FlightSimulationDevice = 0x01,
911    AutomobileSimulationDevice = 0x02,
912    TankSimulationDevice = 0x03,
913    SpaceshipSimulationDevice = 0x04,
914    SubmarineSimulationDevice = 0x05,
915    SailingSimulationDevice = 0x06,
916    MotorcycleSimulationDevice = 0x07,
917    SportsSimulationDevice = 0x08,
918    AirplaneSimulationDevice = 0x09,
919    HelicopterSimulationDevice = 0x0A,
920    MagicCarpetSimulationDevice = 0x0B,
921    Bicycle = 0x0C,
922    //0x0D-0x1F Reserved
923    FlightControlStick = 0x20,
924    FlightStick = 0x21,
925    CyclicControl = 0x22,
926    CyclicTrim = 0x23,
927    FlightYoke = 0x24,
928    TrackControl = 0x25,
929    DrivingControl = 0x26,
930    //0x27-0xCF Reserved
931    Aileron = 0xB0,
932    AileronTrim = 0xB1,
933    AntiTorqueControl = 0xB2,
934    AutoPilotEnable = 0xB3,
935    ChaffRelease = 0xB4,
936    CollectiveControl = 0xB5,
937    DiveBrake = 0xB6,
938    ElectronicCounterMeasures = 0xB7,
939    Elevator = 0xB8,
940    ElevatorTrim = 0xB9,
941    Rudder = 0xBA,
942    Throttle = 0xBB,
943    FlightCommunication = 0xBC,
944    FlareRelease = 0xBD,
945    LandingGear = 0xBE,
946    ToeBrake = 0xBF,
947    Trigger = 0xC0,
948    WeaponsArm = 0xC1,
949    WeaponsSelect = 0xC2,
950    WingFlaps = 0xC3,
951    Accelerator = 0xC4,
952    Brake = 0xC5,
953    Clutch = 0xC6,
954    Shifter = 0xC7,
955    Steering = 0xC8,
956    TurretDirection = 0xC9,
957    BarrelElevation = 0xCA,
958    DivePlane = 0xCB,
959    Ballast = 0xCC,
960    BicycleCrank = 0xCD,
961    HandleBars = 0xCE,
962    FrontBrake = 0xCF,
963    RearBrake = 0xD0,
964    //0xD1-0xFFFF Reserved
965}
966
967impl Default for Simulation {
968    fn default() -> Self {
969        Self::Undefined
970    }
971}
972
973/// Telephony Device usage page
974///
975/// See [Universal Serial Bus (USB) HID Usage Tables Version 1.12](<https://www.usb.org/sites/default/files/documents/hut1_12v2.pdf>):
976/// Section 14 Telephony Device  Page (0x0B)
977#[cfg_attr(feature = "defmt", derive(defmt::Format))]
978#[derive(
979    Debug,
980    Copy,
981    Clone,
982    Eq,
983    PartialEq,
984    Ord,
985    PartialOrd,
986    Hash,
987    PrimitiveEnum,
988    IntoPrimitive,
989    FromPrimitive,
990)]
991#[repr(u8)]
992pub enum Telephony {
993    #[num_enum(default)]
994    Unassigned = 0x00,
995    Phone = 0x01,
996    AnsweringMachine = 0x02,
997    MessageControls = 0x03,
998    Handset = 0x04,
999    Headset = 0x05,
1000    TelephonyKeyPad = 0x06,
1001    ProgrammableButton = 0x07,
1002    //0x08-0x1F Reserved
1003    HookSwitch = 0x20,
1004    Flash = 0x21,
1005    Feature = 0x22,
1006    Hold = 0x23,
1007    Redial = 0x24,
1008    Transfer = 0x25,
1009    Drop = 0x26,
1010    Park = 0x27,
1011    ForwardCalls = 0x28,
1012    AlternateFunction = 0x29,
1013    Line = 0x2A,
1014    SpeakerPhone = 0x2B,
1015    Conference = 0x2C,
1016    RingEnable = 0x2D,
1017    RingSelect = 0x2E,
1018    PhoneMute = 0x2F,
1019    CallerID = 0x30,
1020    Send = 0x31,
1021    //0x32-0x4F Reserved
1022    SpeedDial = 0x50,
1023    StoreNumber = 0x51,
1024    RecallNumber = 0x52,
1025    PhoneDirectory = 0x53,
1026    //0x54-0x6F Reserved
1027    VoiceMail = 0x70,
1028    ScreenCalls = 0x71,
1029    DoNotDisturb = 0x72,
1030    Message = 0x73,
1031    AnswerOnOff = 0x74,
1032    //0x75-0x8F Reserved
1033    InsideDialTone = 0x90,
1034    OutsideDialTone = 0x91,
1035    InsideRingTone = 0x92,
1036    OutsideRingTone = 0x93,
1037    PriorityRingTone = 0x94,
1038    InsideRingback = 0x95,
1039    PriorityRingback = 0x96,
1040    LineBusyTone = 0x97,
1041    ReorderTone = 0x98,
1042    CallWaitingTone = 0x99,
1043    ConfirmationTone1 = 0x9A,
1044    ConfirmationTone2 = 0x9B,
1045    TonesOff = 0x9C,
1046    OutsideRingback = 0x9D,
1047    Ringer = 0x9E,
1048    //0x9F-0xAF Reserved
1049    PhoneKey0 = 0xB0,
1050    PhoneKey1 = 0xB1,
1051    PhoneKey2 = 0xB2,
1052    PhoneKey3 = 0xB3,
1053    PhoneKey4 = 0xB4,
1054    PhoneKey5 = 0xB5,
1055    PhoneKey6 = 0xB6,
1056    PhoneKey7 = 0xB7,
1057    PhoneKey8 = 0xB8,
1058    PhoneKey9 = 0xB9,
1059    PhoneKeyStar = 0xBA,
1060    PhoneKeyPound = 0xBB,
1061    PhoneKeyA = 0xBC,
1062    PhoneKeyB = 0xBD,
1063    PhoneKeyC = 0xBE,
1064    PhoneKeyD = 0xBF,
1065    //0xC0-0xFFFF Reserved
1066}
1067impl Default for Telephony {
1068    fn default() -> Self {
1069        Self::Unassigned
1070    }
1071}