--- /dev/null
+<script>window.googleJavaScriptRedirect=1</script><script>var m={navigateTo:function(b,a,d){if(b!=a&&b.google){if(b.google.r){b.google.r=0;b.location.href=d;a.location.replace("about:blank");}}else{a.location.replace(d);}}};m.navigateTo(window.parent,window,"http://www.usb.org/developers/devclass_docs/HID1_11.pdf");
+</script><noscript><META http-equiv="refresh" content="0;URL='http://www.usb.org/developers/devclass_docs/HID1_11.pdf'"></noscript>
\ No newline at end of file
--- /dev/null
+ Generic Desktop
+ 0x00 Undefined
+ 0x01 Pointer
+ 0x02 Mouse
+ 0x03 Reserved
+ 0x04 Joystick
+ 0x05 Game Pad
+ 0x06 Keyboard
+ 0x07 Keypad
+ 0x08 Multi-axis Controller
+ 0x30 X
+ 0x31 Y
+ 0x32 Z
+ 0x33 Rx
+ 0x34 Ry
+ 0x35 Rz
+ 0x36 Slider
+ 0x37 Dial
+ 0x38 Wheel
+ 0x39 Hat Switch
+ 0x3A Counted Buffer
+ 0x3B Byte Count
+ 0x3C Motion Wakeup
+ 0x40 Vx
+ 0x41 Vy
+ 0x42 Vz
+ 0x43 Vbrx
+ 0x44 Vbry
+ 0x45 Vbrx
+ 0x46 Vno
+ 0x80 System Control
+ 0x81 System Power Down
+ 0x82 System Sleep
+ 0x83 System Wake Up
+ 0x84 System Context Menu
+ 0x85 System Main Menu
+ 0x86 System App Menu
+ 0x87 System Menu Help
+ 0x88 System Menu Exit
+ 0x89 System Menu Select
+ 0x8A System Menu Right
+ 0x8B System Menu Left
+ 0x8C System Menu Up
+ 0x8D System Menu Down
+ 0x90 D-pad Up
+ 0x91 D-pad Down
+ 0x92 D-pad Right
+ 0x93 D-pad Left
+
+2 Simulation Controls
+ 0x00 Undefined
+ 0x01 Flight Simulation Device
+ 0x02 Automobile Simulation Device
+ 0x03 Tank Simulation Device
+ 0x04 Spaceship Simulation Device
+ 0x05 Submarine Simulation Device
+ 0x06 Sailing Simulation Device
+ 0x07 Motorcycle Simulation Device
+ 0x08 Sports Simulation Device
+ 0x09 Airplane Simulation Device
+ 0x0A Helicopter Simulation Device
+ 0x0B Magic Carpet Simulation Device
+ 0x0C Bicycle
+ 0x20 Flight Control Stick
+ 0x21 Flight Stick
+ 0x22 Cyclic Control
+ 0x23 Cyclic Trim
+ 0x24 Flight Yoke
+ 0x25 Track Control
+ 0x26 Driving Control
+ 0xB0 Aileron
+ 0xB1 Aileron Trim
+ 0xB2 Anti-Torque Control
+ 0xB3 Auto-pilot Enable
+ 0xB4 Chaff Release
+ 0xB5 Collective Control
+ 0xB6 Dive Brake
+ 0xB7 Electronic Counter Measures
+ 0xB8 Elevator
+ 0xB9 Elevator Trim
+ 0xBA Rudder
+ 0xBB Throttle
+ 0xBC Flight Communication
+ 0xBD Flare Release
+ 0xBE Landing Gear
+ 0xBF Toe Brake
+ 0xC0 Trigger
+ 0xC1 Weapons Arm
+ 0xC2 Weapons Select
+ 0xC3 Wing Flaps
+ 0xC4 Accelerator
+ 0xC5 Brake
+ 0xC6 Clutch
+ 0xC7 Shifter
+ 0xC8 Steering
+ 0xC9 Turret Direction
+ 0xCA Barrel Elevation
+ 0xCB Dive Plane
+ 0xCC Ballast
+ 0xCD Bicycle Crank
+ 0xCE Handle Bars
+ 0xCF Front Brake
+ 0xD0 Rear Brake
+
+3 VR Controls
+ 0x00 Unidentified
+ 0x01 Belt
+ 0x02 Body Suit
+ 0x03 Flexor
+ 0x04 Glove
+ 0x05 Head Tracker
+ 0x06 Head Mounted Display
+ 0x07 Hand Tracker
+ 0x08 Oculometer
+ 0x09 Vest
+ 0x0A Animatronic Device
+ 0x20 Stereo Enable
+ 0x21 Display Enable
+
+4 Sports Controls
+ 0x00 Unidentified
+ 0x01 Baseball Bat
+ 0x02 Golf Club
+ 0x03 Rowing Machine
+ 0x04 Treadmill
+ 0x30 Oar
+ 0x31 Slope
+ 0x32 Rate
+ 0x33 Stick Speed
+ 0x34 Stick Face Angle
+ 0x35 Stick Heel/Toe
+ 0x36 Stick Follow Through
+ 0x37 Stick Tempo
+ 0x38 Stick Type
+ 0x39 Stick Height
+ 0x50 Putter
+ 0x51 1 Iron
+ 0x52 2 Iron
+ 0x53 3 Iron
+ 0x54 4 Iron
+ 0x55 5 Iron
+ 0x56 6 Iron
+ 0x57 7 Iron
+ 0x58 8 Iron
+ 0x59 9 Iron
+ 0x5A 10 Iron
+ 0x5B 11 Iron
+ 0x5C Sand Wedge
+ 0x5D Loft Wedge
+ 0x5E Power Wedge
+ 0x5F 1 Wood
+ 0x60 3 Wood
+ 0x61 5 Wood
+ 0x62 7 Wood
+ 0x63 9 Wood
+
+5 Game Controls
+ 0x00 Undefined
+ 0x01 3D Game Controller
+ 0x02 Pinball Device
+ 0x03 Gun Device
+ 0x20 Point of View
+ 0x21 Turn Right/Left
+ 0x22 Pitch Right/Left
+ 0x23 Roll Forward/Backward
+ 0x24 Move Right/Left
+ 0x25 Move Forward/Backward
+ 0x26 Move Up/Down
+ 0x27 Lean Right/Left
+ 0x28 Lean Forward/Backward
+ 0x29 Height of POV
+ 0x2A Flipper
+ 0x2B Secondary Flipper
+ 0x2C Bump
+ 0x2D New Game
+ 0x2E Shoot Ball
+ 0x2F Player
+ 0x30 Gun Bolt
+ 0x31 Gun Clip
+ 0x32 Gun Selector
+ 0x33 Gun Single Shot
+ 0x34 Gun Burst
+ 0x35 Gun Automatic
+ 0x36 Gun Safety
+ 0x37 Gamepad Fire/Jump
+ 0x39 Gamepad Trigger
+
+7 Keyboard
+ 0x00 Reserved (no event indicated)
+ 0x01 Keyboard ErrorRollOver
+ 0x02 Keyboard POSTFail
+ 0x03 Keyboard ErrorUndefined
+ 0x04 Keyboard a and A
+ 0x05 Keyboard b and B
+ 0x06 Keyboard c and C
+ 0x07 Keyboard d and D
+ 0x08 Keyboard e and E
+ 0x09 Keyboard f and F
+ 0x0A Keyboard g and G
+ 0x0B Keyboard h and H
+ 0x0C Keyboard i and I
+ 0x0D Keyboard j and J
+ 0x0E Keyboard k and K
+ 0x0F Keyboard l and L
+ 0x10 Keyboard m and M
+ 0x11 Keyboard n and N
+ 0x12 Keyboard o and O
+ 0x13 Keyboard p and P
+ 0x14 Keyboard q and Q
+ 0x15 Keyboard r and R
+ 0x16 Keyboard s and S
+ 0x17 Keyboard t and T
+ 0x18 Keyboard u and U
+ 0x19 Keyboard v and V
+ 0x1A Keyboard w and W
+ 0x1B Keyboard x and X
+ 0x1C Keyboard y and Y
+ 0x1D Keyboard z and Z
+ 0x1E Keyboard 1 and !
+ 0x1F Keyboard 2 and @
+ 0x20 Keyboard 3 and #
+ 0x21 Keyboard 4 and $
+ 0x22 Keyboard 5 and %
+ 0x23 Keyboard 6 and ^
+ 0x24 Keyboard 7 and &
+ 0x25 Keyboard 8 and *
+ 0x26 Keyboard 9 and (
+ 0x27 Keyboard 0 and )
+ 0x28 Keyboard Return (ENTER)
+ 0x29 Keyboard ESCAPE
+ 0x2A Keyboard DELETE (Backspace)
+ 0x2B Keyboard Tab
+ 0x2C Keyboard Spacebar
+ 0x2D Keyboard - and (underscore)
+ 0x2E Keyboard = and +
+ 0x2F Keyboard [ and {
+ 0x30 Keyboard ] and }
+ 0x31 Keyboard \ and |
+ 0x32 Keyboard Non-US # and ~
+ 0x33 Keyboard ; and :
+ 0x34 Keyboard ' and "
+ 0x35 Keyboard Grave Accent and Tilde
+ 0x36 Keyboard, and <
+ 0x37 Keyboard . and >
+ 0x38 Keyboard / and ?
+ 0x39 Keyboard Caps Lock
+ 0x3A Keyboard F1
+ 0x3B Keyboard F2
+ 0x3C Keyboard F3
+ 0x3D Keyboard F4
+ 0x3E Keyboard F5
+ 0x3F Keyboard F6
+ 0x40 Keyboard F7
+ 0x41 Keyboard F8
+ 0x42 Keyboard F9
+ 0x43 Keyboard F10
+ 0x44 Keyboard F11
+ 0x45 Keyboard F12
+ 0x46 Keyboard PrintScreen
+ 0x47 Keyboard Scroll Lock
+ 0x48 Keyboard Pause
+ 0x49 Keyboard Insert
+ 0x4A Keyboard Home
+ 0x4B Keyboard PageUp
+ 0x4C Keyboard Delete Forward
+ 0x4D Keyboard End
+ 0x4E Keyboard PageDown
+ 0x4F Keyboard RightArrow
+ 0x50 Keyboard LeftArrow
+ 0x51 Keyboard DownArrow
+ 0x52 Keyboard UpArrow
+ 0x53 Keypad Num Lock and Clear
+ 0x54 Keypad /
+ 0x55 Keypad *
+ 0x56 Keypad -
+ 0x57 Keypad +
+ 0x58 Keypad ENTER
+ 0x59 Keypad 1 and End
+ 0x5A Keypad 2 and Down Arrow
+ 0x5B Keypad 3 and PageDn
+ 0x5C Keypad 4 and Left Arrow
+ 0x5D Keypad 5
+ 0x5E Keypad 6 and Right Arrow
+ 0x5F Keypad 7 and Home
+ 0x60 Keypad 8 and Up Arrow
+ 0x61 Keypad 9 and PageUp
+ 0x62 Keypad 0 and Insert
+ 0x63 Keypad . and Delete
+ 0x64 Keyboard Non-US \ and |
+ 0x65 Keyboard Application
+ 0x66 Keyboard Power
+ 0x67 Keypad =
+ 0x68 Keyboard F13
+ 0x69 Keyboard F14
+ 0x6A Keyboard F15
+ 0x6B Keyboard F16
+ 0x6C Keyboard F17
+ 0x6D Keyboard F18
+ 0x6E Keyboard F19
+ 0x6F Keyboard F20
+ 0x70 Keyboard F21
+ 0x71 Keyboard F22
+ 0x72 Keyboard F23
+ 0x73 Keyboard F24
+ 0x74 Keyboard Execute
+ 0x75 Keyboard Help
+ 0x76 Keyboard Menu
+ 0x77 Keyboard Select
+ 0x78 Keyboard Stop
+ 0x79 Keyboard Again
+ 0x7A Keyboard Undo
+ 0x7B Keyboard Cut
+ 0x7C Keyboard Copy
+ 0x7D Keyboard Paste
+ 0x7E Keyboard Find
+ 0x7F Keyboard Mute
+ 0x80 Keyboard Volume Up
+ 0x81 Keyboard Volume Down
+ 0x82 Keyboard Locking Caps Lock
+ 0x83 Keyboard Locking Num Lock
+ 0x84 Keyboard Locking Scroll Lock
+ 0x85 Keypad Comma
+ 0x86 Keypad Equal Sign
+ 0x87 Keyboard International1
+ 0x88 Keyboard International2
+ 0x89 Keyboard International3
+ 0x8A Keyboard International4
+ 0x8B Keyboard International5
+ 0x8C Keyboard International6
+ 0x8D Keyboard International7
+ 0x8E Keyboard International8
+ 0x8F Keyboard International9
+ 0x90 Keyboard LANG1
+ 0x91 Keyboard LANG2
+ 0x92 Keyboard LANG3
+ 0x93 Keyboard LANG4
+ 0x94 Keyboard LANG5
+ 0x95 Keyboard LANG6
+ 0x96 Keyboard LANG7
+ 0x97 Keyboard LANG8
+ 0x98 Keyboard LANG9
+ 0x99 Keyboard Alternate Erase
+ 0x9A Keyboard SysReq/Attention
+ 0x9B Keyboard Cancel
+ 0x9C Keyboard Clear
+ 0x9D Keyboard Prior
+ 0x9E Keyboard Return
+ 0x9F Keyboard Separator
+ 0xA0 Keyboard Out
+ 0xA1 Keyboard Oper
+ 0xA2 Keyboard Clear/Again
+ 0xA3 Keyboard CrSel/Props
+ 0xA4 Keyboard ExSel
+ 0xE0 Keyboard LeftControl
+ 0xE1 Keyboard LeftShift
+ 0xE2 Keyboard LeftAlt
+ 0xE3 Keyboard Left GUI
+ 0xE4 Keyboard RightControl
+ 0xE5 Keyboard RightShift
+ 0xE6 Keyboard RightAlt
+ 0xE7 Keyboard Right GUI
+
+8 LEDs
+ 0x00 Undefined
+ 0x01 Num Lock
+ 0x02 Caps Lock
+ 0x03 Scroll Lock
+ 0x04 Compose
+ 0x05 Kana
+ 0x06 Power
+ 0x07 Shift
+ 0x08 Do Not Disturb
+ 0x09 Mute
+ 0x0A Tone Enable
+ 0x0B High Cut Filter
+ 0x0C Low Cut Filter
+ 0x0D Equalizer Enable
+ 0x0E Sound Field On
+ 0x0F Surround Field On
+ 0x10 Repeat
+ 0x11 Stereo
+ 0x12 Sampling Rate Detect
+ 0x13 Spinning
+ 0x14 CAV
+ 0x15 CLV
+ 0x16 Recording Format Detect
+ 0x17 Off-Hook
+ 0x18 Ring
+ 0x19 Message Waiting
+ 0x1A Data Mode
+ 0x1B Battery Operation
+ 0x1C Battery OK
+ 0x1D Battery Low
+ 0x1E Speaker
+ 0x1F Head Set
+ 0x20 Hold
+ 0x21 Microphone
+ 0x22 Coverage
+ 0x23 Night Mode
+ 0x24 Send Calls
+ 0x25 Call Pickup
+ 0x26 Conference
+ 0x27 Stand-by
+ 0x28 Camera On
+ 0x29 Camera Off
+ 0x2A On-Line
+ 0x2B Off-Line
+ 0x2C Busy
+ 0x2D Ready
+ 0x2E Paper-Out
+ 0x2F Paper-Jam
+ 0x30 Remote
+ 0x31 Forward
+ 0x32 Reverse
+ 0x33 Stop
+ 0x34 Rewind
+ 0x35 Fast Forward
+ 0x36 Play
+ 0x37 Pause
+ 0x38 Record
+ 0x39 Error
+ 0x3A Usage Selected Indicator
+ 0x3B Usage In Use Indicator
+ 0x3C Usage Multi Mode Indicator
+ 0x3D Indicator On
+ 0x3E Indicator Flash
+ 0x3F Indicator Slow Blink
+ 0x40 Indicator Fast Blink
+ 0x41 Indicator Off
+ 0x42 Flash On Time
+ 0x43 Slow Blink On Time
+ 0x44 Slow Blink Off Time
+ 0x45 Fast Blink On Time
+ 0x46 Fast Blink Off Time
+ 0x47 Usage Indicator Color
+ 0x48 Red
+ 0x49 Green
+ 0x4A Amber
+ 0x4B Generic Indicator
+ 0x4C System Suspend
+ 0x4D External Power Connected
+ 0x4C-FFFF Reserved
+
+9 Button
+ 0x00 No Button Pressed
+ * Button %d
+
+10 Ordinal
+ 0x00 Unused
+ * Instance %d
+
+11 Telephony
+ 0x00 Unassigned
+ 0x01 Phone
+ 0x02 Answering Machine
+ 0x03 Message Controls
+ 0x04 Handset
+ 0x05 Headset
+ 0x06 Telephony Key Pad
+ 0x07 Programmable Button
+ 0x20 Hook Switch
+ 0x21 Flash
+ 0x22 Feature
+ 0x23 Hold
+ 0x24 Redial
+ 0x25 Transfer
+ 0x26 Drop
+ 0x27 Park
+ 0x28 Forward Calls
+ 0x29 Alternate Function
+ 0x2A Line
+ 0x2B Speaker Phone
+ 0x2C Conference
+ 0x2D Ring Enable
+ 0x2E Ring Select
+ 0x2F Phone Mute
+ 0x30 Caller ID
+ 0x50 Speed Dial
+ 0x51 Store Number
+ 0x52 Recall Number
+ 0x53 Phone Directory
+ 0x70 Voice Mail
+ 0x71 Screen Calls
+ 0x72 Do Not Disturb
+ 0x73 Message
+ 0x74 Answer On/Off
+ 0x90 Inside Dial Tone
+ 0x91 Outside Dial Tone
+ 0x92 Inside Ring Tone
+ 0x93 Outside Ring Tone
+ 0x94 Priority Ring Tone
+ 0x95 Inside Ringback
+ 0x96 Priority Ringback
+ 0x97 Line Busy Tone
+ 0x98 Reorder Tone
+ 0x99 Call Waiting Tone
+ 0x9A Confirmation Tone 1
+ 0x9B Confirmation Tone 2
+ 0x9C Tones Off
+ 0xB0 Phone Key 0
+ 0xB1 Phone Key 1
+ 0xB2 Phone Key 2
+ 0xB3 Phone Key 3
+ 0xB4 Phone Key 4
+ 0xB5 Phone Key 5
+ 0xB6 Phone Key 6
+ 0xB7 Phone Key 7
+ 0xB8 Phone Key 8
+ 0xB9 Phone Key 9
+ 0xBA Phone Key Star
+ 0xBB Phone Key Pound
+ 0xBC Phone Key A
+ 0xBD Phone Key B
+ 0xBE Phone Key C
+ 0xBF Phone Key D
+
+12 Consumer
+ 0x00 Unassigned
+ 0x01 Consumer Control
+ 0x02 Numeric Key Pad
+ 0x03 Programmable Buttons
+ 0x20 +10
+ 0x21 +100
+ 0x22 AM/PM
+ 0x30 Power
+ 0x31 Reset
+ 0x32 Sleep
+ 0x33 Sleep After
+ 0x34 Sleep Mode
+ 0x35 Illumination
+ 0x36 Function Buttons
+ 0x40 Menu
+ 0x41 Menu Pick
+ 0x42 Menu Up
+ 0x43 Menu Down
+ 0x44 Menu Left
+ 0x45 Menu Right
+ 0x46 Menu Escape
+ 0x47 Menu Value Increase
+ 0x48 Menu Value Decrease
+ 0x60 Data On Screen
+ 0x61 Closed Caption
+ 0x62 Closed Caption Select
+ 0x63 VCR/TV
+ 0x64 Broadcast Mode
+ 0x65 Snapshot
+ 0x66 Still
+ 0x80 Selection
+ 0x81 Assign Selection
+ 0x82 Mode Step
+ 0x83 Recall Last
+ 0x84 Enter Channel
+ 0x85 Order Movie
+ 0x86 Channel
+ 0x87 Media Selection
+ 0x88 Media Select Computer
+ 0x89 Media Select TV
+ 0x8A Media Select WWW
+ 0x8B Media Select DVD
+ 0x8C Media Select Telephone
+ 0x8D Media Select Program Guide
+ 0x8E Media Select Video Phone
+ 0x8F Media Select Games
+ 0x90 Media Select Messages
+ 0x91 Media Select CD
+ 0x92 Media Select VCR
+ 0x93 Media Select Tuner
+ 0x94 Quit
+ 0x95 Help
+ 0x96 Media Select Tape
+ 0x97 Media Select Cable
+ 0x98 Media Select Satellite
+ 0x99 Media Select Security
+ 0x9A Media Select Home
+ 0x9B Media Select Call
+ 0x9C Channel Increment
+ 0x9D Channel Decrement
+ 0x9E Media Select SAP
+ 0xA0 VCR Plus
+ 0xA1 Once
+ 0xA2 Daily
+ 0xA3 Weekly
+ 0xA4 Monthly
+ 0xB0 Play
+ 0xB1 Pause
+ 0xB2 Record
+ 0xB3 Fast Forward
+ 0xB4 Rewind
+ 0xB5 Scan Next Track
+ 0xB6 Scan Previous Track
+ 0xB7 Stop
+ 0xB8 Eject
+ 0xB9 Random Play
+ 0xBA Select DisC
+ 0xBB Enter Disc
+ 0xBC Repeat
+ 0xBD Tracking
+ 0xBE Track Normal
+ 0xBF Slow Tracking
+ 0xC0 Frame Forward
+ 0xC1 Frame Back
+ 0xC2 Mark
+ 0xC3 Clear Mark
+ 0xC4 Repeat From Mark
+ 0xC5 Return To Mark
+ 0xC6 Search Mark Forward
+ 0xC7 Search Mark Backwards
+ 0xC8 Counter Reset
+ 0xC9 Show Counter
+ 0xCA Tracking Increment
+ 0xCB Tracking Decrement
+ 0xE0 Volume
+ 0xE1 Balance
+ 0xE2 Mute
+ 0xE3 Bass
+ 0xE4 Treble
+ 0xE5 Bass Boost
+ 0xE6 Surround Mode
+ 0xE7 Loudness
+ 0xE8 MPX
+ 0xE9 Volume Up
+ 0xEA Volume Down
+ 0xF0 Speed Select
+ 0xF1 Playback Speed
+ 0xF2 Standard Play
+ 0xF3 Long Play
+ 0xF4 Extended Play
+ 0xF5 Slow
+ 0x100 Fan Enable
+ 0x101 Fan Speed
+ 0x102 Light
+ 0x103 Light Illumination Level
+ 0x104 Climate Control Enable
+ 0x105 Room Temperature
+ 0x106 Security Enable
+ 0x107 Fire Alarm
+ 0x108 Police Alarm
+ 0x150 Balance Right
+ 0x151 Balance Left
+ 0x152 Bass Increment
+ 0x153 Bass Decrement
+ 0x154 Treble Increment
+ 0x155 Treble Decrement
+ 0x160 Speaker System
+ 0x161 Channel Left
+ 0x162 Channel Right
+ 0x163 Channel Center
+ 0x164 Channel Front
+ 0x165 Channel Center Front
+ 0x166 Channel Side
+ 0x167 Channel Surround
+ 0x168 Channel Low Frequency Enhancement
+ 0x169 Channel Top
+ 0x16A Channel Unknown
+ 0x170 Sub-channel
+ 0x171 Sub-channel Increment
+ 0x172 Sub-channel Decrement
+ 0x173 Alternate Audio Increment
+ 0x174 Alternate Audio Decrement
+ 0x180 Application Launch Buttons
+ 0x181 AL Launch Button Configuration Tool
+ 0x182 AL Programmable Button Configuration
+ 0x183 AL Consumer Control Configuration
+ 0x184 AL Word Processor
+ 0x185 AL Text Editor
+ 0x186 AL Spreadsheet
+ 0x187 AL Graphics Editor
+ 0x188 AL Presentation App
+ 0x189 AL Database App
+ 0x18A AL Email Reader
+ 0x18B AL Newsreader
+ 0x18C AL Voicemail
+ 0x18D AL Contacts/Address Book
+ 0x18E AL Calendar/Schedule
+ 0x18F AL Task/Project Manager
+ 0x190 AL Log/Journal/Timecard
+ 0x191 AL Checkbook/Finance
+ 0x192 AL Calculator
+ 0x193 AL A/V Capture/Playback
+ 0x194 AL Local Machine Browser
+ 0x195 AL LAN/WAN Browser
+ 0x196 AL Internet Browser
+ 0x197 AL Remote Networking/ISP Connect
+ 0x198 AL Network Conference
+ 0x199 AL Network Chat
+ 0x19A AL Telephony/Dialer
+ 0x19B AL Logon
+ 0x19C AL Logoff
+ 0x19D AL Logon/Logoff
+ 0x19E AL Terminal Lock/Screensaver
+ 0x19F AL Control Panel
+ 0x1A0 AL Command Line Processor/Run
+ 0x1A1 AL Process/Task Manager
+ 0x1A2 AL Select Tast/Application
+ 0x1A3 AL Next Task/Application
+ 0x1A4 AL Previous Task/Application
+ 0x1A5 AL Preemptive Halt Task/Application
+ 0x200 Generic GUI Application Controls
+ 0x201 AC New
+ 0x202 AC Open
+ 0x203 AC Close
+ 0x204 AC Exit
+ 0x205 AC Maximize
+ 0x206 AC Minimize
+ 0x207 AC Save
+ 0x208 AC Print
+ 0x209 AC Properties
+ 0x21A AC Undo
+ 0x21B AC Copy
+ 0x21C AC Cut
+ 0x21D AC Paste
+ 0x21E AC Select All
+ 0x21F AC Find
+ 0x220 AC Find and Replace
+ 0x221 AC Search
+ 0x222 AC Go To
+ 0x223 AC Home
+ 0x224 AC Back
+ 0x225 AC Forward
+ 0x226 AC Stop
+ 0x227 AC Refresh
+ 0x228 AC Previous Link
+ 0x229 AC Next Link
+ 0x22A AC Bookmarks
+ 0x22B AC History
+ 0x22C AC Subscriptions
+ 0x22D AC Zoom In
+ 0x22E AC Zoom Out
+ 0x22F AC Zoom
+ 0x230 AC Full Screen View
+ 0x231 AC Normal View
+ 0x232 AC View Toggle
+ 0x233 AC Scroll Up
+ 0x234 AC Scroll Down
+ 0x235 AC Scroll
+ 0x236 AC Pan Left
+ 0x237 AC Pan Right
+ 0x238 AC Pan
+ 0x239 AC New Window
+ 0x23A AC Tile Horizontally
+ 0x23B AC Tile Vertically
+ 0x23C AC Format
+
+13 Digitizer
+ 0x00 Undefined
+ 0x01 Digitizer
+ 0x02 Pen
+ 0x03 Light Pen
+ 0x04 Touch Screen
+ 0x05 Touch Pad
+ 0x06 White Board
+ 0x07 Coordinate Measuring Machine
+ 0x08 3-D Digitizer
+ 0x09 Stereo Plotter
+ 0x0A Articulated Arm
+ 0x0B Armature
+ 0x0C Multiple Point Digitizer
+ 0x0D Free Space Wand
+ 0x20 Stylus
+ 0x21 Puck
+ 0x22 Finger
+ 0x30 Tip Pressure
+ 0x31 Barrel Pressure
+ 0x32 In Range
+ 0x33 Touch
+ 0x34 Untouch
+ 0x35 Tap
+ 0x36 Quality
+ 0x37 Data Valid
+ 0x38 Transducer Index
+ 0x39 Tablet Function Keys
+ 0x3A Program Change Keys
+ 0x3B Battery Strength
+ 0x3C Invert
+ 0x3D X Tilt
+ 0x3E Y Tilt
+ 0x3F Azimuth
+ 0x40 Altitude
+ 0x41 Twist
+ 0x42 Tip Switch
+ 0x43 Secondary Tip Switch
+ 0x44 Barrel Switch
+ 0x45 Eraser
+ 0x46 Tablet Pick
+
+15 Physical Interface Device
+
+16 Unicode
+ * Unicode Char u%04x
+
+20 Alphnumeric Display
+ 0x00 Undefined
+ 0x01 Alphanumeric Display
+ 0x20 Display Attributes Report
+ 0x21 ASCII Character Set
+ 0x22 Data Read Back
+ 0x23 Font Read Back
+ 0x24 Display Control Report
+ 0x25 Clear Display
+ 0x26 Display Enable
+ 0x27 Screen Saver Delay
+ 0x28 Screen Saver Enable
+ 0x29 Vertical Scroll
+ 0x2A Horizontal Scroll
+ 0x2B Character Report
+ 0x2C Display Data
+ 0x2D Display Status
+ 0x2E Stat Not Ready
+ 0x2F Stat Ready
+ 0x30 Err Not a loadable character
+ 0x31 Err Font data cannot be read
+ 0x32 Cursor Position Report
+ 0x33 Row
+ 0x34 Column
+ 0x35 Rows
+ 0x36 Columns
+ 0x37 Cursor Pixel Positioning
+ 0x38 Cursor Mode
+ 0x39 Cursor Enable
+ 0x3A Cursor Blink
+ 0x3B Font Report
+ 0x3C Font Data
+ 0x3D Character Width
+ 0x3E Character Height
+ 0x3F Character Spacing Horizontal
+ 0x40 Character Spacing Vertical
+ 0x41 Unicode Character Set
+
+128 Monitor
+ 0x00 Undefined
+ 0x01 Monitor Control
+ 0x02 EDID Information
+ 0x03 VDIF Information
+ 0x04 VESA Version
+ 0x05 On Screen Display
+ 0x06 Auto Size Center
+ 0x07 Polarity Horz Synch
+ 0x08 Polarity Vert Synch
+ 0x09 Sync Type
+ 0x0A Screen Position
+ 0x0B Horizontal Frequency
+ 0x0C Vertical Frequency
+
+129 Monitor Enumerated Values
+ 0x00 unassigned
+ * ENUM %d
+
+130 VESA Virtual Controls
+ 0x10 Brightness
+ 0x12 Contrast
+ 0x16 Video Gain Red
+ 0x18 Video Gain Green
+ 0x1A Video Gain Blue
+ 0x1C Focus
+ 0x20 Horizontal Position
+ 0x22 Horizontal Size
+ 0x24 Horizontal Pincushion
+ 0x26 Horizontal Pincushion Balance
+ 0x28 Horizontal Misconvergence
+ 0x2A Horizontal Linearity
+ 0x2C Horizontal Linearity Balance
+ 0x30 Vertical Position
+ 0x32 Vertical Size
+ 0x34 Vertical Pincushion
+ 0x36 Vertical Pincushion Balance
+ 0x38 Vertical Misconvergence
+ 0x3A Vertical Linearity
+ 0x3C Vertical Linearity Balance
+ 0x40 Parallelogram Distortion
+ 0x42 Trapezoidal Distortion
+ 0x44 Tilt
+ 0x46 Top Corner Distortion Control
+ 0x48 Top Corner Distortion Balance
+ 0x4A Bottom Corner Distortion Control
+ 0x4C Bottom Corner Distortion Balance
+ 0x56 Moiré Horizontal
+ 0x58 Moiré Vertical
+ 0x5E Input Level Select
+ 0x60 Input Source Select
+ 0x62 Stereo Mode
+ 0x6C Video Black Level Red
+ 0x6E Video Black Level Green
+ 0x70 Video Black Level Blue
+
+131 VESA Command
+ 0x00 Undefined
+ 0x01 Settings
+ 0x02 Degauss
+
+132 Power Device
+ 0x00 Undefined
+ 0x01 iName
+ 0x02 PresentStatus
+ 0x03 ChangedStatus
+ 0x04 UPS
+ 0x05 PowerSupply
+ 0x10 BatterySystem
+ 0x11 BatterySystemID
+ 0x12 Battery
+ 0x13 BatteryID
+ 0x14 Charger
+ 0x15 ChargerID
+ 0x16 PowerConverter
+ 0x17 PowerConverterID
+ 0x18 OutletSystem
+ 0x19 OutletSystemID
+ 0x1A Input
+ 0x1B InputID
+ 0x1C Output
+ 0x1D OutputID
+ 0x1E Flow
+ 0x1F FlowID
+ 0x20 Outlet
+ 0x21 OutletID
+ 0x22 Gang
+ 0x23 GangID
+ 0x24 Sink
+ 0x25 SinkID
+ 0x30 Voltage
+ 0x31 Current
+ 0x32 Frequency
+ 0x33 ApparentPower
+ 0x34 ActivePower
+ 0x35 PercentLoad
+ 0x36 Temperature
+ 0x37 Humidity
+ 0x40 ConfigVoltage
+ 0x41 ConfigCurrent
+ 0x42 ConfigFrequency
+ 0x43 ConfigApparentPower
+ 0x44 ConfigActivePower
+ 0x45 ConfigPercentLoad
+ 0x46 ConfigTemperature
+ 0x47 ConfigHumidity
+ 0x50 SwitchOnControl
+ 0x51 SwitchOffControl
+ 0x52 ToggleControl
+ 0x53 LowVoltageTransfer
+ 0x54 HighVoltageTransfer
+ 0x55 DelayBeforeReboot
+ 0x56 DelayBeforeStartup
+ 0x57 DelayBeforeShutdown
+ 0x58 Test
+ 0x59 Vendorspecificcommand
+ 0x60 Present
+ 0x61 Good
+ 0x62 InternalFailure
+ 0x63 VoltageOutOfRange
+ 0x64 FrequencyOutOfRange
+ 0x65 Overload
+ 0x66 OverCharged
+ 0x67 OverTemperature
+ 0x68 ShutdownRequested
+ 0x69 ShutdownImminent
+ 0x6A VendorSpecificAnswerValid
+ 0x6B SwitchOn/Off
+ 0x6C Switcheble
+ 0x6D Used
+ 0x6E Boost
+ 0x6F Buck
+ 0x70 Initialized
+ 0x71 Tested
+
+133 Battery System
+ 0x00 Undefined
+ 0x01 SMBBatteryMode
+ 0x02 SMBBatteryStatus
+ 0x03 SMBAlarmWarning
+ 0x04 SMBChargerMode
+ 0x05 SMBChargerStatus
+ 0x06 SMBChargerSpecInfo
+ 0x07 SMBSelectorState
+ 0x08 SMBSelectorPreset
+ 0x09 SMBSelectorInfo
+ 0x10 OptionalMfgFunction1
+ 0x11 OptionalMfgFunction2
+ 0x12 OptionalMfgFunction3
+ 0x13 OptionalMfgFunction4
+ 0x14 OptionalMfgFunction5
+ 0x15 ConnectionToSMBus
+ 0x16 OutputConnection
+ 0x17 ChargerConnection
+ 0x18 BatteryInsertion
+ 0x19 Usenext
+ 0x1A OKToUse
+ 0x28 ManufacturerAccess
+ 0x29 RemainingCapacityLimit
+ 0x2A RemainingTimeLimit
+ 0x2B AtRate
+ 0x2C CapacityMode
+ 0x2D BroadcastToCharger
+ 0x2E PrimaryBattery
+ 0x2F ChargeController
+ 0x40 TerminateCharge
+ 0x41 TermminateDischarge
+ 0x42 BelowRemainingCapacityLimit
+ 0x43 RemainingTimeLimitExpired
+ 0x44 Charging
+ 0x45 Discharging
+ 0x46 FullyCharged
+ 0x47 FullyDischarged
+ 0x48 ConditionningFlag
+ 0x49 AtRateOK
+ 0x4A SMBErrorCode
+ 0x4B NeedReplacement
+ 0x60 AtRateTimeToFull
+ 0x61 AtRateTimeToEmpty
+ 0x62 AverageCurrent
+ 0x63 Maxerror
+ 0x64 RelativeStateOfCharge
+ 0x65 AbsoluteStateOfCharge
+ 0x66 RemainingCapacity
+ 0x67 FullChargeCapacity
+ 0x68 RunTimeToEmpty
+ 0x69 AverageTimeToEmpty
+ 0x6A AverageTimeToFull
+ 0x6B CycleCount
+ 0x80 BattPackModelLevel
+ 0x81 InternalChargeController
+ 0x82 PrimaryBatterySupport
+ 0x83 DesignCapacity
+ 0x84 SpecificationInfo
+ 0x85 ManufacturerDate
+ 0x86 SerialNumber
+ 0x87 iManufacturerName
+ 0x88 iDevicename
+ 0x89 iDeviceChemistery
+ 0x8A iManufacturerData
+ 0x8B Rechargeable
+ 0x8C WarningCapacityLimit
+ 0x8D CapacityGranularity1
+ 0x8E CapacityGranularity2
+ 0xC0 InhibitCharge
+ 0xC1 EnablePolling
+ 0xC2 ResetToZero
+ 0xD0 ACPresent
+ 0xD1 BatteryPresent
+ 0xD2 PowerFail
+ 0xD3 AlarmInhibited
+ 0xD4 ThermistorUnderRange
+ 0xD5 ThermistorHot
+ 0xD6 ThermistorCold
+ 0xD7 ThermistorOverRange
+ 0xD8 VoltageOutOfRange
+ 0xD9 CurrentOutOfRange
+ 0xDA CurrentNotRegulated
+ 0xDB VoltageNotRegulated
+ 0xDC MasterMode
+ 0xDD ChargerBattery/HostControlled
+ 0xF0 ChargerSpecInfo
+ 0xF1 ChargerSpecRef
+ 0xF2 Level2
+ 0xF3 Level3
+
+140 Bar Code Scanner
+
+141 Scale Device
+
+144 Camera Control
+
+145 Arcade Device
+
+# Some Micro$oft non-standard extensions
+0xff00 Microsoft
+ 0xe9 Base Up
+ 0xea Base Down
+
+# APC non-standard page? (1.6.2003) Riccardo "VIC" Torrini
+0xff84 __APC_Power Device
+ 0x00 Undefined
+ 0x01 iName
+ 0x02 PresentStatus
+ 0x03 ChangedStatus
+ 0x04 UPS
+ 0x05 PowerSupply
+ 0x10 BatterySystem
+ 0x11 BatterySystemID
+ 0x12 Battery
+ 0x13 BatteryID
+ 0x14 Charger
+ 0x15 ChargerID
+ 0x16 PowerConverter
+ 0x17 PowerConverterID
+ 0x18 OutletSystem
+ 0x19 OutletSystemID
+ 0x1A Input
+ 0x1B InputID
+ 0x1C Output
+ 0x1D OutputID
+ 0x1E Flow
+ 0x1F FlowID
+ 0x20 Outlet
+ 0x21 OutletID
+ 0x22 Gang
+ 0x23 GangID
+ 0x24 Sink
+ 0x25 SinkID
+ 0x30 Voltage
+ 0x31 Current
+ 0x32 Frequency
+ 0x33 ApparentPower
+ 0x34 ActivePower
+ 0x35 PercentLoad
+ 0x36 Temperature
+ 0x37 Humidity
+ 0x40 ConfigVoltage
+ 0x41 ConfigCurrent
+ 0x42 ConfigFrequency
+ 0x43 ConfigApparentPower
+ 0x44 ConfigActivePower
+ 0x45 ConfigPercentLoad
+ 0x46 ConfigTemperature
+ 0x47 ConfigHumidity
+ 0x50 SwitchOnControl
+ 0x51 SwitchOffControl
+ 0x52 ToggleControl
+ 0x53 LowVoltageTransfer
+ 0x54 HighVoltageTransfer
+ 0x55 DelayBeforeReboot
+ 0x56 DelayBeforeStartup
+ 0x57 DelayBeforeShutdown
+ 0x58 Test
+ 0x59 Vendorspecificcommand
+ 0x60 Present
+ 0x61 Good
+ 0x62 InternalFailure
+ 0x63 VoltageOutOfRange
+ 0x64 FrequencyOutOfRange
+ 0x65 Overload
+ 0x66 OverCharged
+ 0x67 OverTemperature
+ 0x68 ShutdownRequested
+ 0x69 ShutdownImminent
+ 0x6A VendorSpecificAnswerValid
+ 0x6B SwitchOn/Off
+ 0x6C Switcheble
+ 0x6D Used
+ 0x6E Boost
+ 0x6F Buck
+ 0x70 Initialized
+ 0x71 Tested
+
+0xff85 __APC_Battery System
+ 0x00 Undefined
+ 0x01 SMBBatteryMode
+ 0x02 SMBBatteryStatus
+ 0x03 SMBAlarmWarning
+ 0x04 SMBChargerMode
+ 0x05 SMBChargerStatus
+ 0x06 SMBChargerSpecInfo
+ 0x07 SMBSelectorState
+ 0x08 SMBSelectorPreset
+ 0x09 SMBSelectorInfo
+ 0x10 OptionalMfgFunction1
+ 0x11 OptionalMfgFunction2
+ 0x12 OptionalMfgFunction3
+ 0x13 OptionalMfgFunction4
+ 0x14 OptionalMfgFunction5
+ 0x15 ConnectionToSMBus
+ 0x16 OutputConnection
+ 0x17 ChargerConnection
+ 0x18 BatteryInsertion
+ 0x19 Usenext
+ 0x1A OKToUse
+ 0x28 ManufacturerAccess
+ 0x29 RemainingCapacityLimit
+ 0x2A RemainingTimeLimit
+ 0x2B AtRate
+ 0x2C CapacityMode
+ 0x2D BroadcastToCharger
+ 0x2E PrimaryBattery
+ 0x2F ChargeController
+ 0x40 TerminateCharge
+ 0x41 TermminateDischarge
+ 0x42 BelowRemainingCapacityLimit
+ 0x43 RemainingTimeLimitExpired
+ 0x44 Charging
+ 0x45 Discharging
+ 0x46 FullyCharged
+ 0x47 FullyDischarged
+ 0x48 ConditionningFlag
+ 0x49 AtRateOK
+ 0x4A SMBErrorCode
+ 0x4B NeedReplacement
+ 0x60 AtRateTimeToFull
+ 0x61 AtRateTimeToEmpty
+ 0x62 AverageCurrent
+ 0x63 Maxerror
+ 0x64 RelativeStateOfCharge
+ 0x65 AbsoluteStateOfCharge
+ 0x66 RemainingCapacity
+ 0x67 FullChargeCapacity
+ 0x68 RunTimeToEmpty
+ 0x69 AverageTimeToEmpty
+ 0x6A AverageTimeToFull
+ 0x6B CycleCount
+ 0x80 BattPackModelLevel
+ 0x81 InternalChargeController
+ 0x82 PrimaryBatterySupport
+ 0x83 DesignCapacity
+ 0x84 SpecificationInfo
+ 0x85 ManufacturerDate
+ 0x86 SerialNumber
+ 0x87 iManufacturerName
+ 0x88 iDevicename
+ 0x89 iDeviceChemistery
+ 0x8A iManufacturerData
+ 0x8B Rechargeable
+ 0x8C WarningCapacityLimit
+ 0x8D CapacityGranularity1
+ 0x8E CapacityGranularity2
+ 0xC0 InhibitCharge
+ 0xC1 EnablePolling
+ 0xC2 ResetToZero
+ 0xD0 ACPresent
+ 0xD1 BatteryPresent
+ 0xD2 PowerFail
+ 0xD3 AlarmInhibited
+ 0xD4 ThermistorUnderRange
+ 0xD5 ThermistorHot
+ 0xD6 ThermistorCold
+ 0xD7 ThermistorOverRange
+ 0xD8 VoltageOutOfRange
+ 0xD9 CurrentOutOfRange
+ 0xDA CurrentNotRegulated
+ 0xDB VoltageNotRegulated
+ 0xDC MasterMode
+ 0xDD ChargerBattery/HostControlled
+ 0xF0 ChargerSpecInfo
+ 0xF1 ChargerSpecRef
+ 0xF2 Level2
+ 0xF3 Level3
--- /dev/null
+0x05, 0x01, // Usage Page (Generic Desktop Ctrls)
+0x09, 0x04, // Usage (Joystick)
+0xA1, 0x01, // Collection (Physical)
+0xA1, 0x02, // Collection (Application)
+0x85, 0x01, // Report ID (1)
+0x75, 0x08, // Report Size (8)
+0x95, 0x01, // Report Count (1)
+0x15, 0x00, // Logical Minimum (0)
+0x26, 0xFF, 0x00, // Logical Maximum (255)
+0x81, 0x03, // Input (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
+0x75, 0x01, // Report Size (1)
+0x95, 0x13, // Report Count (19)
+0x15, 0x00, // Logical Minimum (0)
+0x25, 0x01, // Logical Maximum (1)
+0x35, 0x00, // Physical Minimum (0)
+0x45, 0x01, // Physical Maximum (1)
+0x05, 0x09, // Usage Page (Button)
+0x19, 0x01, // Usage Minimum (0x01)
+0x29, 0x13, // Usage Maximum (0x13)
+0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
+0x75, 0x01, // Report Size (1)
+0x95, 0x0D, // Report Count (13)
+0x06, 0x00, 0xFF, // Usage Page (Vendor Defined 0xFF00)
+0x81, 0x03, // Input (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
+0x15, 0x00, // Logical Minimum (0)
+0x26, 0xFF, 0x00, // Logical Maximum (255)
+0x05, 0x01, // Usage Page (Generic Desktop Ctrls)
+0x09, 0x01, // Usage (Pointer)
+0xA1, 0x00, // Collection (Undefined)
+0x75, 0x08, // Report Size (8)
+0x95, 0x04, // Report Count (4)
+0x35, 0x00, // Physical Minimum (0)
+0x46, 0xFF, 0x00, // Physical Maximum (255)
+0x09, 0x30, // Usage (X)
+0x09, 0x31, // Usage (Y)
+0x09, 0x32, // Usage (Z)
+0x09, 0x35, // Usage (Rz)
+0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
+0xC0, // End Collection
+0x05, 0x01, // Usage Page (Generic Desktop Ctrls)
+0x75, 0x08, // Report Size (8)
+0x95, 0x27, // Report Count (39)
+0x09, 0x01, // Usage (Pointer)
+0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
+0x75, 0x08, // Report Size (8)
+0x95, 0x30, // Report Count (48)
+0x09, 0x01, // Usage (Pointer)
+0x91, 0x02, // Output (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
+0x75, 0x08, // Report Size (8)
+0x95, 0x30, // Report Count (48)
+0x09, 0x01, // Usage (Pointer)
+0xB1, 0x02, // Feature (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
+0xC0, // End Collection
+0xA1, 0x02, // Collection (Application)
+0x85, 0x02, // Report ID (2)
+0x75, 0x08, // Report Size (8)
+0x95, 0x30, // Report Count (48)
+0x09, 0x01, // Usage (Pointer)
+0xB1, 0x02, // Feature (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
+0xC0, // End Collection
+0xA1, 0x02, // Collection (Application)
+0x85, 0xEE, // Report ID (238)
+0x75, 0x08, // Report Size (8)
+0x95, 0x30, // Report Count (48)
+0x09, 0x01, // Usage (Pointer)
+0xB1, 0x02, // Feature (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
+0xC0, // End Collection
+0xA1, 0x02, // Collection (Application)
+0x85, 0xEF, // Report ID (239)
+0x75, 0x08, // Report Size (8)
+0x95, 0x30, // Report Count (48)
+0x09, 0x01, // Usage (Pointer)
+0xB1, 0x02, // Feature (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
+0xC0, // End Collection
+0xC0, // End Collection
+
+// 148 bytes
--- /dev/null
+#include <iostream>
+#include <iomanip>
+#include <stdexcept>
+#include <stdint.h>
+
+#ifdef __INT64_TYPE__
+#define INTEGER_64
+#endif
+
+struct HIDRaw {
+public:
+ enum CollectionType {
+ Physical = 0,
+ Application = 1, // Mouse or keyboard.
+ Logical = 2, // Inter-related data.
+ Report = 3,
+ NamedArray = 4,
+ UsageSwitch = 5,
+ UsageModifier = 6,
+ ReservedStart = 7,
+ ReservedEnd = 0x7f,
+ VendorStart = 0x80,
+ VendorEnd = 0xff
+ };
+
+ enum GenericDesktop {
+ Undefined = 0x00,
+ Pointer = 0x01,
+ Mouse = 0x02,
+ Joystick = 0x04,
+ Game_Pad = 0x05,
+ Keyboard = 0x06,
+ Keypad = 0x07,
+ Multi_axis_Controller = 0x08,
+ X = 0x30,
+ Y = 0x31,
+ Z = 0x32,
+ Rx = 0x33,
+ Ry = 0x34,
+ Rz = 0x35,
+ Slider = 0x36,
+ Dial = 0x37,
+ Wheel = 0x38,
+ Hat_Switch = 0x39,
+ Counted_Buffer = 0x3A,
+ Byte_Count = 0x3B,
+ Motion_Wakeup = 0x3C,
+ Vx = 0x40,
+ Vy = 0x41,
+ Vz = 0x42,
+ Vbrx = 0x43,
+ Vbry = 0x44,
+ Vbrz = 0x45,
+ Vno = 0x46,
+ Feature_Notification = 0x47,
+ System_Control = 0x80,
+ System_Power_Down = 0x81,
+ System_Sleep = 0x82,
+ System_Wake_Up = 0x83,
+ System_Context_Menu = 0x84,
+ System_Main_Menu = 0x85,
+ System_App_Menu = 0x86,
+ System_Menu_Help = 0x87,
+ System_Menu_Exit = 0x88,
+ System_Menu_Select = 0x89,
+ System_Menu_Right = 0x8A,
+ System_Menu_Left = 0x8B,
+ System_Menu_Up = 0x8C,
+ System_Menu_Down = 0x8D,
+ D_pad_Up = 0x90,
+ D_pad_Down = 0x91,
+ D_pad_Right = 0x92,
+ D_pad_Left = 0x93
+ };
+
+ enum GlobalType {
+ UsagePage = 0,
+ LogicalMinimum = 1,
+ LogicalMaximum = 2,
+ PhysicalMinimum = 3,
+ PhysicalMaximum = 4,
+ UnitExponent = 5,
+ Unit = 6,
+ ReportSize = 7,
+ ReportID = 8,
+ ReportCount = 9,
+ Push = 10,
+ Pop = 11
+ };
+
+ enum LocalType {
+ Usage = 0,
+ UsageMinimum = 1,
+ UsageMaximum = 2,
+ DesignatorIndex = 3,
+ DesignatorMinimum = 4,
+ DesignatorMaximim = 5,
+ StringIndex = 7,
+ StringMinimum = 8,
+ StringMaximum = 9,
+ Delimiter = 10
+ };
+ enum MainType {
+ Input = 0x8,
+ Output = 0x9,
+ Feature = 0xb,
+ Collection = 0xa,
+ EndCollection = 0xc,
+ LongItem = 0x0f,
+ };
+
+ enum Type {
+ Main = 0,
+ Global = 1,
+ Local = 2
+ };
+
+ enum UsagePageTypes {
+ GenericDesktop = 1,
+ Button = 9
+ };
+
+ static const unsigned char SizeMap[4];
+
+private:
+ union {
+ unsigned char bData[260];
+ struct {
+ unsigned char bSize:2;
+ enum Type bType:2;
+ unsigned char bTag:4;
+ union {
+ struct {
+ unsigned char data_constant:1;
+ unsigned char array_variable:1;
+ unsigned char absolute_relative:1;
+ unsigned char wraps:1;
+ unsigned char nonLinear:1;
+ unsigned char noPreferredState:1;
+ unsigned char nullState:1;
+ unsigned char isVolatile:1;
+ unsigned char bitField_bufferedBytes:1;
+ };
+ struct {
+ unsigned char bDataSize;
+ unsigned char bLongTag;
+ };
+ };
+ };
+ };
+
+ void check_type(Type t) const {
+ if ( type() != t )
+ throw std::runtime_error("Type confusion");
+ }
+
+ std::ostream & print_flags(std::ostream & stream) const;
+ std::ostream & print_global(std::ostream & stream) const;
+ std::ostream & print_local(std::ostream & stream) const;
+ std::ostream & print_main(std::ostream & stream) const;
+
+ void numeric_size_error() const {
+ throw std::runtime_error("Number size error");
+ }
+public:
+ bool longItem() const {
+ return (MainType)bTag == LongItem;
+ }
+
+ static const char * collection_type_to_s(unsigned int type);
+
+ const unsigned char data(const unsigned char index) const {
+ if ( longItem() ) {
+ if ( index > bDataSize )
+ return 0;
+ else
+ return bData[index + 3];
+ }
+ else {
+ if ( index >= SizeMap[bSize] )
+ return 0;
+ else
+ return bData[index + 1];
+ }
+ }
+
+ unsigned char data_length() const {
+ if ( longItem() )
+ return bDataSize;
+ else {
+ return SizeMap[bSize];
+ }
+ }
+
+ GlobalType global_type() const {
+ check_type(Global);
+ return (GlobalType)tag();
+ }
+
+ static const char * global_type_to_s(GlobalType);
+
+ unsigned char item_length() const {
+ if ( longItem() )
+ return bDataSize + 3;
+ else
+ return SizeMap[bSize] + 1;
+ }
+
+ LocalType local_type() const {
+ check_type(Local);
+ return (LocalType)tag();
+ }
+
+ static const char * local_type_to_s(LocalType);
+
+ MainType main_type() const {
+ check_type(Main);
+ return (MainType)tag();
+ }
+
+ static const char * main_type_to_s(MainType);
+
+#ifdef INTEGER_64
+ int64_t
+#else
+ int32_t
+#endif
+ signed_integer() const {
+ switch ( data_length() ) {
+ case 0:
+ return 0;
+ case 1:
+ return (signed char)data(0);
+ case 2:
+ return (signed int16_t)
+ (data(1) << 8 )
+ | (data(0) & 0x00FF);
+ case 4:
+ return (signed int32_t)
+ (data(3) << 24 )
+ | (data(2) << 16 & 0x00FF0000)
+ | (data(1) << 8 & 0x0000FF00)
+ | (data(0) & 0x000000FF);
+#ifdef INTEGER_64
+ case 8:
+ return (int64_t)
+ ((int64_t)data(7) << 56 )
+ | ((int64_t)data(6) << 48 & 0x00FF000000000000L)
+ | ((int64_t)data(5) << 40 & 0x0000FF0000000000L)
+ | ((int64_t)data(4) << 32 & 0x000000FF00000000L)
+ | ((int64_t)data(3) << 24 & 0x00000000FF000000L)
+ | ((int64_t)data(2) << 16 & 0x0000000000FF0000L)
+ | ((int64_t)data(1) << 8 & 0x000000000000FF00L)
+ | ((int64_t)data(0) & 0x00000000000000FFL);
+#endif
+ default:
+ numeric_size_error();
+ return 0;
+ }
+ }
+
+#ifdef INTEGER_64
+ uint64_t
+#else
+ uint32_t
+#endif
+ unsigned_integer() const {
+ switch ( data_length() ) {
+ case 0:
+ return 0;
+ case 1:
+ return data(0);
+ case 2:
+ return
+ (data(1) << 8 & 0xFF00)
+ | (data(0) & 0x00FF);
+ case 4:
+ return
+ (data(3) << 24 & 0xFF000000)
+ | (data(2) << 16 & 0x00FF0000)
+ | (data(1) << 8 & 0x0000FF00)
+ | (data(0) & 0x000000FF);
+#ifdef INTEGER_64
+ case 8:
+ return (uint64_t)
+ ((uint64_t)data(7) << 56 & 0xFF00000000000000L)
+ | ((uint64_t)data(6) << 48 & 0x00FF000000000000L)
+ | ((uint64_t)data(5) << 40 & 0x0000FF0000000000L)
+ | ((uint64_t)data(4) << 32 & 0x000000FF00000000L)
+ | ((uint64_t)data(3) << 24 & 0x00000000FF000000L)
+ | ((uint64_t)data(2) << 16 & 0x0000000000FF0000L)
+ | ((uint64_t)data(1) << 8 & 0x000000000000FF00L)
+ | ((uint64_t)data(0) & 0x00000000000000FFL);
+#endif
+ default:
+ std::cerr << "Error: Numeric data with size "
+ << data_length() << '.' << std::endl;
+ return 0;
+ }
+ }
+
+ std::ostream & print(std::ostream & stream) const;
+
+ unsigned char tag() const {
+ if ( longItem() )
+ return bLongTag;
+ else
+ return bTag;
+ }
+
+ enum Type type() const {
+ return bType;
+ }
+};
+
+const unsigned char HIDRaw::SizeMap[4] = { 0, 1, 2, 4 };
+
+const char *
+HIDRaw::collection_type_to_s(unsigned int type)
+{
+ static const char * names[] = {
+ "Physical",
+ "Application",
+ "Logical",
+ "Report",
+ "NamedArray",
+ "UsageSwitch",
+ "UsageModifier",
+ "ReservedStart",
+ "ReservedEnd"
+ };
+
+ if ( type >= 0 && type <= sizeof(names) / sizeof(*names) )
+ return names[type];
+ else
+ return "Reserved";
+}
+
+const char *
+HIDRaw::global_type_to_s(GlobalType type) {
+ static const char * names[] = {
+ "UsagePage",
+ "LogicalMinimum",
+ "LogicalMaximum",
+ "PhysicalMinimum",
+ "PhysicalMaximum",
+ "UnitExponent",
+ "Unit",
+ "ReportSize",
+ "ReportID",
+ "ReportCount",
+ "Push",
+ "Pop"
+ };
+ if ( type >= UsagePage && type <= Pop )
+ return names[(unsigned char)type];
+ else
+ return "Reserved";
+}
+
+const char *
+HIDRaw::local_type_to_s(LocalType type) {
+ static const char * names[] = {
+ "Usage",
+ "UsageMinimum",
+ "UsageMaximum",
+ "DesignatorIndex",
+ "DesignatorMinimum",
+ "DesignatorMaximim",
+ "Reserved",
+ "StringIndex",
+ "StringMinimum",
+ "StringMaximum",
+ "Delimiter"
+ };
+ if ( type >= Usage && type <= Delimiter )
+ return names[(unsigned char)type];
+ else
+ return "Reserved";
+}
+
+const char *
+HIDRaw::main_type_to_s(MainType type) {
+ switch ( type ) {
+ case Input:
+ return "Input";
+ case Output:
+ return "Output";
+ case Feature:
+ return "Feature";
+ case Collection:
+ return "Collection";
+ case EndCollection:
+ return "EndCollection";
+ default:
+ return "Reserved";
+ }
+}
+
+std::ostream &
+HIDRaw::print(std::ostream & stream) const
+{
+ switch ( type() ) {
+ case Main:
+ return print_main(stream);
+ case Global:
+ return print_global(stream);
+ case Local:
+ return print_local(stream);
+ }
+}
+
+std::ostream &
+HIDRaw::print_flags(std::ostream & stream) const
+{
+ if ( data_constant )
+ stream << "Constant, ";
+ else
+ stream << "Data, ";
+ if ( array_variable )
+ stream << "Variable, ";
+ else
+ stream << "Array, ";
+ if ( absolute_relative )
+ stream << "Relative, ";
+ else
+ stream << "Absolute, ";
+ if ( wraps )
+ stream << "Wraps, ";
+ else
+ stream << "Does Not Wrap, ";
+ if ( nonLinear )
+ stream << "NonLinear, ";
+ else
+ stream << "Linear, ";
+ if ( noPreferredState )
+ stream << "No Preferred State, ";
+ else
+ stream << "Has a Preferred State, ";
+ if ( nullState )
+ stream << "Has a Null Position, ";
+ else
+ stream << "No Null Position, ";
+ if ( isVolatile )
+ stream << "Volatile, ";
+ else
+ stream << "Non Volatile, ";
+ if ( bitField_bufferedBytes )
+ stream << "Buffered Bytes";
+ else
+ stream << "Bit Field";
+}
+
+std::ostream &
+HIDRaw::print_global(std::ostream & stream) const
+{
+ stream << global_type_to_s(global_type());
+ stream << ' ';
+ switch ( global_type() ) {
+ case LogicalMinimum:
+ case LogicalMaximum:
+ case PhysicalMinimum:
+ case PhysicalMaximum:
+ case UnitExponent:
+ stream << signed_integer();
+ break;
+ default:
+ stream << unsigned_integer();
+ }
+ stream << std::endl;
+ return stream;
+}
+
+std::ostream &
+HIDRaw::print_local(std::ostream & stream) const
+{
+ stream << local_type_to_s(local_type());
+
+ if ( data_length() > 0 )
+ stream << ' ' << unsigned_integer();
+
+ stream << std::endl;
+
+ return stream;
+}
+
+std::ostream &
+HIDRaw::print_main(std::ostream & stream) const
+{
+ stream << main_type_to_s(main_type());
+
+ switch ( main_type() ) {
+ case Input:
+ case Output:
+ case Feature:
+ stream << ' ';
+ print_flags(stream);
+ stream << std::endl;
+ return stream;
+
+ case Collection:
+ stream << ' ' << collection_type_to_s(unsigned_integer()) << std::endl;
+ return stream;
+ case EndCollection:
+ break;
+ }
+
+ if ( data_length() > 0 )
+ stream << ' ' << unsigned_integer();
+
+ stream << std::endl;
+
+ return stream;
+}
+
+main()
+{
+ static const unsigned char descriptor[] = {
+ 0x05, 0x01, 0x09, 0x04, 0xA1, 0x01, 0xA1, 0x02,
+ 0x85, 0x01, 0x75, 0x08, 0x95, 0x01, 0x15, 0x00,
+ 0x26, 0xFF, 0x00, 0x81, 0x03, 0x75, 0x01, 0x95,
+ 0x13, 0x15, 0x00, 0x25, 0x01, 0x35, 0x00, 0x45,
+ 0x01, 0x05, 0x09, 0x19, 0x01, 0x29, 0x13, 0x81,
+ 0x02, 0x75, 0x01, 0x95, 0x0D, 0x06, 0x00, 0xFF,
+ 0x81, 0x03, 0x15, 0x00, 0x26, 0xFF, 0x00, 0x05,
+ 0x01, 0x09, 0x01, 0xA1, 0x00, 0x75, 0x08, 0x95,
+ 0x04, 0x35, 0x00, 0x46, 0xFF, 0x00, 0x09, 0x30,
+ 0x09, 0x31, 0x09, 0x32, 0x09, 0x35, 0x81, 0x02,
+ 0xC0, 0x05, 0x01, 0x75, 0x08, 0x95, 0x27, 0x09,
+ 0x01, 0x81, 0x02, 0x75, 0x08, 0x95, 0x30, 0x09,
+ 0x01, 0x91, 0x02, 0x75, 0x08, 0x95, 0x30, 0x09,
+ 0x01, 0xB1, 0x02, 0xC0, 0xA1, 0x02, 0x85, 0x02,
+ 0x75, 0x08, 0x95, 0x30, 0x09, 0x01, 0xB1, 0x02,
+ 0xC0, 0xA1, 0x02, 0x85, 0xEE, 0x75, 0x08, 0x95,
+ 0x30, 0x09, 0x01, 0xB1, 0x02, 0xC0, 0xA1, 0x02,
+ 0x85, 0xEF, 0x75, 0x08, 0x95, 0x30, 0x09, 0x01,
+ 0xB1, 0x02, 0xC0, 0xC0
+ };
+
+ for ( unsigned int i = 0; i < sizeof(descriptor); ) {
+ const HIDRaw * raw = (HIDRaw *)&descriptor[i];
+ raw->print(std::cout);
+ i += raw->item_length();
+ }
+ return 0;
+}