Skip to main content

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