# HG changeset patch # User StephaneLenclud # Date 1426447800 -3600 # Node ID e2acfa51664f0931d500ea033bdb26cae52698e2 # Parent cdc5f8f1b79ea74cc7670395c8470eb65db46570 Moving more files around. diff -r cdc5f8f1b79e -r e2acfa51664f Hid/Tables/HidUsageTableConsumer.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Hid/Tables/HidUsageTableConsumer.txt Sun Mar 15 20:30:00 2015 +0100 @@ -0,0 +1,382 @@ +00 Unassigned +01 Consumer Control CA 15.1 +02 Numeric Key Pad NAry 15.2 +03 Programmable Buttons NAry 15.14 +04 Microphone CA 15.1 +05 Headphone CA 15.1 +06 Graphic Equalizer CA 15.1 +07-1F Reserved +20 +10 OSC 15.2 +21 +100 OSC 15.2 +22 AM/PM OSC 15.2 +23-3F Reserved +30 Power OOC 15.3 +31 Reset OSC 15.3 +32 Sleep OSC 15.3 +33 Sleep After OSC 15.3 +34 Sleep Mode RTC 15.3 +35 Illumination OOC 15.3 +36 Function Buttons NAry 15.3 +37-3F Reserved +40 Menu OOC 15.4 +41 Menu Pick OSC 15.4 +42 Menu Up OSC 15.4 +43 Menu Down OSC 15.4 +44 Menu Left OSC 15.4 +45 Menu Right OSC 15.4 +46 Menu Escape OSC 15.4 +47 Menu Value Increase OSC 15.4 +48 Menu Value Decrease OSC 15.4 +49-5F Reserved +60 Data On Screen OOC 15.5 +61 Closed Caption OOC 15.5 +62 Closed Caption Select OSC 15.5 +63 VCR/TV OOC 15.5 +64 Broadcast Mode OSC 15.5 +65 Snapshot OSC 15.5 +66 Still OSC 15.5 +67-7F Reserved +80 Selection NAry 15.6 +81 Assign Selection OSC 15.6 +82 Mode Step OSC 15.6 +83 Recall Last OSC 15.6 +84 Enter Channel OSC 15.6 +85 Order Movie OSC 15.6 +86 Channel LC 15.6 +87 Media Selection NAry 15.6 +88 Media Select Computer Sel 15.6 +89 Media Select TV Sel 15.6 +8A Media Select WWW Sel 15.6 +8B Media Select DVD Sel 15.6 +8C Media Select Telephone Sel 15.6 +8D Media Select Program Guide Sel 15.6 +8E Media Select Video Phone Sel 15.6 +8F Media Select Games Sel 15.6 +90 Media Select Messages Sel 15.6 +91 Media Select CD Sel 15.6 +92 Media Select VCR Sel 15.6 +93 Media Select Tuner Sel 15.6 +94 Quit OSC 15.6 +95 Help OOC 15.6 +96 Media Select Tape Sel 15.6 +97 Media Select Cable Sel 15.6 +98 Media Select Satellite Sel 15.6 +99 Media Select Security Sel 15.6 +9A Media Select Home Sel 15.6 +9B Media Select Call Sel 15.6 +9C Channel Increment OSC 15.6 +9D Channel Decrement OSC 15.6 +9E Media Select SAP Sel 15.6 +9F Reserved +A0 VCR Plus OSC 15.6 +A1 Once OSC 15.6 +A2 Daily OSC 15.6 +A3 Weekly OSC 15.6 +A4 Monthly OSC 15.6 +A5-AF Reserved +B0 Play OOC 15.7 +B1 Pause OOC 15.7 +B2 Record OOC 15.7 +B3 Fast Forward OOC 15.7 +B4 Rewind OOC 15.7 +B5 Scan Next Track OSC 15.7 +B6 Scan Previous Track OSC 15.7 +B7 Stop OSC 15.7 +B8 Eject OSC 15.7 +B9 Random Play OOC 15.7 +BA Select Disc NAry 15.7 +BB Enter Disc MC 15.7 +BC Repeat OSC 15.7 +BD Tracking LC 15.7 +BE Track Normal OSC 15.7 +BF Slow Tracking LC 15.7 +C0 Frame Forward RTC 15.7 +C1 Frame Back RTC 15.7 +C2 Mark OSC 15.8 +C3 Clear Mark OSC 15.8 +C4 Repeat From Mark OOC 15.8 +C5 Return To Mark OSC 15.8 +C6 Search Mark Forward OSC 15.8 +C7 Search Mark Backwards OSC 15.8 +C8 Counter Reset OSC 15.8 +C9 Show Counter OSC 15.8 +CA Tracking Increment RTC 15.7 +CB Tracking Decrement RTC 15.7 +CC Stop/Eject OSC 15.7 +CD Play/Pause OSC 15.7 +CE Play/Skip OSC 15.7 +CF-DF Reserved +E0 Volume LC 15.9.1 +E1 Balance LC 15.9.2 +E2 Mute OOC 15.9.1 +E3 Bass LC 15.9.3 +E4 Treble LC 15.9.4 +E5 Bass Boost OOC 15.9.3 +E6 Surround Mode OSC 15.9.5 +E7 Loudness OOC 15.9.5 +E8 MPX OOC 15.9.5 +E9 Volume Increment RTC 15.9.1 +EA Volume Decrement RTC 15.9.1 +EB-EF Reserved +F0 Speed Select OSC 15.10 +F1 Playback Speed NAry 15.10 +F2 Standard Play Sel 15.10 +F3 Long Play Sel 15.10 +F4 Extended Play Sel 15.10 +F5 Slow OSC 15.10 +F6-FF Reserved +100 Fan Enable OOC 15.11 +101 Fan Speed LC 15.11 +102 Light Enable OOC 15.11 +103 Light Illumination Level LC 15.11 +104 Climate Control Enable OOC 15.11 +105 Room Temperature LC 15.11 +106 Security Enable OOC 15.11 +107 Fire Alarm OSC 15.11 +108 Police Alarm OSC 15.11 +109 Proximity LC 15.11 +10A Motion OSC 15.11 +10B Duress Alarm OSC 15.11 +10C Holdup Alarm OSC 15.11 +10D Medical Alarm OSC 15.11 +10E-14F Reserved +150 Balance Right RTC 15.9.2 +151 Balance Left RTC 15.9.2 +152 Bass Increment RTC 15.9.3 +153 Bass Decrement RTC 15.9.3 +154 Treble Increment RTC 15.9.4 +155 Treble Decrement RTC 15.9.4 +156-15F Reserved +160 Speaker System CL 15.12.1 +161 Channel Left CL 15.12.1 +162 Channel Right CL 15.12.1 +163 Channel Center CL 15.12.1 +164 Channel Front CL 15.12.1 +165 Channel Center Front CL 15.12.1 +166 Channel Side CL 15.12.1 +167 Channel Surround CL 15.12.1 +168 Channel Low Frequency Enhancement CL 15.12.1 +169 Channel Top CL 15.12.1 +16A Channel Unknown CL 15.12.1 +16B-16F Reserved +170 Sub-channel LC 15.13 +171 Sub-channel Increment OSC 15.13 +172 Sub-channel Decrement OSC 15.13 +173 Alternate Audio Increment OSC 15.13 +174 Alternate Audio Decrement OSC 15.13 +175-17F Reserved +180 Application Launch Buttons NAry 15.15 +181 AL Launch Button Configuration Tool Sel 15.15 +182 AL Programmable Button Configuration Sel 15.15 +183 AL Consumer Control Configuration Sel 15.15 +184 AL Word Processor Sel 15.15 +185 AL Text Editor Sel 15.15 +186 AL Spreadsheet Sel 15.15 +187 AL Graphics Editor Sel 15.15 +188 AL Presentation App Sel 15.15 +189 AL Database App Sel 15.15 +18A AL Email Reader Sel 15.15 +18B AL Newsreader Sel 15.15 +18C AL Voicemail Sel 15.15 +18D AL Contacts/Address Book Sel 15.15 +18E AL Calendar/Schedule Sel 15.15 +18F AL Task/Project Manager Sel 15.15 +190 AL Log/Journal/Timecard Sel 15.15 +191 AL Checkbook/Finance Sel 15.15 +192 AL Calculator Sel 15.15 +193 AL A/V Capture/Playback Sel 15.15 +194 AL Local Machine Browser Sel 15.15 +195 AL LAN/WAN Browser Sel 15.15 +196 AL Internet Browser Sel 15.15 +197 AL Remote Networking/ISP Connect Sel 15.15 +198 AL Network Conference Sel 15.15 +199 AL Network Chat Sel 15.15 +19A AL Telephony/Dialer Sel 15.15 +19B AL Logon Sel 15.15 +19C AL Logoff Sel 15.15 +19D AL Logon/Logoff Sel 15.15 +19E AL Terminal Lock/Screensaver Sel 15.15 +19F AL Control Panel Sel 15.15 +1A0 AL Command Line Processor/Run Sel 15.15 +1A1 AL Process/Task Manager Sel 15.15 +1A2 AL Select Task/Application Sel 15.15 +1A3 AL Next Task/Application Sel 15.15 +1A4 AL Previous Task/Application Sel 15.15 +1A5 AL Preemptive Halt Task/Application Sel 15.15 +1A6 AL Integrated Help Center Sel 15.15 +1A7 AL Documents Sel 15.15 +1A8 AL Thesaurus Sel 15.15 +1A9 AL Dictionary Sel 15.15 +1AA AL Desktop Sel 15.15 +1AB AL Spell Check Sel 15.15 +1AC AL Grammar Check Sel 15.15 +1AD AL Wireless Status Sel 15.15 +1AE AL Keyboard Layout Sel 15.15 +1AF AL Virus Protection Sel 15.15 +1B0 AL Encryption Sel 15.15 +1B1 AL Screen Saver Sel 15.15 +1B2 AL Alarms Sel 15.15 +1B3 AL Clock Sel 15.15 +1B4 AL File Browser Sel 15.15 +1B5 AL Power Status Sel 15.15 +1B6 AL Image Browser Sel 15.15 +1B7 AL Audio Browser Sel 15.15 +1B8 AL Movie Browser Sel 15.15 +1B9 AL Digital Rights Manager Sel 15.15 +1BA AL Digital Wallet Sel 15.15 +1BB Reserved +1BC AL Instant Messaging Sel 15.15 +1BD AL OEM Features/ Tips/Tutorial Browser Sel 15.15 +1BE AL OEM Help Sel 15.15 +1BF AL Online Community Sel 15.15 +1C0 AL Entertainment Content Browser Sel 15.15 +1C1 AL Online Shopping Browser Sel 15.15 +1C2 AL SmartCard Information/Help Sel 15.15 +1C3 AL Market Monitor/Finance Browser Sel 15.15 +1C4 AL Customized Corporate News Browser Sel 15.15 +1C5 AL Online Activity Browser Sel 15.15 +1C6 AL Research/Search Browser Sel 15.15 +1C7 AL Audio Player Sel 15.15 +1C8-1FF Reserved +200 Generic GUI Application Controls Nary 15.16 +201 AC New Sel 15.16 +202 AC Open Sel 15.16 +203 AC Close Sel 15.16 +204 AC Exit Sel 15.16 +205 AC Maximize Sel 15.16 +206 AC Minimize Sel 15.16 +207 AC Save Sel 15.16 +208 AC Print Sel 15.16 +209 AC Properties Sel 15.16 +21A AC Undo Sel 15.16 +21B AC Copy Sel 15.16 +21C AC Cut Sel 15.16 +21D AC Paste Sel 15.16 +21E AC Select All Sel 15.16 +21F AC Find Sel 15.16 +220 AC Find and Replace Sel 15.16 +221 AC Search Sel 15.16 +222 AC Go To Sel 15.16 +223 AC Home Sel 15.16 +224 AC Back Sel 15.16 +225 AC Forward Sel 15.16 +226 AC Stop Sel 15.16 +227 AC Refresh Sel 15.16 +228 AC Previous Link Sel 15.16 +229 AC Next Link Sel 15.16 +22A AC Bookmarks Sel 15.16 +22B AC History Sel 15.16 +22C AC Subscriptions Sel 15.16 +22D AC Zoom In Sel 15.16 +22E AC Zoom Out Sel 15.16 +22F AC Zoom LC 15.16 +230 AC Full Screen View Sel 15.16 +231 AC Normal View Sel 15.16 +232 AC View Toggle Sel 15.16 +233 AC Scroll Up Sel 15.16 +234 AC Scroll Down Sel 15.16 +235 AC Scroll LC 15.16 +236 AC Pan Left Sel 15.16 +237 AC Pan Right Sel 15.16 +238 AC Pan LC 15.16 +239 AC New Window Sel 15.16 +23A AC Tile Horizontally Sel 15.16 +23B AC Tile Vertically Sel 15.16 +23C AC Format Sel 15.16 +23D AC Edit Sel 15.14 +23E AC Bold Sel 15.16 +23F AC Italics Sel 15.16 +240 AC Underline Sel 15.16 +241 AC Strikethrough Sel 15.16 +242 AC Subscript Sel 15.16 +243 AC Superscript Sel 15.16 +244 AC All Caps Sel 15.16 +245 AC Rotate Sel 15.16 +246 AC Resize Sel 15.16 +247 AC Flip horizontal Sel 15.16 +248 AC Flip Vertical Sel 15.16 +249 AC Mirror Horizontal Sel 15.16 +24A AC Mirror Vertical Sel 15.16 +24B AC Font Select Sel 15.16 +24C AC Font Color Sel 15.16 +24D AC Font Size Sel 15.16 +24E AC Justify Left Sel 15.16 +24F AC Justify Center H Sel 15.16 +250 AC Justify Right Sel 15.16 +251 AC Justify Block H Sel 15.16 +252 AC Justify Top Sel 15.16 +253 AC Justify Center V Sel 15.16 +254 AC Justify Bottom Sel 15.16 +255 AC Justify Block V Sel 15.16 +256 AC Indent Decrease Sel 15.16 +257 AC Indent Increase Sel 15.16 +258 AC Numbered List Sel 15.16 +259 AC Restart Numbering Sel 15.16 +25A AC Bulleted List Sel 15.16 +25B AC Promote Sel 15.16 +25C AC Demote Sel 15.16 +25D AC Yes Sel 15.16 +25E AC No Sel 15.16 +25F AC Cancel Sel 15.16 +260 AC Catalog Sel 15.16 +261 AC Buy/Checkout Sel 15.16 +262 AC Add to Cart Sel 15.16 +263 AC Expand Sel 15.16 +264 AC Expand All Sel 15.16 +265 AC Collapse Sel 15.16 +266 AC Collapse All Sel 15.16 +267 AC Print Preview Sel 15.16 +268 AC Paste Special Sel 15.16 +269 AC Insert Mode Sel 15.16 +26A AC Delete Sel 15.16 +26B AC Lock Sel 15.16 +26C AC Unlock Sel 15.16 +26D AC Protect Sel 15.16 +26E AC Unprotect Sel 15.16 +26F AC Attach Comment Sel 15.16 +270 AC Delete Comment Sel 15.16 +271 AC View Comment Sel 15.16 +272 AC Select Word Sel 15.16 +273 AC Select Sentence Sel 15.16 +274 AC Select Paragraph Sel 15.16 +275 AC Select Column Sel 15.16 +276 AC Select Row Sel 15.16 +277 AC Select Table Sel 15.16 +278 AC Select Object Sel 15.16 +279 AC Redo/Repeat Sel 15.16 +27A AC Sort Sel 15.16 +27B AC Sort Ascending Sel 15.16 +27C AC Sort Descending Sel 15.16 +27D AC Filter Sel 15.16 +27E AC Set Clock Sel 15.16 +27F AC View Clock Sel 15.16 +280 AC Select Time Zone Sel 15.16 +281 AC Edit Time Zones Sel 15.16 +282 AC Set Alarm Sel 15.16 +283 AC Clear Alarm Sel 15.16 +284 AC Snooze Alarm Sel 15.16 +285 AC Reset Alarm Sel 15.16 +286 AC Synchronize Sel 15.16 +287 AC Send/Receive Sel 15.16 +288 AC Send To Sel 15.16 +289 AC Reply Sel 15.16 +28A AC Reply All Sel 15.16 +28B AC Forward Msg Sel 15.16 +28C AC Send Sel 15.16 +28D AC Attach File Sel 15.16 +28E AC Upload Sel 15.16 +28F AC Download Save Target As Sel 15.16 +290 AC Set Borders Sel 15.16 +291 AC Insert Row Sel 15.16 +292 AC Insert Column Sel 15.16 +293 AC Insert File Sel 15.16 +294 AC Insert Picture Sel 15.16 +295 AC Insert Object Sel 15.16 +296 AC Insert Symbol Sel 15.16 +297 AC Save and Close Sel 15.16 +298 AC Rename Sel 15.16 +299 AC Merge Sel 15.16 +29A AC Split Sel 15.16 +29B AC Distribute Horizontally Sel 15.16 +29C AC Distribute Vertically Sel 15.16 +29D-FFFF Reserved \ No newline at end of file diff -r cdc5f8f1b79e -r e2acfa51664f Hid/Tables/HidUsageTableGameControls.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Hid/Tables/HidUsageTableGameControls.txt Sun Mar 15 20:30:00 2015 +0100 @@ -0,0 +1,31 @@ +00 Undefined +01 3D Game Controller CA 8.1 +02 Pinball Device CA 8.2 +03 Gun Device CA 8.3 +04-1F Reserved +20 Point of View CP 8.1 +21 Turn Right/Left DV 8.1 +22 Pitch Forward/Backward DV 8.1 +23 Roll Right/Left DV 8.1 +24 Move Right/Left DV 8.1 +25 Move Forward/Backward DV 8.1 +26 Move Up/Down DV 8.1 +27 Lean Right/Left DV 8.1 +28 Lean Forward/Backward DV 8.1 +29 Height of POV DV 8.1 +2A Flipper MC 8.2 +2B Secondary Flipper MC 8.2 +2C Bump MC 8.2 +2D New Game OSC 8.2 +2E Shoot Ball OSC 8.2 +2F Player OSC 8.2 +30 Gun Bolt OOC 8.3 +31 Gun Clip OOC 8.3 +32 Gun Selector NAry 8.3 +33 Gun Single Shot Sel 8.3 +34 Gun Burst Sel 8.3 +35 Gun Automatic Sel 8.3 +36 Gun Safety OOC 8.3 +37 Gamepad Fire/Jump CL 8.4.1 +39 Gamepad Trigger CL 8.4.1 +3A-FFFF Reserved \ No newline at end of file diff -r cdc5f8f1b79e -r e2acfa51664f Hid/Tables/HidUsageTableGenericDesktop.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Hid/Tables/HidUsageTableGenericDesktop.txt Sun Mar 15 20:30:00 2015 +0100 @@ -0,0 +1,75 @@ +00 Undefined +01 Pointer CP 4.1 +02 Mouse CA 4.1 03 Reserved +04 Joystick CA 4.1 +05 Game Pad CA 4.1 +06 Keyboard CA 4.1 +07 Keypad CA 4.1 +08 Multi-axis Controller CA 4.1 +09 Tablet PC System Controls CA 4.1 +0A-2F Reserved +30 X DV 4.2 +31 Y DV 4.2 +32 Z DV 4.2 +33 Rx DV 4.2 +34 Ry DV 4.2 +35 Rz DV 4.2 +36 Slider DV 4.3 +37 Dial DV 4.3 +38 Wheel DV 4.3 +39 Hat switch DV 4.3 +3A Counted Buffer CL 4.6 +3B Byte Count DV 4.6 +3C Motion Wakeup OSC 4.3 +3D Start OOC 4.3 +3E Select OOC 4.3 3F Reserved +40 Vx DV 4.3.1 +41 Vy DV 4.3.1 +42 Vz DV 4.3.1 +43 Vbrx DV 4.3.1 +44 Vbry DV 4.3.1 +45 Vbrz DV 4.3.1 +46 Vno DV 4.3.1 +47 Feature Notification DV,DF 4.8 +48 Resolution Multiplier DV +49-7F Reserved +80 System Control CA 4.5 +81 System Power Down OSC 4.5 +82 System Sleep OSC 4.5.1 +83 System Wake Up OSC 4.5.1 +84 System Context Menu OSC 4.5 +85 System Main Menu OSC 4.5 +86 System App Menu OSC 4.5 +87 System Menu Help OSC 4.5 +88 System Menu Exit OSC 4.5 +89 System Menu Select OSC 4.5 +8A System Menu Right RTC 4.5 +8B System Menu Left RTC 4.5 +8C System Menu Up RTC 4.5 +8D System Menu Down RTC 4.5 +8E System Cold Restart OSC 4.5.1 +8F System Warm Restart OSC 4.5.1 +90 D-pad Up OOC 4.7 +91 D-pad Down OOC 4.7 +92 D-pad Right OOC 4.7 +93 D-pad Left OOC 4.7 +94-9F Reserved +A0 System Dock OSC 4.5.1 +A1 System Undock OSC 4.5.1 +A2 System Setup OSC 4.5.1 +A3 System Break OSC 4.9 +A4 System Debugger Break OSC 4.9 +A5 Application Break OSC 4.9 +A6 Application Debugger Break OSC 4.9 +A7 System Speaker Mute OSC 4.5.1 +A8 System Hibernate OSC 4.5.1 +A9-AF Reserved +B0 System Display Invert OSC 4.10 +B1 System Display Internal OSC 4.10 +B2 System Display External OSC 4.10 +B3 System Display Both OSC 4.10 +B4 System Display Dual OSC 4.10 +B5 System Display Toggle Int/Ext OSC 4.10 +B6 System Display Swap Primary/Secondary OSC 4.10 +B7 System Display LCD Autoscale OSC 4.10 +B8-FFFF Reserved \ No newline at end of file diff -r cdc5f8f1b79e -r e2acfa51664f Hid/Tables/HidUsageTableSimulationControls.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Hid/Tables/HidUsageTableSimulationControls.txt Sun Mar 15 20:30:00 2015 +0100 @@ -0,0 +1,55 @@ +00 Undefined +01 Flight Simulation Device CA 5.2 +02 Automobile Simulation Device CA 5.3 +03 Tank Simulation Device CA 5.4 +04 Spaceship Simulation Device CA 5.2 +05 Submarine Simulation Device CA 5.5 +06 Sailing Simulation Device CA 5.5 +07 Motorcycle Simulation Device CA 5.6 +08 Sports Simulation Device CA 5.1 +09 Airplane Simulation Device CA 5.2 +0A Helicopter Simulation Device CA 5.2 +0B Magic Carpet Simulation Device CA 5.7 +0C Bicycle Simulation Device CA 5.6 +0D – 1F Reserved +20 Flight Control Stick CA 5.2 +21 Flight Stick CA 5.2 +22 Cyclic Control CP 5.2 +23 Cyclic Trim CP 5.2 +24 Flight Yoke CA 5.2 +25 Track Control CP 5.4 +26 –AF Reserved +B0 Aileron DV 5.2 +B1 Aileron Trim DV 5.2 +B2 Anti-Torque Control DV 5.2 +B3 Autopilot Enable OOC 5.2 +B4 Chaff Release OSC 5.2 +B5 Collective Control DV 5.2 +B6 Dive Brake DV 5.2 +B7 Electronic Countermeasures OOC 5.2 +B8 Elevator DV 5.2 +B9 Elevator Trim DV 5.2 +BA Rudder DV 5.2 +BB Throttle DV 5.2 +BC Flight Communications OOC 5.2 +BD Flare Release OSC 5.2 +BE Landing Gear OOC 5.2 +BF Toe Brake DV 5.2 +C0 Trigger MC 5.2 +C1 Weapons Arm OOC 5.2 +C2 Weapons Select OSC 5.2 +C3 Wing Flaps DV 5.2 +C4 Accelerator DV 5.3 +C5 Brake DV 5.3 +C6 Clutch DV 5.3 +C7 Shifter DV 5.3 +C8 Steering DV 5.3 +C9 Turret Direction DV 5.4 +CA Barrel Elevation DV 5.4 +CB Dive Plane DV 5.5 +CC Ballast DV 5.5 +CD Bicycle Crank DV 5.6 +CE Handle Bars DV 5.6 +CF Front Brake DV 5.6 +D0 Rear Brake DV 5.6 +D1-FFFF Reserved \ No newline at end of file diff -r cdc5f8f1b79e -r e2acfa51664f Hid/Tables/HidUsageTableTelephonyDevice.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Hid/Tables/HidUsageTableTelephonyDevice.txt Sun Mar 15 20:30:00 2015 +0100 @@ -0,0 +1,72 @@ +00 Unassigned +01 Phone CA 14.1 +02 Answering Machine CA 14.1 +03 Message Controls CL 14.1 +04 Handset CL 14.1 +05 Headset CL 14.1 +06 Telephony Key Pad NAry 14.2 +07 Programmable Button NAry 14.2 +08-1F Reserved +20 Hook Switch OOC 14.3 +21 Flash MC 14.3 +22 Feature OSC 14.3 +23 Hold OOC 14.3 +24 Redial OSC 14.3 +25 Transfer OSC 14.3 +26 Drop OSC 14.3 +27 Park OOC 14.3 +28 Forward Calls OOC 14.3 +29 Alternate Function MC 14.3 +2A Line OSC, NAry 14.3 +2B Speaker Phone OOC 14.3 +2C Conference OOC 14.3 +2D Ring Enable OOC 14.3 +2E Ring Select OSC 14.3 +2F Phone Mute OOC 14.3 +30 Caller ID MC 14.3 +31 Send OOC 14.3 +32-4F Reserved +50 Speed Dial OSC 14.4 +51 Store Number OSC 14.4 +52 Recall Number OSC 14.4 +53 Phone Directory OOC 14.4 +54-6F Reserved +70 Voice Mail OOC 14.5 +71 Screen Calls OOC 14.5 +72 Do Not Disturb OOC 14.5 +73 Message OSC 14.5 +74 Answer On/Off OOC 14.5 +75-8F Reserved +90 Inside Dial Tone MC 14.6 +91 Outside Dial Tone MC 14.6 +92 Inside Ring Tone MC 14.6 +93 Outside Ring Tone MC 14.6 +94 Priority Ring Tone MC 14.6 +95 Inside Ringback MC 14.6 +96 Priority Ringback MC 14.6 +97 Line Busy Tone MC 14.6 +98 Reorder Tone MC 14.6 +99 Call Waiting Tone MC 14.6 +9A Confirmation Tone 1 MC 14.6 +9B Confirmation Tone 2 MC 14.6 +9C Tones Off OOC 14.6 +9D Outside Ringback MC 14.6 +9E Ringer OOC 14.6 +9E-AF Reserved +B0 Phone Key 0 Sel 14.2 +B1 Phone Key 1 Sel 14.2 +B2 Phone Key 2 Sel 14.2 +B3 Phone Key 3 Sel 14.2 +B4 Phone Key 4 Sel 14.2 +B5 Phone Key 5 Sel 14.2 +B6 Phone Key 6 Sel 14.2 +B7 Phone Key 7 Sel 14.2 +B8 Phone Key 8 Sel 14.2 +B9 Phone Key 9 Sel 14.2 +BA Phone Key Star Sel 14.2 +BB Phone Key Pound Sel 14.2 +BC Phone Key A Sel 14.2 +BD Phone Key B Sel 14.2 +BE Phone Key C Sel 14.2 +BF Phone Key D Sel 14.2 +C0-FFFF Reserved \ No newline at end of file diff -r cdc5f8f1b79e -r e2acfa51664f Hid/Tables/genUsageTableEnum.pl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Hid/Tables/genUsageTableEnum.pl Sun Mar 15 20:30:00 2015 +0100 @@ -0,0 +1,106 @@ +#!/usr/local/bin/perl +#Developed by Stéphane Lenclud +#Generate C# enumeration from parsing Hid Usage Table +#See ../data/gl.h +#Usage example +#perl -S genUsageTableEnum.pl ../data/gl.h + +use strict; +use warnings; + + +my $inputFile = $ARGV[0]; + +#my $dummy="lala"; +#$dummy=~s/(^\w)/uc($1)/e; +#print "$dummy"; +#exit(0); + +#Open input file +open INPUT, "< $inputFile" or die "Can't read $inputFile\n"; +my @lines = ; +close INPUT; + + +my %hash = (); + +my $count=0; +foreach my $line(@lines) + { + #if ($line=~ /^([a-fA-FxX\d]+)(.+)\s+\w+\s+15\..*$/) + if ($line=~ /^([a-fA-FxX\d]+)(.+)\s+\w+\s+\d+\..*$/) + { + my $string=$2; + my $value=$1; + + my $varName=FormatVarName($string); + + + $hash{$string}=$value; + + print "$varName = 0x$value,\n"; + } + else + { + #print "NO MATCH $line\n"; + } + } + +exit(0); + +#Output in sorted order +for my $string ( sort keys %hash ) + { + #print "_S8(\"$string\"),$hash{$string}, //$count\n"; + print "_S8(\"$string\"),$string, //$count\n"; + $count++; + } + + +print "$count const found.\n"; + +exit(0); + +# + +sub FormatVarName + { + my $text=$_[0]; + my $varName=""; + Trim($text); + #Make sure AC ends up as AppCtrl + $text=~s/(^AC)/App Ctrl/; + #Make sure AL ends up as AppLaunch + $text=~s/(^AL)/App Launch/; + #Replace / by white-space + $text=~s/\// /g; + #Replace + with Plus + $text=~s/\+/Plus/g; + #Replace - with white-space + $text=~s/-/ /g; + + + $text=lc($text); + while ($text=~/(\w+)\s+(.+)/) + { + my $word=$1; + $text=$2; + #upper case the first letter + $word=~s/(^\w)/uc($1)/e; + $varName.=$word; + } + + $text=~s/(^\w)/uc($1)/e; + $varName.=$text; + #get ride of - + $varName=~s/-(\w)/uc($1)/e; + + return $varName; + } + +sub Trim + { + $_[0] =~ s/^\s+//; #Trim leading space and line return char + $_[0] =~ s/\s+$//; #Trim trailling space and line return char + } + diff -r cdc5f8f1b79e -r e2acfa51664f HidUsageTableConsumer.txt --- a/HidUsageTableConsumer.txt Sun Mar 15 20:25:58 2015 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,382 +0,0 @@ -00 Unassigned -01 Consumer Control CA 15.1 -02 Numeric Key Pad NAry 15.2 -03 Programmable Buttons NAry 15.14 -04 Microphone CA 15.1 -05 Headphone CA 15.1 -06 Graphic Equalizer CA 15.1 -07-1F Reserved -20 +10 OSC 15.2 -21 +100 OSC 15.2 -22 AM/PM OSC 15.2 -23-3F Reserved -30 Power OOC 15.3 -31 Reset OSC 15.3 -32 Sleep OSC 15.3 -33 Sleep After OSC 15.3 -34 Sleep Mode RTC 15.3 -35 Illumination OOC 15.3 -36 Function Buttons NAry 15.3 -37-3F Reserved -40 Menu OOC 15.4 -41 Menu Pick OSC 15.4 -42 Menu Up OSC 15.4 -43 Menu Down OSC 15.4 -44 Menu Left OSC 15.4 -45 Menu Right OSC 15.4 -46 Menu Escape OSC 15.4 -47 Menu Value Increase OSC 15.4 -48 Menu Value Decrease OSC 15.4 -49-5F Reserved -60 Data On Screen OOC 15.5 -61 Closed Caption OOC 15.5 -62 Closed Caption Select OSC 15.5 -63 VCR/TV OOC 15.5 -64 Broadcast Mode OSC 15.5 -65 Snapshot OSC 15.5 -66 Still OSC 15.5 -67-7F Reserved -80 Selection NAry 15.6 -81 Assign Selection OSC 15.6 -82 Mode Step OSC 15.6 -83 Recall Last OSC 15.6 -84 Enter Channel OSC 15.6 -85 Order Movie OSC 15.6 -86 Channel LC 15.6 -87 Media Selection NAry 15.6 -88 Media Select Computer Sel 15.6 -89 Media Select TV Sel 15.6 -8A Media Select WWW Sel 15.6 -8B Media Select DVD Sel 15.6 -8C Media Select Telephone Sel 15.6 -8D Media Select Program Guide Sel 15.6 -8E Media Select Video Phone Sel 15.6 -8F Media Select Games Sel 15.6 -90 Media Select Messages Sel 15.6 -91 Media Select CD Sel 15.6 -92 Media Select VCR Sel 15.6 -93 Media Select Tuner Sel 15.6 -94 Quit OSC 15.6 -95 Help OOC 15.6 -96 Media Select Tape Sel 15.6 -97 Media Select Cable Sel 15.6 -98 Media Select Satellite Sel 15.6 -99 Media Select Security Sel 15.6 -9A Media Select Home Sel 15.6 -9B Media Select Call Sel 15.6 -9C Channel Increment OSC 15.6 -9D Channel Decrement OSC 15.6 -9E Media Select SAP Sel 15.6 -9F Reserved -A0 VCR Plus OSC 15.6 -A1 Once OSC 15.6 -A2 Daily OSC 15.6 -A3 Weekly OSC 15.6 -A4 Monthly OSC 15.6 -A5-AF Reserved -B0 Play OOC 15.7 -B1 Pause OOC 15.7 -B2 Record OOC 15.7 -B3 Fast Forward OOC 15.7 -B4 Rewind OOC 15.7 -B5 Scan Next Track OSC 15.7 -B6 Scan Previous Track OSC 15.7 -B7 Stop OSC 15.7 -B8 Eject OSC 15.7 -B9 Random Play OOC 15.7 -BA Select Disc NAry 15.7 -BB Enter Disc MC 15.7 -BC Repeat OSC 15.7 -BD Tracking LC 15.7 -BE Track Normal OSC 15.7 -BF Slow Tracking LC 15.7 -C0 Frame Forward RTC 15.7 -C1 Frame Back RTC 15.7 -C2 Mark OSC 15.8 -C3 Clear Mark OSC 15.8 -C4 Repeat From Mark OOC 15.8 -C5 Return To Mark OSC 15.8 -C6 Search Mark Forward OSC 15.8 -C7 Search Mark Backwards OSC 15.8 -C8 Counter Reset OSC 15.8 -C9 Show Counter OSC 15.8 -CA Tracking Increment RTC 15.7 -CB Tracking Decrement RTC 15.7 -CC Stop/Eject OSC 15.7 -CD Play/Pause OSC 15.7 -CE Play/Skip OSC 15.7 -CF-DF Reserved -E0 Volume LC 15.9.1 -E1 Balance LC 15.9.2 -E2 Mute OOC 15.9.1 -E3 Bass LC 15.9.3 -E4 Treble LC 15.9.4 -E5 Bass Boost OOC 15.9.3 -E6 Surround Mode OSC 15.9.5 -E7 Loudness OOC 15.9.5 -E8 MPX OOC 15.9.5 -E9 Volume Increment RTC 15.9.1 -EA Volume Decrement RTC 15.9.1 -EB-EF Reserved -F0 Speed Select OSC 15.10 -F1 Playback Speed NAry 15.10 -F2 Standard Play Sel 15.10 -F3 Long Play Sel 15.10 -F4 Extended Play Sel 15.10 -F5 Slow OSC 15.10 -F6-FF Reserved -100 Fan Enable OOC 15.11 -101 Fan Speed LC 15.11 -102 Light Enable OOC 15.11 -103 Light Illumination Level LC 15.11 -104 Climate Control Enable OOC 15.11 -105 Room Temperature LC 15.11 -106 Security Enable OOC 15.11 -107 Fire Alarm OSC 15.11 -108 Police Alarm OSC 15.11 -109 Proximity LC 15.11 -10A Motion OSC 15.11 -10B Duress Alarm OSC 15.11 -10C Holdup Alarm OSC 15.11 -10D Medical Alarm OSC 15.11 -10E-14F Reserved -150 Balance Right RTC 15.9.2 -151 Balance Left RTC 15.9.2 -152 Bass Increment RTC 15.9.3 -153 Bass Decrement RTC 15.9.3 -154 Treble Increment RTC 15.9.4 -155 Treble Decrement RTC 15.9.4 -156-15F Reserved -160 Speaker System CL 15.12.1 -161 Channel Left CL 15.12.1 -162 Channel Right CL 15.12.1 -163 Channel Center CL 15.12.1 -164 Channel Front CL 15.12.1 -165 Channel Center Front CL 15.12.1 -166 Channel Side CL 15.12.1 -167 Channel Surround CL 15.12.1 -168 Channel Low Frequency Enhancement CL 15.12.1 -169 Channel Top CL 15.12.1 -16A Channel Unknown CL 15.12.1 -16B-16F Reserved -170 Sub-channel LC 15.13 -171 Sub-channel Increment OSC 15.13 -172 Sub-channel Decrement OSC 15.13 -173 Alternate Audio Increment OSC 15.13 -174 Alternate Audio Decrement OSC 15.13 -175-17F Reserved -180 Application Launch Buttons NAry 15.15 -181 AL Launch Button Configuration Tool Sel 15.15 -182 AL Programmable Button Configuration Sel 15.15 -183 AL Consumer Control Configuration Sel 15.15 -184 AL Word Processor Sel 15.15 -185 AL Text Editor Sel 15.15 -186 AL Spreadsheet Sel 15.15 -187 AL Graphics Editor Sel 15.15 -188 AL Presentation App Sel 15.15 -189 AL Database App Sel 15.15 -18A AL Email Reader Sel 15.15 -18B AL Newsreader Sel 15.15 -18C AL Voicemail Sel 15.15 -18D AL Contacts/Address Book Sel 15.15 -18E AL Calendar/Schedule Sel 15.15 -18F AL Task/Project Manager Sel 15.15 -190 AL Log/Journal/Timecard Sel 15.15 -191 AL Checkbook/Finance Sel 15.15 -192 AL Calculator Sel 15.15 -193 AL A/V Capture/Playback Sel 15.15 -194 AL Local Machine Browser Sel 15.15 -195 AL LAN/WAN Browser Sel 15.15 -196 AL Internet Browser Sel 15.15 -197 AL Remote Networking/ISP Connect Sel 15.15 -198 AL Network Conference Sel 15.15 -199 AL Network Chat Sel 15.15 -19A AL Telephony/Dialer Sel 15.15 -19B AL Logon Sel 15.15 -19C AL Logoff Sel 15.15 -19D AL Logon/Logoff Sel 15.15 -19E AL Terminal Lock/Screensaver Sel 15.15 -19F AL Control Panel Sel 15.15 -1A0 AL Command Line Processor/Run Sel 15.15 -1A1 AL Process/Task Manager Sel 15.15 -1A2 AL Select Task/Application Sel 15.15 -1A3 AL Next Task/Application Sel 15.15 -1A4 AL Previous Task/Application Sel 15.15 -1A5 AL Preemptive Halt Task/Application Sel 15.15 -1A6 AL Integrated Help Center Sel 15.15 -1A7 AL Documents Sel 15.15 -1A8 AL Thesaurus Sel 15.15 -1A9 AL Dictionary Sel 15.15 -1AA AL Desktop Sel 15.15 -1AB AL Spell Check Sel 15.15 -1AC AL Grammar Check Sel 15.15 -1AD AL Wireless Status Sel 15.15 -1AE AL Keyboard Layout Sel 15.15 -1AF AL Virus Protection Sel 15.15 -1B0 AL Encryption Sel 15.15 -1B1 AL Screen Saver Sel 15.15 -1B2 AL Alarms Sel 15.15 -1B3 AL Clock Sel 15.15 -1B4 AL File Browser Sel 15.15 -1B5 AL Power Status Sel 15.15 -1B6 AL Image Browser Sel 15.15 -1B7 AL Audio Browser Sel 15.15 -1B8 AL Movie Browser Sel 15.15 -1B9 AL Digital Rights Manager Sel 15.15 -1BA AL Digital Wallet Sel 15.15 -1BB Reserved -1BC AL Instant Messaging Sel 15.15 -1BD AL OEM Features/ Tips/Tutorial Browser Sel 15.15 -1BE AL OEM Help Sel 15.15 -1BF AL Online Community Sel 15.15 -1C0 AL Entertainment Content Browser Sel 15.15 -1C1 AL Online Shopping Browser Sel 15.15 -1C2 AL SmartCard Information/Help Sel 15.15 -1C3 AL Market Monitor/Finance Browser Sel 15.15 -1C4 AL Customized Corporate News Browser Sel 15.15 -1C5 AL Online Activity Browser Sel 15.15 -1C6 AL Research/Search Browser Sel 15.15 -1C7 AL Audio Player Sel 15.15 -1C8-1FF Reserved -200 Generic GUI Application Controls Nary 15.16 -201 AC New Sel 15.16 -202 AC Open Sel 15.16 -203 AC Close Sel 15.16 -204 AC Exit Sel 15.16 -205 AC Maximize Sel 15.16 -206 AC Minimize Sel 15.16 -207 AC Save Sel 15.16 -208 AC Print Sel 15.16 -209 AC Properties Sel 15.16 -21A AC Undo Sel 15.16 -21B AC Copy Sel 15.16 -21C AC Cut Sel 15.16 -21D AC Paste Sel 15.16 -21E AC Select All Sel 15.16 -21F AC Find Sel 15.16 -220 AC Find and Replace Sel 15.16 -221 AC Search Sel 15.16 -222 AC Go To Sel 15.16 -223 AC Home Sel 15.16 -224 AC Back Sel 15.16 -225 AC Forward Sel 15.16 -226 AC Stop Sel 15.16 -227 AC Refresh Sel 15.16 -228 AC Previous Link Sel 15.16 -229 AC Next Link Sel 15.16 -22A AC Bookmarks Sel 15.16 -22B AC History Sel 15.16 -22C AC Subscriptions Sel 15.16 -22D AC Zoom In Sel 15.16 -22E AC Zoom Out Sel 15.16 -22F AC Zoom LC 15.16 -230 AC Full Screen View Sel 15.16 -231 AC Normal View Sel 15.16 -232 AC View Toggle Sel 15.16 -233 AC Scroll Up Sel 15.16 -234 AC Scroll Down Sel 15.16 -235 AC Scroll LC 15.16 -236 AC Pan Left Sel 15.16 -237 AC Pan Right Sel 15.16 -238 AC Pan LC 15.16 -239 AC New Window Sel 15.16 -23A AC Tile Horizontally Sel 15.16 -23B AC Tile Vertically Sel 15.16 -23C AC Format Sel 15.16 -23D AC Edit Sel 15.14 -23E AC Bold Sel 15.16 -23F AC Italics Sel 15.16 -240 AC Underline Sel 15.16 -241 AC Strikethrough Sel 15.16 -242 AC Subscript Sel 15.16 -243 AC Superscript Sel 15.16 -244 AC All Caps Sel 15.16 -245 AC Rotate Sel 15.16 -246 AC Resize Sel 15.16 -247 AC Flip horizontal Sel 15.16 -248 AC Flip Vertical Sel 15.16 -249 AC Mirror Horizontal Sel 15.16 -24A AC Mirror Vertical Sel 15.16 -24B AC Font Select Sel 15.16 -24C AC Font Color Sel 15.16 -24D AC Font Size Sel 15.16 -24E AC Justify Left Sel 15.16 -24F AC Justify Center H Sel 15.16 -250 AC Justify Right Sel 15.16 -251 AC Justify Block H Sel 15.16 -252 AC Justify Top Sel 15.16 -253 AC Justify Center V Sel 15.16 -254 AC Justify Bottom Sel 15.16 -255 AC Justify Block V Sel 15.16 -256 AC Indent Decrease Sel 15.16 -257 AC Indent Increase Sel 15.16 -258 AC Numbered List Sel 15.16 -259 AC Restart Numbering Sel 15.16 -25A AC Bulleted List Sel 15.16 -25B AC Promote Sel 15.16 -25C AC Demote Sel 15.16 -25D AC Yes Sel 15.16 -25E AC No Sel 15.16 -25F AC Cancel Sel 15.16 -260 AC Catalog Sel 15.16 -261 AC Buy/Checkout Sel 15.16 -262 AC Add to Cart Sel 15.16 -263 AC Expand Sel 15.16 -264 AC Expand All Sel 15.16 -265 AC Collapse Sel 15.16 -266 AC Collapse All Sel 15.16 -267 AC Print Preview Sel 15.16 -268 AC Paste Special Sel 15.16 -269 AC Insert Mode Sel 15.16 -26A AC Delete Sel 15.16 -26B AC Lock Sel 15.16 -26C AC Unlock Sel 15.16 -26D AC Protect Sel 15.16 -26E AC Unprotect Sel 15.16 -26F AC Attach Comment Sel 15.16 -270 AC Delete Comment Sel 15.16 -271 AC View Comment Sel 15.16 -272 AC Select Word Sel 15.16 -273 AC Select Sentence Sel 15.16 -274 AC Select Paragraph Sel 15.16 -275 AC Select Column Sel 15.16 -276 AC Select Row Sel 15.16 -277 AC Select Table Sel 15.16 -278 AC Select Object Sel 15.16 -279 AC Redo/Repeat Sel 15.16 -27A AC Sort Sel 15.16 -27B AC Sort Ascending Sel 15.16 -27C AC Sort Descending Sel 15.16 -27D AC Filter Sel 15.16 -27E AC Set Clock Sel 15.16 -27F AC View Clock Sel 15.16 -280 AC Select Time Zone Sel 15.16 -281 AC Edit Time Zones Sel 15.16 -282 AC Set Alarm Sel 15.16 -283 AC Clear Alarm Sel 15.16 -284 AC Snooze Alarm Sel 15.16 -285 AC Reset Alarm Sel 15.16 -286 AC Synchronize Sel 15.16 -287 AC Send/Receive Sel 15.16 -288 AC Send To Sel 15.16 -289 AC Reply Sel 15.16 -28A AC Reply All Sel 15.16 -28B AC Forward Msg Sel 15.16 -28C AC Send Sel 15.16 -28D AC Attach File Sel 15.16 -28E AC Upload Sel 15.16 -28F AC Download Save Target As Sel 15.16 -290 AC Set Borders Sel 15.16 -291 AC Insert Row Sel 15.16 -292 AC Insert Column Sel 15.16 -293 AC Insert File Sel 15.16 -294 AC Insert Picture Sel 15.16 -295 AC Insert Object Sel 15.16 -296 AC Insert Symbol Sel 15.16 -297 AC Save and Close Sel 15.16 -298 AC Rename Sel 15.16 -299 AC Merge Sel 15.16 -29A AC Split Sel 15.16 -29B AC Distribute Horizontally Sel 15.16 -29C AC Distribute Vertically Sel 15.16 -29D-FFFF Reserved \ No newline at end of file diff -r cdc5f8f1b79e -r e2acfa51664f HidUsageTableGameControls.txt --- a/HidUsageTableGameControls.txt Sun Mar 15 20:25:58 2015 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -00 Undefined -01 3D Game Controller CA 8.1 -02 Pinball Device CA 8.2 -03 Gun Device CA 8.3 -04-1F Reserved -20 Point of View CP 8.1 -21 Turn Right/Left DV 8.1 -22 Pitch Forward/Backward DV 8.1 -23 Roll Right/Left DV 8.1 -24 Move Right/Left DV 8.1 -25 Move Forward/Backward DV 8.1 -26 Move Up/Down DV 8.1 -27 Lean Right/Left DV 8.1 -28 Lean Forward/Backward DV 8.1 -29 Height of POV DV 8.1 -2A Flipper MC 8.2 -2B Secondary Flipper MC 8.2 -2C Bump MC 8.2 -2D New Game OSC 8.2 -2E Shoot Ball OSC 8.2 -2F Player OSC 8.2 -30 Gun Bolt OOC 8.3 -31 Gun Clip OOC 8.3 -32 Gun Selector NAry 8.3 -33 Gun Single Shot Sel 8.3 -34 Gun Burst Sel 8.3 -35 Gun Automatic Sel 8.3 -36 Gun Safety OOC 8.3 -37 Gamepad Fire/Jump CL 8.4.1 -39 Gamepad Trigger CL 8.4.1 -3A-FFFF Reserved \ No newline at end of file diff -r cdc5f8f1b79e -r e2acfa51664f HidUsageTableGenericDesktop.txt --- a/HidUsageTableGenericDesktop.txt Sun Mar 15 20:25:58 2015 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,75 +0,0 @@ -00 Undefined -01 Pointer CP 4.1 -02 Mouse CA 4.1 03 Reserved -04 Joystick CA 4.1 -05 Game Pad CA 4.1 -06 Keyboard CA 4.1 -07 Keypad CA 4.1 -08 Multi-axis Controller CA 4.1 -09 Tablet PC System Controls CA 4.1 -0A-2F Reserved -30 X DV 4.2 -31 Y DV 4.2 -32 Z DV 4.2 -33 Rx DV 4.2 -34 Ry DV 4.2 -35 Rz DV 4.2 -36 Slider DV 4.3 -37 Dial DV 4.3 -38 Wheel DV 4.3 -39 Hat switch DV 4.3 -3A Counted Buffer CL 4.6 -3B Byte Count DV 4.6 -3C Motion Wakeup OSC 4.3 -3D Start OOC 4.3 -3E Select OOC 4.3 3F Reserved -40 Vx DV 4.3.1 -41 Vy DV 4.3.1 -42 Vz DV 4.3.1 -43 Vbrx DV 4.3.1 -44 Vbry DV 4.3.1 -45 Vbrz DV 4.3.1 -46 Vno DV 4.3.1 -47 Feature Notification DV,DF 4.8 -48 Resolution Multiplier DV -49-7F Reserved -80 System Control CA 4.5 -81 System Power Down OSC 4.5 -82 System Sleep OSC 4.5.1 -83 System Wake Up OSC 4.5.1 -84 System Context Menu OSC 4.5 -85 System Main Menu OSC 4.5 -86 System App Menu OSC 4.5 -87 System Menu Help OSC 4.5 -88 System Menu Exit OSC 4.5 -89 System Menu Select OSC 4.5 -8A System Menu Right RTC 4.5 -8B System Menu Left RTC 4.5 -8C System Menu Up RTC 4.5 -8D System Menu Down RTC 4.5 -8E System Cold Restart OSC 4.5.1 -8F System Warm Restart OSC 4.5.1 -90 D-pad Up OOC 4.7 -91 D-pad Down OOC 4.7 -92 D-pad Right OOC 4.7 -93 D-pad Left OOC 4.7 -94-9F Reserved -A0 System Dock OSC 4.5.1 -A1 System Undock OSC 4.5.1 -A2 System Setup OSC 4.5.1 -A3 System Break OSC 4.9 -A4 System Debugger Break OSC 4.9 -A5 Application Break OSC 4.9 -A6 Application Debugger Break OSC 4.9 -A7 System Speaker Mute OSC 4.5.1 -A8 System Hibernate OSC 4.5.1 -A9-AF Reserved -B0 System Display Invert OSC 4.10 -B1 System Display Internal OSC 4.10 -B2 System Display External OSC 4.10 -B3 System Display Both OSC 4.10 -B4 System Display Dual OSC 4.10 -B5 System Display Toggle Int/Ext OSC 4.10 -B6 System Display Swap Primary/Secondary OSC 4.10 -B7 System Display LCD Autoscale OSC 4.10 -B8-FFFF Reserved \ No newline at end of file diff -r cdc5f8f1b79e -r e2acfa51664f HidUsageTableSimulationControls.txt --- a/HidUsageTableSimulationControls.txt Sun Mar 15 20:25:58 2015 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +0,0 @@ -00 Undefined -01 Flight Simulation Device CA 5.2 -02 Automobile Simulation Device CA 5.3 -03 Tank Simulation Device CA 5.4 -04 Spaceship Simulation Device CA 5.2 -05 Submarine Simulation Device CA 5.5 -06 Sailing Simulation Device CA 5.5 -07 Motorcycle Simulation Device CA 5.6 -08 Sports Simulation Device CA 5.1 -09 Airplane Simulation Device CA 5.2 -0A Helicopter Simulation Device CA 5.2 -0B Magic Carpet Simulation Device CA 5.7 -0C Bicycle Simulation Device CA 5.6 -0D – 1F Reserved -20 Flight Control Stick CA 5.2 -21 Flight Stick CA 5.2 -22 Cyclic Control CP 5.2 -23 Cyclic Trim CP 5.2 -24 Flight Yoke CA 5.2 -25 Track Control CP 5.4 -26 –AF Reserved -B0 Aileron DV 5.2 -B1 Aileron Trim DV 5.2 -B2 Anti-Torque Control DV 5.2 -B3 Autopilot Enable OOC 5.2 -B4 Chaff Release OSC 5.2 -B5 Collective Control DV 5.2 -B6 Dive Brake DV 5.2 -B7 Electronic Countermeasures OOC 5.2 -B8 Elevator DV 5.2 -B9 Elevator Trim DV 5.2 -BA Rudder DV 5.2 -BB Throttle DV 5.2 -BC Flight Communications OOC 5.2 -BD Flare Release OSC 5.2 -BE Landing Gear OOC 5.2 -BF Toe Brake DV 5.2 -C0 Trigger MC 5.2 -C1 Weapons Arm OOC 5.2 -C2 Weapons Select OSC 5.2 -C3 Wing Flaps DV 5.2 -C4 Accelerator DV 5.3 -C5 Brake DV 5.3 -C6 Clutch DV 5.3 -C7 Shifter DV 5.3 -C8 Steering DV 5.3 -C9 Turret Direction DV 5.4 -CA Barrel Elevation DV 5.4 -CB Dive Plane DV 5.5 -CC Ballast DV 5.5 -CD Bicycle Crank DV 5.6 -CE Handle Bars DV 5.6 -CF Front Brake DV 5.6 -D0 Rear Brake DV 5.6 -D1-FFFF Reserved \ No newline at end of file diff -r cdc5f8f1b79e -r e2acfa51664f HidUsageTableTelephonyDevice.txt --- a/HidUsageTableTelephonyDevice.txt Sun Mar 15 20:25:58 2015 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,72 +0,0 @@ -00 Unassigned -01 Phone CA 14.1 -02 Answering Machine CA 14.1 -03 Message Controls CL 14.1 -04 Handset CL 14.1 -05 Headset CL 14.1 -06 Telephony Key Pad NAry 14.2 -07 Programmable Button NAry 14.2 -08-1F Reserved -20 Hook Switch OOC 14.3 -21 Flash MC 14.3 -22 Feature OSC 14.3 -23 Hold OOC 14.3 -24 Redial OSC 14.3 -25 Transfer OSC 14.3 -26 Drop OSC 14.3 -27 Park OOC 14.3 -28 Forward Calls OOC 14.3 -29 Alternate Function MC 14.3 -2A Line OSC, NAry 14.3 -2B Speaker Phone OOC 14.3 -2C Conference OOC 14.3 -2D Ring Enable OOC 14.3 -2E Ring Select OSC 14.3 -2F Phone Mute OOC 14.3 -30 Caller ID MC 14.3 -31 Send OOC 14.3 -32-4F Reserved -50 Speed Dial OSC 14.4 -51 Store Number OSC 14.4 -52 Recall Number OSC 14.4 -53 Phone Directory OOC 14.4 -54-6F Reserved -70 Voice Mail OOC 14.5 -71 Screen Calls OOC 14.5 -72 Do Not Disturb OOC 14.5 -73 Message OSC 14.5 -74 Answer On/Off OOC 14.5 -75-8F Reserved -90 Inside Dial Tone MC 14.6 -91 Outside Dial Tone MC 14.6 -92 Inside Ring Tone MC 14.6 -93 Outside Ring Tone MC 14.6 -94 Priority Ring Tone MC 14.6 -95 Inside Ringback MC 14.6 -96 Priority Ringback MC 14.6 -97 Line Busy Tone MC 14.6 -98 Reorder Tone MC 14.6 -99 Call Waiting Tone MC 14.6 -9A Confirmation Tone 1 MC 14.6 -9B Confirmation Tone 2 MC 14.6 -9C Tones Off OOC 14.6 -9D Outside Ringback MC 14.6 -9E Ringer OOC 14.6 -9E-AF Reserved -B0 Phone Key 0 Sel 14.2 -B1 Phone Key 1 Sel 14.2 -B2 Phone Key 2 Sel 14.2 -B3 Phone Key 3 Sel 14.2 -B4 Phone Key 4 Sel 14.2 -B5 Phone Key 5 Sel 14.2 -B6 Phone Key 6 Sel 14.2 -B7 Phone Key 7 Sel 14.2 -B8 Phone Key 8 Sel 14.2 -B9 Phone Key 9 Sel 14.2 -BA Phone Key Star Sel 14.2 -BB Phone Key Pound Sel 14.2 -BC Phone Key A Sel 14.2 -BD Phone Key B Sel 14.2 -BE Phone Key C Sel 14.2 -BF Phone Key D Sel 14.2 -C0-FFFF Reserved \ No newline at end of file diff -r cdc5f8f1b79e -r e2acfa51664f Win32/PInvoke/pinvoke-input.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Win32/PInvoke/pinvoke-input.txt Sun Mar 15 20:30:00 2015 +0100 @@ -0,0 +1,2226 @@ +// +// SL: We use this file to generate P/Invoke using P/Invoke Interop Assistant. +// + + +typedef USHORT USAGE, *PUSAGE; +typedef LONG NTSTATUS; + +#define HIDP_LINK_COLLECTION_ROOT ((USHORT) -1) +#define HIDP_LINK_COLLECTION_UNSPECIFIED ((USHORT) 0) + + +typedef enum _HIDP_REPORT_TYPE +{ + HidP_Input, + HidP_Output, + HidP_Feature +} HIDP_REPORT_TYPE; + +typedef struct _USAGE_AND_PAGE +{ + USAGE Usage; + USAGE UsagePage; +} USAGE_AND_PAGE, *PUSAGE_AND_PAGE; + +#define HidP_IsSameUsageAndPage(u1, u2) ((* (PULONG) &u1) == (* (PULONG) &u2)) + +typedef struct _HIDP_BUTTON_CAPS +{ + USAGE UsagePage; + UCHAR ReportID; + BOOLEAN IsAlias; + + USHORT BitField; + USHORT LinkCollection; // A unique internal index pointer + + USAGE LinkUsage; + USAGE LinkUsagePage; + + BOOLEAN IsRange; + BOOLEAN IsStringRange; + BOOLEAN IsDesignatorRange; + BOOLEAN IsAbsolute; + + ULONG Reserved[10]; + union { + struct { + USAGE UsageMin, UsageMax; + USHORT StringMin, StringMax; + USHORT DesignatorMin, DesignatorMax; + USHORT DataIndexMin, DataIndexMax; + } Range; + struct { + USAGE Usage, Reserved1; + USHORT StringIndex, Reserved2; + USHORT DesignatorIndex, Reserved3; + USHORT DataIndex, Reserved4; + } NotRange; + }; + +} HIDP_BUTTON_CAPS, *PHIDP_BUTTON_CAPS; + + +typedef struct _HIDP_VALUE_CAPS +{ + USAGE UsagePage; + UCHAR ReportID; + BOOLEAN IsAlias; + + USHORT BitField; + USHORT LinkCollection; // A unique internal index pointer + + USAGE LinkUsage; + USAGE LinkUsagePage; + + BOOLEAN IsRange; + BOOLEAN IsStringRange; + BOOLEAN IsDesignatorRange; + BOOLEAN IsAbsolute; + + BOOLEAN HasNull; // Does this channel have a null report union + UCHAR Reserved; + USHORT BitSize; // How many bits are devoted to this value? + + USHORT ReportCount; // See Note below. Usually set to 1. + USHORT Reserved2[5]; + + ULONG UnitsExp; + ULONG Units; + + LONG LogicalMin, LogicalMax; + LONG PhysicalMin, PhysicalMax; + + union { + struct { + USAGE UsageMin, UsageMax; + USHORT StringMin, StringMax; + USHORT DesignatorMin, DesignatorMax; + USHORT DataIndexMin, DataIndexMax; + } Range; + + struct { + USAGE Usage, Reserved1; + USHORT StringIndex, Reserved2; + USHORT DesignatorIndex, Reserved3; + USHORT DataIndex, Reserved4; + } NotRange; + }; +} HIDP_VALUE_CAPS, *PHIDP_VALUE_CAPS; + +// +// Notes: +// +// ReportCount: When a report descriptor declares an Input, Output, or +// Feature main item with fewer usage declarations than the report count, then +// the last usage applies to all remaining unspecified count in that main item. +// (As an example you might have data that required many fields to describe, +// possibly buffered bytes.) In this case, only one value cap structure is +// allocated for these associtated fields, all with the same usage, and Report +// Count reflects the number of fields involved. Normally ReportCount is 1. +// To access all of the fields in such a value structure would require using +// HidP_GetUsageValueArray and HidP_SetUsageValueArray. HidP_GetUsageValue/ +// HidP_SetScaledUsageValue will also work, however, these functions will only +// work with the first field of the structure. +// + +// +// The link collection tree consists of an array of LINK_COLLECTION_NODES +// where the index into this array is the same as the collection number. +// +// Given a collection A which contains a subcollection B, A is defined to be +// the parent B, and B is defined to be the child. +// +// Given collections A, B, and C where B and C are children of A, and B was +// encountered before C in the report descriptor, B is defined as a sibling of +// C. (This implies, of course, that if B is a sibling of C, then C is NOT a +// sibling of B). +// +// B is defined as the NextSibling of C if and only if there exists NO +// child collection of A, call it D, such that B is a sibling of D and D +// is a sibling of C. +// +// E is defined to be the FirstChild of A if and only if for all children of A, +// F, that are not equivalent to E, F is a sibling of E. +// (This implies, of course, that the does not exist a child of A, call it G, +// where E is a sibling of G). In other words the first sibling is the last +// link collection found in the list. +// +// In other words, if a collection B is defined within the definition of another +// collection A, B becomes a child of A. All collections with the same parent +// are considered siblings. The FirstChild of the parent collection, A, will be +// last collection defined that has A as a parent. The order of sibling pointers +// is similarly determined. When a collection B is defined, it becomes the +// FirstChild of it's parent collection. The previously defined FirstChild of the +// parent collection becomes the NextSibling of the new collection. As new +// collections with the same parent are discovered, the chain of sibling is built. +// +// With that in mind, the following describes conclusively a data structure +// that provides direct traversal up, down, and accross the link collection +// tree. +// +// +typedef struct _HIDP_LINK_COLLECTION_NODE +{ + USAGE LinkUsage; + USAGE LinkUsagePage; + USHORT Parent; + USHORT NumberOfChildren; + USHORT NextSibling; + USHORT FirstChild; + ULONG CollectionType: 8; // As defined in 6.2.2.6 of HID spec + ULONG IsAlias : 1; // This link node is an allias of the next link node. + ULONG Reserved: 23; + PVOID UserContext; // The user can hang his coat here. +} HIDP_LINK_COLLECTION_NODE, *PHIDP_LINK_COLLECTION_NODE; + +// +// When a link collection is described by a delimiter, alias link collection +// nodes are created. (One for each usage within the delimiter). +// The parser assigns each capability description listed above only one +// link collection. +// +// If a control is defined within a collection defined by +// delimited usages, then that control is said to be within multiple link +// collections, one for each usage within the open and close delimiter tokens. +// Such multiple link collecions are said to be aliases. The first N-1 such +// collections, listed in the link collection node array, have their IsAlias +// bit set. The last such link collection is the link collection index used +// in the capabilities described above. +// Clients wishing to set a control in an aliased collection, should walk the +// collection array once for each time they see the IsAlias flag set, and use +// the last link collection as the index for the below accessor functions. +// +// NB: if IsAlias is set, then NextSibling should be one more than the current +// link collection node index. +// + +typedef PUCHAR PHIDP_REPORT_DESCRIPTOR; +typedef struct _HIDP_PREPARSED_DATA * PHIDP_PREPARSED_DATA; + +typedef struct _HIDP_CAPS +{ + USAGE Usage; + USAGE UsagePage; + USHORT InputReportByteLength; + USHORT OutputReportByteLength; + USHORT FeatureReportByteLength; + USHORT Reserved[17]; + + USHORT NumberLinkCollectionNodes; + + USHORT NumberInputButtonCaps; + USHORT NumberInputValueCaps; + USHORT NumberInputDataIndices; + + USHORT NumberOutputButtonCaps; + USHORT NumberOutputValueCaps; + USHORT NumberOutputDataIndices; + + USHORT NumberFeatureButtonCaps; + USHORT NumberFeatureValueCaps; + USHORT NumberFeatureDataIndices; +} HIDP_CAPS, *PHIDP_CAPS; + +typedef struct _HIDP_DATA +{ + USHORT DataIndex; + USHORT Reserved; + union { + ULONG RawValue; // for values + BOOLEAN On; // for buttons MUST BE TRUE for buttons. + }; +} HIDP_DATA, *PHIDP_DATA; +// +// The HIDP_DATA structure is used with HidP_GetData and HidP_SetData +// functions. +// +// The parser contiguously assigns every control (button or value) in a hid +// device a unique data index from zero to NumberXXXDataIndices -1 , inclusive. +// This value is found in the HIDP_BUTTON_CAPS and HIDP_VALUE_CAPS structures. +// +// Most clients will find the Get/Set Buttons / Value accessor functions +// sufficient to their needs, as they will allow the clients to access the +// data known to them while ignoring the other controls. +// +// More complex clients, which actually read the Button / Value Caps, and which +// do a value add service to these routines (EG Direct Input), will need to +// access all the data in the device without interest in the individual usage +// or link collection location. These are the clients that will find +// HidP_Data useful. +// + +typedef struct _HIDP_UNKNOWN_TOKEN +{ + UCHAR Token; + UCHAR Reserved[3]; + ULONG BitField; +} HIDP_UNKNOWN_TOKEN, *PHIDP_UNKNOWN_TOKEN; + +typedef struct _HIDP_EXTENDED_ATTRIBUTES +{ + UCHAR NumGlobalUnknowns; + UCHAR Reserved [3]; + PHIDP_UNKNOWN_TOKEN GlobalUnknowns; + // ... Additional attributes + ULONG Data [1]; // variableLength DO NOT ACCESS THIS FIELD +} HIDP_EXTENDED_ATTRIBUTES, *PHIDP_EXTENDED_ATTRIBUTES; + +NTSTATUS __stdcall +HidP_GetCaps ( + PHIDP_PREPARSED_DATA PreparsedData, + PHIDP_CAPS Capabilities + ); +/*++ +Routine Description: + Returns a list of capabilities of a given hid device as described by its + preparsed data. + +Arguments: + PreparsedData The preparsed data returned from HIDCLASS. + Capabilities a HIDP_CAPS structure + +Return Value: + HIDP_STATUS_SUCCESS + HIDP_STATUS_INVALID_PREPARSED_DATA +--*/ + +NTSTATUS __stdcall +HidP_GetLinkCollectionNodes ( + PHIDP_LINK_COLLECTION_NODE LinkCollectionNodes, + PULONG LinkCollectionNodesLength, + PHIDP_PREPARSED_DATA PreparsedData + ); +/*++ +Routine Description: + Return a list of PHIDP_LINK_COLLECTION_NODEs used to describe the link + collection tree of this hid device. See the above description of + struct _HIDP_LINK_COLLECTION_NODE. + +Arguments: + LinkCollectionNodes - a caller allocated array into which + HidP_GetLinkCollectionNodes will store the information + + LinKCollectionNodesLength - the caller sets this value to the length of the + the array in terms of number of elements. + HidP_GetLinkCollectionNodes sets this value to the actual + number of elements set. The total number of nodes required to + describe this HID device can be found in the + NumberLinkCollectionNodes field in the HIDP_CAPS structure. + +--*/ + +NTSTATUS __stdcall +HidP_GetSpecificButtonCaps ( + HIDP_REPORT_TYPE ReportType, + USAGE UsagePage, // Optional (0 => ignore) + USHORT LinkCollection, // Optional (0 => ignore) + USAGE Usage, // Optional (0 => ignore) + PHIDP_BUTTON_CAPS ButtonCaps, + PUSHORT ButtonCapsLength, + PHIDP_PREPARSED_DATA PreparsedData + ); +/*++ +Description: + HidP_GetButtonCaps returns all the buttons (binary values) that are a part + of the given report type for the Hid device represented by the given + preparsed data. + +Parameters: + ReportType One of HidP_Input, HidP_Output, or HidP_Feature. + + UsagePage A usage page value used to limit the button caps returned to + those on a given usage page. If set to 0, this parameter is + ignored. Can be used with LinkCollection and Usage parameters + to further limit the number of button caps structures returned. + + LinkCollection HIDP_LINK_COLLECTION node array index used to limit the + button caps returned to those buttons in a given link + collection. If set to 0, this parameter is + ignored. Can be used with UsagePage and Usage parameters + to further limit the number of button caps structures + returned. + + Usage A usage value used to limit the button caps returned to those + with the specified usage value. If set to 0, this parameter + is ignored. Can be used with LinkCollection and UsagePage + parameters to further limit the number of button caps + structures returned. + + ButtonCaps A _HIDP_BUTTON_CAPS array containing information about all the + binary values in the given report. This buffer is provided by + the caller. + + ButtonLength As input, this parameter specifies the length of the + ButtonCaps parameter (array) in number of array elements. + As output, this value is set to indicate how many of those + array elements were filled in by the function. The maximum number of + button caps that can be returned is found in the HIDP_CAPS + structure. If HIDP_STATUS_BUFFER_TOO_SMALL is returned, + this value contains the number of array elements needed to + successfully complete the request. + + PreparsedData The preparsed data returned from HIDCLASS. + + +Return Value +HidP_GetSpecificButtonCaps returns the following error codes: + HIDP_STATUS_SUCCESS. + HIDP_STATUS_INVALID_REPORT_TYPE + HIDP_STATUS_INVALID_PREPARSED_DATA + HIDP_STATUS_BUFFER_TOO_SMALL (all given entries however have been filled in) + HIDP_STATUS_USAGE_NOT_FOUND +--*/ +NTSTATUS __stdcall +HidP_GetButtonCaps ( + HIDP_REPORT_TYPE ReportType, + PHIDP_BUTTON_CAPS ButtonCaps, + PUSHORT ButtonCapsLength, + PHIDP_PREPARSED_DATA PreparsedData +); + +NTSTATUS __stdcall +HidP_GetSpecificValueCaps ( + HIDP_REPORT_TYPE ReportType, + USAGE UsagePage, // Optional (0 => ignore) + USHORT LinkCollection, // Optional (0 => ignore) + USAGE Usage, // Optional (0 => ignore) + PHIDP_VALUE_CAPS ValueCaps, + PUSHORT ValueCapsLength, + PHIDP_PREPARSED_DATA PreparsedData + ); +/*++ +Description: + HidP_GetValueCaps returns all the values (non-binary) that are a part + of the given report type for the Hid device represented by the given + preparsed data. + +Parameters: + ReportType One of HidP_Input, HidP_Output, or HidP_Feature. + + UsagePage A usage page value used to limit the value caps returned to + those on a given usage page. If set to 0, this parameter is + ignored. Can be used with LinkCollection and Usage parameters + to further limit the number of value caps structures returned. + + LinkCollection HIDP_LINK_COLLECTION node array index used to limit the + value caps returned to those buttons in a given link + collection. If set to 0, this parameter is + ignored. Can be used with UsagePage and Usage parameters + to further limit the number of value caps structures + returned. + + Usage A usage value used to limit the value caps returned to those + with the specified usage value. If set to 0, this parameter + is ignored. Can be used with LinkCollection and UsagePage + parameters to further limit the number of value caps + structures returned. + + ValueCaps A _HIDP_VALUE_CAPS array containing information about all the + non-binary values in the given report. This buffer is provided + by the caller. + + ValueLength As input, this parameter specifies the length of the ValueCaps + parameter (array) in number of array elements. As output, + this value is set to indicate how many of those array elements + were filled in by the function. The maximum number of + value caps that can be returned is found in the HIDP_CAPS + structure. If HIDP_STATUS_BUFFER_TOO_SMALL is returned, + this value contains the number of array elements needed to + successfully complete the request. + + PreparsedData The preparsed data returned from HIDCLASS. + + +Return Value +HidP_GetValueCaps returns the following error codes: + HIDP_STATUS_SUCCESS. + HIDP_STATUS_INVALID_REPORT_TYPE + HIDP_STATUS_INVALID_PREPARSED_DATA + HIDP_STATUS_BUFFER_TOO_SMALL (all given entries however have been filled in) + HIDP_STATUS_USAGE_NOT_FOUND + +--*/ + +NTSTATUS __stdcall +HidP_GetValueCaps ( + HIDP_REPORT_TYPE ReportType, + PHIDP_VALUE_CAPS ValueCaps, + PUSHORT ValueCapsLength, + PHIDP_PREPARSED_DATA PreparsedData +); + +NTSTATUS __stdcall +HidP_GetExtendedAttributes ( + HIDP_REPORT_TYPE ReportType, + USHORT DataIndex, + PHIDP_PREPARSED_DATA PreparsedData, + PHIDP_EXTENDED_ATTRIBUTES Attributes, + PULONG LengthAttributes + ); +/*++ +Description: + Given a data index from the value or button capabilities of a given control + return any extended attributes for the control if any exist. + +Parameters: + ReportType One of HidP_Input, HidP_Output, or HidP_Feature. + + DataIndex The data index for the given control, found in the capabilities + structure for that control + + PreparsedData The preparsed data returned from HIDCLASS. + + Attributes Pointer to a buffer into which the extended attribute data will + be copied. + + LengthAttributes Length of the given buffer in bytes. + +Return Value + HIDP_STATUS_SUCCESS + HIDP_STATUS_DATA_INDEX_NOT_FOUND +--*/ + +NTSTATUS __stdcall +HidP_InitializeReportForID ( + HIDP_REPORT_TYPE ReportType, + UCHAR ReportID, + PHIDP_PREPARSED_DATA PreparsedData, + PCHAR Report, + ULONG ReportLength + ); +/*++ + +Routine Description: + + Initialize a report based on the given report ID. + +Parameters: + + ReportType One of HidP_Input, HidP_Output, or HidP_Feature. + + PreparasedData Preparsed data structure returned by HIDCLASS + + Report Buffer which to set the data into. + + ReportLength Length of Report...Report should be at least as long as the + value indicated in the HIDP_CAPS structure for the device and + the corresponding ReportType + +Return Value + + HIDP_STATUS_INVALID_REPORT_TYPE -- if ReportType is not valid. + HIDP_STATUS_INVALID_PREPARSED_DATA -- if PreparsedData is not valid + HIDP_STATUS_INVALID_REPORT_LENGTH -- the length of the report packet is not equal + to the length specified in HIDP_CAPS + structure for the given ReportType + HIDP_STATUS_REPORT_DOES_NOT_EXIST -- if there are no reports on this device + for the given ReportType + +--*/ + +NTSTATUS __stdcall +HidP_SetData ( + HIDP_REPORT_TYPE ReportType, + PHIDP_DATA DataList, + PULONG DataLength, + PHIDP_PREPARSED_DATA PreparsedData, + PCHAR Report, + ULONG ReportLength + ); +/*++ + +Routine Description: + + Please Note: Since usage value arrays deal with multiple fields for + for one usage value, they cannot be used with HidP_SetData + and HidP_GetData. In this case, + HIDP_STATUS_IS_USAGE_VALUE_ARRAY will be returned. + +Parameters: + + ReportType One of HidP_Input, HidP_Output, or HidP_Feature. + + DataList Array of HIDP_DATA structures that contains the data values + that are to be set into the given report + + DataLength As input, length in array elements of DataList. As output, + contains the number of data elements set on successful + completion or an index into the DataList array to identify + the faulting HIDP_DATA value if an error code is returned. + + PreparasedData Preparsed data structure returned by HIDCLASS + + Report Buffer which to set the data into. + + ReportLength Length of Report...Report should be at least as long as the + value indicated in the HIDP_CAPS structure for the device and + the corresponding ReportType + +Return Value + HidP_SetData returns the following error codes. The report packet will + have all the data set up until the HIDP_DATA structure that caused the + error. DataLength, in the error case, will return this problem index. + + HIDP_STATUS_SUCCESS -- upon successful insertion of all data + into the report packet. + HIDP_STATUS_INVALID_REPORT_TYPE -- if ReportType is not valid. + HIDP_STATUS_INVALID_PREPARSED_DATA -- if PreparsedData is not valid + HIDP_STATUS_DATA_INDEX_NOT_FOUND -- if a HIDP_DATA structure referenced a + data index that does not exist for this + device's ReportType + HIDP_STATUS_INVALID_REPORT_LENGTH -- the length of the report packet is not equal + to the length specified in HIDP_CAPS + structure for the given ReportType + HIDP_STATUS_REPORT_DOES_NOT_EXIST -- if there are no reports on this device + for the given ReportType + HIDP_STATUS_IS_USAGE_VALUE_ARRAY -- if one of the HIDP_DATA structures + references a usage value array. + DataLength will contain the index into + the array that was invalid + HIDP_STATUS_BUTTON_NOT_PRESSED -- if a HIDP_DATA structure attempted + to unset a button that was not already + set in the Report + HIDP_STATUS_INCOMPATIBLE_REPORT_ID -- a HIDP_DATA structure was found with + a valid index value but is contained + in a different report than the one + currently being processed + HIDP_STATUS_BUFFER_TOO_SMALL -- if there are not enough entries in + a given Main Array Item to report all + buttons that have been requested to be + set +--*/ + +NTSTATUS __stdcall +HidP_GetData ( + HIDP_REPORT_TYPE ReportType, + PHIDP_DATA DataList, + PULONG DataLength, + PHIDP_PREPARSED_DATA PreparsedData, + PCHAR Report, + ULONG ReportLength + ); +/*++ + +Routine Description: + + Please Note: For obvious reasons HidP_SetData and HidP_GetData will not + access UsageValueArrays. + +Parameters: + ReportType One of HidP_Input, HidP_Output, or HidP_Feature. + + DataList Array of HIDP_DATA structures that will receive the data + values that are set in the given report + + DataLength As input, length in array elements of DataList. As output, + contains the number of data elements that were successfully + set by HidP_GetData. The maximum size necessary for DataList + can be determined by calling HidP_MaxDataListLength + + PreparasedData Preparsed data structure returned by HIDCLASS + + Report Buffer which to set the data into. + + ReportLength Length of Report...Report should be at least as long as the + value indicated in the HIDP_CAPS structure for the device and + the corresponding ReportType + +Return Value + HidP_GetData returns the following error codes. + + HIDP_STATUS_SUCCESS -- upon successful retrieval of all data + from the report packet. + HIDP_STATUS_INVALID_REPORT_TYPE -- if ReportType is not valid. + HIDP_STATUS_INVALID_PREPARSED_DATA -- if PreparsedData is not valid + HIDP_STATUS_INVALID_REPORT_LENGTH -- the length of the report packet is not equal + to the length specified in HIDP_CAPS + structure for the given ReportType + HIDP_STATUS_REPORT_DOES_NOT_EXIST -- if there are no reports on this device + for the given ReportType + HIDP_STATUS_BUFFER_TOO_SMALL -- if there are not enough array entries in + DataList to store all the indice values + in the given report. DataLength will + contain the number of array entries + required to hold all data +--*/ + + +ULONG __stdcall +HidP_MaxDataListLength ( + HIDP_REPORT_TYPE ReportType, + PHIDP_PREPARSED_DATA PreparsedData + ); +/*++ +Routine Description: + + This function returns the maximum length of HIDP_DATA elements that + HidP_GetData could return for the given report type. + +Parameters: + + ReportType One of HidP_Input, HidP_Output or HidP_Feature. + + PreparsedData Preparsed data structure returned by HIDCLASS + +Return Value: + + The length of the data list array required for the HidP_GetData function + call. If an error occurs (either HIDP_STATUS_INVALID_REPORT_TYPE or + HIDP_STATUS_INVALID_PREPARSED_DATA), this function returns 0. + +--*/ + +#define HidP_SetButtons(Rty, Up, Lco, ULi, ULe, Ppd, Rep, Rle) \ + HidP_SetUsages(Rty, Up, Lco, ULi, ULe, Ppd, Rep, Rle) + + +NTSTATUS __stdcall +HidP_SetUsages ( + HIDP_REPORT_TYPE ReportType, + USAGE UsagePage, + USHORT LinkCollection, + PUSAGE UsageList, + PULONG UsageLength, + PHIDP_PREPARSED_DATA PreparsedData, + PCHAR Report, + ULONG ReportLength + ); +/*++ + +Routine Description: + This function sets binary values (buttons) in a report. Given an + initialized packet of correct length, it modifies the report packet so that + each element in the given list of usages has been set in the report packet. + For example, in an output report with 5 LED's, each with a given usage, + an application could turn on any subset of these lights by placing their + usages in any order into the usage array (UsageList). HidP_SetUsages would, + in turn, set the appropriate bit or add the corresponding byte into the + HID Main Array Item. + + A properly initialized Report packet is one of the correct byte length, + and all zeros. + + NOTE: A packet that has already been set with a call to a HidP_Set routine + can also be passed in. This routine then sets processes the UsageList + in the same fashion but verifies that the ReportID already set in + Report matches the report ID for the given usages. + +Parameters: + ReportType One of HidP_Input, HidP_Output or HidP_Feature. + + UsagePage All of the usages in the usage array, which HidP_SetUsages will + set in the report, refer to this same usage page. + If a client wishes to set usages in a report for multiple + usage pages then that client needs to make multiple calls to + HidP_SetUsages for each of the usage pages. + + UsageList A usage array containing the usages that HidP_SetUsages will set in + the report packet. + + UsageLength The length of the given usage array in array elements. + The parser will set this value to the position in the usage + array where it stopped processing. If successful, UsageLength + will be unchanged. In any error condition, this parameter + reflects how many of the usages in the usage list have + actually been set by the parser. This is useful for finding + the usage in the list which caused the error. + + PreparsedData The preparsed data recevied from HIDCLASS + + Report The report packet. + + ReportLength Length of the given report packet...Must be equal to the + value reported in the HIDP_CAPS structure for the device + and corresponding report type. + +Return Value + HidP_SetUsages returns the following error codes. On error, the report packet + will be correct up until the usage element that caused the error. + + HIDP_STATUS_SUCCESS -- upon successful insertion of all usages + into the report packet. + HIDP_STATUS_INVALID_REPORT_TYPE -- if ReportType is not valid. + HIDP_STATUS_INVALID_PREPARSED_DATA -- if PreparsedData is not valid + HIDP_STATUS_INVALID_REPORT_LENGTH -- the length of the report packet is not + equal to the length specified in + the HIDP_CAPS structure for the given + ReportType + HIDP_STATUS_REPORT_DOES_NOT_EXIST -- if there are no reports on this device + for the given ReportType + HIDP_STATUS_INCOMPATIBLE_REPORT_ID -- if a usage was found that exists in a + different report. If the report is + zero-initialized on entry the first + usage in the list will determine which + report ID is used. Otherwise, the + parser will verify that usage matches + the passed in report's ID + HIDP_STATUS_USAGE_NOT_FOUND -- if the usage does not exist for any + report (no matter what the report ID) + for the given report type. + HIDP_STATUS_BUFFER_TOO_SMALL -- if there are not enough entries in a + given Main Array Item to list all of + the given usages. The caller needs + to split his request into more than + one call +--*/ + +#define HidP_UnsetButtons(Rty, Up, Lco, ULi, ULe, Ppd, Rep, Rle) \ + HidP_UnsetUsages(Rty, Up, Lco, ULi, ULe, Ppd, Rep, Rle) + + +NTSTATUS __stdcall +HidP_UnsetUsages ( + HIDP_REPORT_TYPE ReportType, + USAGE UsagePage, + USHORT LinkCollection, + PUSAGE UsageList, + PULONG UsageLength, + PHIDP_PREPARSED_DATA PreparsedData, + PCHAR Report, + ULONG ReportLength + ); +/*++ + +Routine Description: + This function unsets (turns off) binary values (buttons) in the report. Given + an initialized packet of correct length, it modifies the report packet so + that each element in the given list of usages has been unset in the + report packet. + + This function is the "undo" operation for SetUsages. If the given usage + is not already set in the Report, it will return an error code of + HIDP_STATUS_BUTTON_NOT_PRESSED. If the button is pressed, HidP_UnsetUsages + will unset the appropriate bit or remove the corresponding index value from + the HID Main Array Item. + + A properly initialized Report packet is one of the correct byte length, + and all zeros.. + + NOTE: A packet that has already been set with a call to a HidP_Set routine + can also be passed in. This routine then processes the UsageList + in the same fashion but verifies that the ReportID already set in + Report matches the report ID for the given usages. + +Parameters: + ReportType One of HidP_Input, HidP_Output or HidP_Feature. + + UsagePage All of the usages in the usage array, which HidP_UnsetUsages will + unset in the report, refer to this same usage page. + If a client wishes to unset usages in a report for multiple + usage pages then that client needs to make multiple calls to + HidP_UnsetUsages for each of the usage pages. + + UsageList A usage array containing the usages that HidP_UnsetUsages will + unset in the report packet. + + UsageLength The length of the given usage array in array elements. + The parser will set this value to the position in the usage + array where it stopped processing. If successful, UsageLength + will be unchanged. In any error condition, this parameter + reflects how many of the usages in the usage list have + actually been unset by the parser. This is useful for finding + the usage in the list which caused the error. + + PreparsedData The preparsed data recevied from HIDCLASS + + Report The report packet. + + ReportLength Length of the given report packet...Must be equal to the + value reported in the HIDP_CAPS structure for the device + and corresponding report type. + +Return Value + HidP_UnsetUsages returns the following error codes. On error, the report + packet will be correct up until the usage element that caused the error. + + HIDP_STATUS_SUCCESS -- upon successful "unsetting" of all usages + in the report packet. + HIDP_STATUS_INVALID_REPORT_TYPE -- if ReportType is not valid. + HIDP_STATUS_INVALID_PREPARSED_DATA -- if PreparsedData is not valid + HIDP_STATUS_INVALID_REPORT_LENGTH -- the length of the report packet is not + equal to the length specified in + the HIDP_CAPS structure for the given + ReportType + HIDP_STATUS_REPORT_DOES_NOT_EXIST -- if there are no reports on this device + for the given ReportType + HIDP_STATUS_INCOMPATIBLE_REPORT_ID -- if a usage was found that exists in a + different report. If the report is + zero-initialized on entry the first + usage in the list will determine which + report ID is used. Otherwise, the + parser will verify that usage matches + the passed in report's ID + HIDP_STATUS_USAGE_NOT_FOUND -- if the usage does not exist for any + report (no matter what the report ID) + for the given report type. + HIDP_STATUS_BUTTON_NOT_PRESSED -- if a usage corresponds to a button that + is not already set in the given report +--*/ + +#define HidP_GetButtons(Rty, UPa, LCo, ULi, ULe, Ppd, Rep, RLe) \ + HidP_GetUsages(Rty, UPa, LCo, ULi, ULe, Ppd, Rep, RLe) + + +NTSTATUS __stdcall +HidP_GetUsages ( + HIDP_REPORT_TYPE ReportType, + USAGE UsagePage, + USHORT LinkCollection, + PUSAGE UsageList, + PULONG UsageLength, + PHIDP_PREPARSED_DATA PreparsedData, + PCHAR Report, + ULONG ReportLength + ); +/*++ + +Routine Description: + This function returns the binary values (buttons) that are set in a HID + report. Given a report packet of correct length, it searches the report + packet for each usage for the given usage page and returns them in the + usage list. + +Parameters: + ReportType One of HidP_Input, HidP_Output or HidP_Feature. + + UsagePage All of the usages in the usage list, which HidP_GetUsages will + retrieve in the report, refer to this same usage page. + If the client wishes to get usages in a packet for multiple + usage pages then that client needs to make multiple calls + to HidP_GetUsages. + + LinkCollection An optional value which can limit which usages are returned + in the UsageList to those usages that exist in a specific + LinkCollection. A non-zero value indicates the index into + the HIDP_LINK_COLLECITON_NODE list returned by + HidP_GetLinkCollectionNodes of the link collection the + usage should belong to. A value of 0 indicates this + should value be ignored. + + UsageList The usage array that will contain all the usages found in + the report packet. + + UsageLength The length of the given usage array in array elements. + On input, this value describes the length of the usage list. + On output, HidP_GetUsages sets this value to the number of + usages that was found. Use HidP_MaxUsageListLength to + determine the maximum length needed to return all the usages + that a given report packet may contain. + + PreparsedData Preparsed data structure returned by HIDCLASS + + Report The report packet. + + ReportLength Length (in bytes) of the given report packet + + +Return Value + HidP_GetUsages returns the following error codes: + + HIDP_STATUS_SUCCESS -- upon successfully retrieving all the + usages from the report packet + HIDP_STATUS_INVALID_REPORT_TYPE -- if ReportType is not valid. + HIDP_STATUS_INVALID_PREPARSED_DATA -- if PreparsedData is not valid + HIDP_STATUS_INVALID_REPORT_LENGTH -- the length of the report packet is not + equal to the length specified in + the HIDP_CAPS structure for the given + ReportType + HIDP_STATUS_REPORT_DOES_NOT_EXIST -- if there are no reports on this device + for the given ReportType + HIDP_STATUS_BUFFER_TOO_SMALL -- if the UsageList is not big enough to + hold all the usages found in the report + packet. If this is returned, the buffer + will contain UsageLength number of + usages. Use HidP_MaxUsageListLength to + find the maximum length needed + HIDP_STATUS_INCOMPATIBLE_REPORT_ID -- if no usages were found but usages + that match the UsagePage and + LinkCollection specified could be found + in a report with a different report ID + HIDP_STATUS_USAGE_NOT_FOUND -- if there are no usages in a reports for + the device and ReportType that match the + UsagePage and LinkCollection that were + specified +--*/ + +#define HidP_GetButtonsEx(Rty, LCo, BLi, ULe, Ppd, Rep, RLe) \ + HidP_GetUsagesEx(Rty, LCo, BLi, ULe, Ppd, Rep, RLe) + +NTSTATUS __stdcall +HidP_GetUsagesEx ( + HIDP_REPORT_TYPE ReportType, + USHORT LinkCollection, // Optional + PUSAGE_AND_PAGE ButtonList, + ULONG * UsageLength, + PHIDP_PREPARSED_DATA PreparsedData, + reads_bytes_(ReportLength) PCHAR Report, + ULONG ReportLength + ); + +/*++ + +Routine Description: + This function returns the binary values (buttons) in a HID report. + Given a report packet of correct length, it searches the report packet + for all buttons and returns the UsagePage and Usage for each of the buttons + it finds. + +Parameters: + ReportType One of HidP_Input, HidP_Output or HidP_Feature. + + LinkCollection An optional value which can limit which usages are returned + in the ButtonList to those usages that exist in a specific + LinkCollection. A non-zero value indicates the index into + the HIDP_LINK_COLLECITON_NODE list returned by + HidP_GetLinkCollectionNodes of the link collection the + usage should belong to. A value of 0 indicates this + should value be ignored. + + ButtonList An array of USAGE_AND_PAGE structures describing all the + buttons currently ``down'' in the device. + + UsageLength The length of the given array in terms of elements. + On input, this value describes the length of the list. On + output, HidP_GetUsagesEx sets this value to the number of + usages that were found. Use HidP_MaxUsageListLength to + determine the maximum length needed to return all the usages + that a given report packet may contain. + + PreparsedData Preparsed data returned by HIDCLASS + + Report The report packet. + + ReportLength Length (in bytes) of the given report packet. + + +Return Value + HidP_GetUsagesEx returns the following error codes: + + HIDP_STATUS_SUCCESS -- upon successfully retrieving all the + usages from the report packet + HIDP_STATUS_INVALID_REPORT_TYPE -- if ReportType is not valid. + HIDP_STATUS_INVALID_PREPARSED_DATA -- if PreparsedData is not valid + HIDP_STATUS_INVALID_REPORT_LENGTH -- the length of the report packet is not + equal to the length specified in + the HIDP_CAPS structure for the given + ReportType + HIDP_STATUS_REPORT_DOES_NOT_EXIST -- if there are no reports on this device + for the given ReportType + HIDP_STATUS_BUFFER_TOO_SMALL -- if ButtonList is not big enough to + hold all the usages found in the report + packet. If this is returned, the buffer + will contain UsageLength number of + usages. Use HidP_MaxUsageListLength to + find the maximum length needed + HIDP_STATUS_INCOMPATIBLE_REPORT_ID -- if no usages were found but usages + that match the specified LinkCollection + exist in report with a different report + ID. + HIDP_STATUS_USAGE_NOT_FOUND -- if there are no usages in any reports that + match the LinkCollection parameter +--*/ + +_IRQL_requires_max_(PASSIVE_LEVEL) +ULONG __stdcall +HidP_MaxUsageListLength ( + HIDP_REPORT_TYPE ReportType, + USAGE UsagePage, // Optional + PHIDP_PREPARSED_DATA PreparsedData + ); +/*++ +Routine Description: + This function returns the maximum number of usages that a call to + HidP_GetUsages or HidP_GetUsagesEx could return for a given HID report. + If calling for number of usages returned by HidP_GetUsagesEx, use 0 as + the UsagePage value. + +Parameters: + ReportType One of HidP_Input, HidP_Output or HidP_Feature. + + UsagePage Specifies the optional UsagePage to query for. If 0, will + return all the maximum number of usage values that could be + returned for a given ReportType. If non-zero, will return + the maximum number of usages that would be returned for the + ReportType with the given UsagePage. + + PreparsedData Preparsed data returned from HIDCLASS + +Return Value: + The length of the usage list array required for the HidP_GetUsages or + HidP_GetUsagesEx function call. If an error occurs (such as + HIDP_STATUS_INVALID_REPORT_TYPE or HIDP_INVALID_PREPARSED_DATA, this + returns 0. +--*/ + + +NTSTATUS __stdcall +HidP_SetUsageValue ( + HIDP_REPORT_TYPE ReportType, + USAGE UsagePage, + USHORT LinkCollection, + USAGE Usage, + ULONG UsageValue, + PHIDP_PREPARSED_DATA PreparsedData, + updates_bytes_(ReportLength) PCHAR Report, + ULONG ReportLength + ); +/*++ +Description: + HidP_SetUsageValue inserts a value into the HID Report Packet in the field + corresponding to the given usage page and usage. HidP_SetUsageValue + casts this value to the appropriate bit length. If a report packet + contains two different fields with the same Usage and UsagePage, + they can be distinguished with the optional LinkCollection field value. + Using this function sets the raw value into the report packet with + no checking done as to whether it actually falls within the logical + minimum/logical maximum range. Use HidP_SetScaledUsageValue for this... + + NOTE: Although the UsageValue parameter is a ULONG, any casting that is + done will preserve or sign-extend the value. The value being set + should be considered a LONG value and will be treated as such by + this function. + +Parameters: + + ReportType One of HidP_Output or HidP_Feature. + + UsagePage The usage page to which the given usage refers. + + LinkCollection (Optional) This value can be used to differentiate + between two fields that may have the same + UsagePage and Usage but exist in different + collections. If the link collection value + is zero, this function will set the first field + it finds that matches the usage page and + usage. + + Usage The usage whose value HidP_SetUsageValue will set. + + UsageValue The raw value to set in the report buffer. This value must be within + the logical range or if a NULL value this value should be the + most negative value that can be represented by the number of bits + for this field. + + PreparsedData The preparsed data returned for HIDCLASS + + Report The report packet. + + ReportLength Length (in bytes) of the given report packet. + + +Return Value: + HidP_SetUsageValue returns the following error codes: + + HIDP_STATUS_SUCCESS -- upon successfully setting the value + in the report packet + HIDP_STATUS_INVALID_REPORT_TYPE -- if ReportType is not valid. + HIDP_STATUS_INVALID_PREPARSED_DATA -- if PreparsedData is not valid + HIDP_STATUS_INVALID_REPORT_LENGTH -- the length of the report packet is not + equal to the length specified in + the HIDP_CAPS structure for the given + ReportType + HIDP_STATUS_REPORT_DOES_NOT_EXIST -- if there are no reports on this device + for the given ReportType + HIDP_STATUS_INCOMPATIBLE_REPORT_ID -- the specified usage page, usage and + link collection exist but exists in + a report with a different report ID + than the report being passed in. To + set this value, call HidP_SetUsageValue + again with a zero-initizialed report + packet + HIDP_STATUS_USAGE_NOT_FOUND -- if the usage page, usage, and link + collection combination does not exist + in any reports for this ReportType +--*/ + +NTSTATUS __stdcall +HidP_SetScaledUsageValue ( + HIDP_REPORT_TYPE ReportType, + USAGE UsagePage, + USHORT LinkCollection, + USAGE Usage, + LONG UsageValue, + PHIDP_PREPARSED_DATA PreparsedData, + updates_bytes_(ReportLength) PCHAR Report, + ULONG ReportLength + ); + +/*++ +Description: + HidP_SetScaledUsageValue inserts the UsageValue into the HID report packet + in the field corresponding to the given usage page and usage. If a report + packet contains two different fields with the same Usage and UsagePage, + they can be distinguished with the optional LinkCollection field value. + + If the specified field has a defined physical range, this function converts + the physical value specified to the corresponding logical value for the + report. If a physical value does not exist, the function will verify that + the value specified falls within the logical range and set according. + + If the range checking fails but the field has NULL values, the function will + set the field to the defined NULL value (most negative number possible) and + return HIDP_STATUS_NULL. In other words, use this function to set NULL + values for a given field by passing in a value that falls outside the + physical range if it is defined or the logical range otherwise. + + If the field does not support NULL values, an out of range error will be + returned instead. + +Parameters: + + ReportType One of HidP_Output or HidP_Feature. + + UsagePage The usage page to which the given usage refers. + + LinkCollection (Optional) This value can be used to differentiate + between two fields that may have the same + UsagePage and Usage but exist in different + collections. If the link collection value + is zero, this function will set the first field + it finds that matches the usage page and + usage. + + Usage The usage whose value HidP_SetScaledUsageValue will set. + + UsageValue The value to set in the report buffer. See the routine + description above for the different interpretations of this + value + + PreparsedData The preparsed data returned from HIDCLASS + + Report The report packet. + + ReportLength Length (in bytes) of the given report packet. + + +Return Value: + HidP_SetScaledUsageValue returns the following error codes: + + HIDP_STATUS_SUCCESS -- upon successfully setting the value + in the report packet + HIDP_STATUS_NULL -- upon successfully setting the value + in the report packet as a NULL value + HIDP_STATUS_INVALID_REPORT_TYPE -- if ReportType is not valid. + HIDP_STATUS_INVALID_PREPARSED_DATA -- if PreparsedData is not valid + HIDP_STATUS_INVALID_REPORT_LENGTH -- the length of the report packet is not + equal to the length specified in + the HIDP_CAPS structure for the given + ReportType + HIDP_STATUS_VALUEOF_RANGE -- if the value specified failed to fall + within the physical range if it exists + or within the logical range otherwise + and the field specified by the usage + does not allow NULL values + HIDP_STATUS_BAD_LOG_PHY_VALUES -- if the field has a physical range but + either the logical range is invalid + (max <= min) or the physical range is + invalid + HIDP_STATUS_INCOMPATIBLE_REPORT_ID -- the specified usage page, usage and + link collection exist but exists in + a report with a different report ID + than the report being passed in. To + set this value, call + HidP_SetScaledUsageValue again with + a zero-initialized report packet + HIDP_STATUS_USAGE_NOT_FOUND -- if the usage page, usage, and link + collection combination does not exist + in any reports for this ReportType +--*/ + +NTSTATUS __stdcall +HidP_SetUsageValueArray ( + HIDP_REPORT_TYPE ReportType, + USAGE UsagePage, + USHORT LinkCollection, + USAGE Usage, + reads_bytes_(UsageValueByteLength) PCHAR UsageValue, + USHORT UsageValueByteLength, + PHIDP_PREPARSED_DATA PreparsedData, + updates_bytes_(ReportLength) PCHAR Report, + ULONG ReportLength + ); + +/*++ +Routine Descripton: + A usage value array occurs when the last usage in the list of usages + describing a main item must be repeated because there are less usages defined + than there are report counts declared for the given main item. In this case + a single value cap is allocated for that usage and the report count of that + value cap is set to reflect the number of fields to which that usage refers. + + HidP_SetUsageValueArray sets the raw bits for that usage which spans + more than one field in a report. + + NOTE: This function currently does not support value arrays where the + ReportSize for each of the fields in the array is not a multiple + of 8 bits. + + The UsageValue buffer should have the values set as they would appear + in the report buffer. If this function supported non 8-bit multiples + for the ReportSize then caller should format the input buffer so that + each new value begins at the bit immediately following the last bit + of the previous value + +Parameters: + + ReportType One of HidP_Output or HidP_Feature. + + UsagePage The usage page to which the given usage refers. + + LinkCollection (Optional) This value can be used to differentiate + between two fields that may have the same + UsagePage and Usage but exist in different + collections. If the link collection value + is zero, this function will set the first field + it finds that matches the usage page and + usage. + + Usage The usage whose value array HidP_SetUsageValueArray will set. + + UsageValue The buffer with the values to set into the value array. + The number of BITS required is found by multiplying the + BitSize and ReportCount fields of the Value Cap for this + control. The least significant bit of this control found in the + given report will be placed in the least significan bit location + of the array given (little-endian format), regardless of whether + or not the field is byte alligned or if the BitSize is a multiple + of sizeof (CHAR). + + See the above note for current implementation limitations. + + UsageValueByteLength Length of the UsageValue buffer (in bytes) + + PreparsedData The preparsed data returned from HIDCLASS + + Report The report packet. + + ReportLength Length (in bytes) of the given report packet. + + +Return Value: + HIDP_STATUS_SUCCESS -- upon successfully setting the value + array in the report packet + HIDP_STATUS_INVALID_REPORT_TYPE -- if ReportType is not valid. + HIDP_STATUS_INVALID_PREPARSED_DATA -- if PreparsedData is not valid + HIDP_STATUS_INVALID_REPORT_LENGTH -- the length of the report packet is not + equal to the length specified in + the HIDP_CAPS structure for the given + ReportType + HIDP_STATUS_REPORT_DOES_NOT_EXIST -- if there are no reports on this device + for the given ReportType + HIDP_STATUS_NOT_VALUE_ARRAY -- if the control specified is not a + value array -- a value array will have + a ReportCount field in the + HIDP_VALUE_CAPS structure that is > 1 + Use HidP_SetUsageValue instead + HIDP_STATUS_BUFFER_TOO_SMALL -- if the size of the passed in buffer with + the values to set is too small (ie. has + fewer values than the number of fields in + the array + HIDP_STATUS_NOT_IMPLEMENTED -- if the usage value array has field sizes + that are not multiples of 8 bits, this + error code is returned since the function + currently does not handle setting into + such arrays. + HIDP_STATUS_INCOMPATIBLE_REPORT_ID -- the specified usage page, usage and + link collection exist but exists in + a report with a different report ID + than the report being passed in. To + set this value, call + HidP_SetUsageValueArray again with + a zero-initialized report packet + HIDP_STATUS_USAGE_NOT_FOUND -- if the usage page, usage, and link + collection combination does not exist + in any reports for this ReportType +--*/ + + +NTSTATUS __stdcall +HidP_GetUsageValue ( + HIDP_REPORT_TYPE ReportType, + USAGE UsagePage, + USHORT LinkCollection, + USAGE Usage, + PULONG UsageValue, + PHIDP_PREPARSED_DATA PreparsedData, + reads_bytes_(ReportLength) PCHAR Report, + ULONG ReportLength + ); + +/* +Description + HidP_GetUsageValue retrieves the value from the HID Report for the usage + specified by the combination of usage page, usage and link collection. + If a report packet contains two different fields with the same + Usage and UsagePage, they can be distinguished with the optional + LinkCollection field value. + +Parameters: + + ReportType One of HidP_Input or HidP_Feature. + + UsagePage The usage page to which the given usage refers. + + LinkCollection (Optional) This value can be used to differentiate + between two fields that may have the same + UsagePage and Usage but exist in different + collections. If the link collection value + is zero, this function will set the first field + it finds that matches the usage page and + usage. + + Usage The usage whose value HidP_GetUsageValue will retrieve + + UsageValue The raw value that is set for the specified field in the report + buffer. This value will either fall within the logical range + or if NULL values are allowed, a number outside the range to + indicate a NULL + + PreparsedData The preparsed data returned for HIDCLASS + + Report The report packet. + + ReportLength Length (in bytes) of the given report packet. + + +Return Value: + HidP_GetUsageValue returns the following error codes: + + HIDP_STATUS_SUCCESS -- upon successfully retrieving the value + from the report packet + HIDP_STATUS_INVALID_REPORT_TYPE -- if ReportType is not valid. + HIDP_STATUS_INVALID_PREPARSED_DATA -- if PreparsedData is not valid + HIDP_STATUS_INVALID_REPORT_LENGTH -- the length of the report packet is not + equal to the length specified in + the HIDP_CAPS structure for the given + ReportType + HIDP_STATUS_REPORT_DOES_NOT_EXIST -- if there are no reports on this device + for the given ReportType + HIDP_STATUS_INCOMPATIBLE_REPORT_ID -- the specified usage page, usage and + link collection exist but exists in + a report with a different report ID + than the report being passed in. To + set this value, call HidP_GetUsageValue + again with a different report packet + HIDP_STATUS_USAGE_NOT_FOUND -- if the usage page, usage, and link + collection combination does not exist + in any reports for this ReportType +--*/ + + +NTSTATUS __stdcall +HidP_GetScaledUsageValue ( + HIDP_REPORT_TYPE ReportType, + USAGE UsagePage, + USHORT LinkCollection, + USAGE Usage, + PLONG UsageValue, + PHIDP_PREPARSED_DATA PreparsedData, + reads_bytes_(ReportLength) PCHAR Report, + ULONG ReportLength + ); + +/*++ +Description + HidP_GetScaledUsageValue retrieves a UsageValue from the HID report packet + in the field corresponding to the given usage page and usage. If a report + packet contains two different fields with the same Usage and UsagePage, + they can be distinguished with the optional LinkCollection field value. + + If the specified field has a defined physical range, this function converts + the logical value that exists in the report packet to the corresponding + physical value. If a physical range does not exist, the function will + return the logical value. This function will check to verify that the + logical value in the report falls within the declared logical range. + + When doing the conversion between logical and physical values, this + function assumes a linear extrapolation between the physical max/min and + the logical max/min. (Where logical is the values reported by the device + and physical is the value returned by this function). If the data field + size is less than 32 bits, then HidP_GetScaledUsageValue will sign extend + the value to 32 bits. + + If the range checking fails but the field has NULL values, the function + will set UsageValue to 0 and return HIDP_STATUS_NULL. Otherwise, it + returns a HIDP_STATUSOF_RANGE error. + +Parameters: + + ReportType One of HidP_Output or HidP_Feature. + + UsagePage The usage page to which the given usage refers. + + LinkCollection (Optional) This value can be used to differentiate + between two fields that may have the same + UsagePage and Usage but exist in different + collections. If the link collection value + is zero, this function will retrieve the first + field it finds that matches the usage page + and usage. + + Usage The usage whose value HidP_GetScaledUsageValue will retrieve + + UsageValue The value retrieved from the report buffer. See the routine + description above for the different interpretations of this + value + + PreparsedData The preparsed data returned from HIDCLASS + + Report The report packet. + + ReportLength Length (in bytes) of the given report packet. + + +Return Value: + HidP_GetScaledUsageValue returns the following error codes: + + HIDP_STATUS_SUCCESS -- upon successfully retrieving the value + from the report packet + HIDP_STATUS_NULL -- if the report packet had a NULL value + set + HIDP_STATUS_INVALID_REPORT_TYPE -- if ReportType is not valid. + HIDP_STATUS_INVALID_PREPARSED_DATA -- if PreparsedData is not valid + HIDP_STATUS_INVALID_REPORT_LENGTH -- the length of the report packet is not + equal to the length specified in + the HIDP_CAPS structure for the given + ReportType + HIDP_STATUS_VALUEOF_RANGE -- if the value retrieved from the packet + falls outside the logical range and + the field does not support NULL values + HIDP_STATUS_BAD_LOG_PHY_VALUES -- if the field has a physical range but + either the logical range is invalid + (max <= min) or the physical range is + invalid + HIDP_STATUS_INCOMPATIBLE_REPORT_ID -- the specified usage page, usage and + link collection exist but exists in + a report with a different report ID + than the report being passed in. To + set this value, call + HidP_GetScaledUsageValue with a + different report packet + HIDP_STATUS_USAGE_NOT_FOUND -- if the usage page, usage, and link + collection combination does not exist + in any reports for this ReportType +--*/ + +NTSTATUS __stdcall +HidP_GetUsageValueArray ( + HIDP_REPORT_TYPE ReportType, + USAGE UsagePage, + USHORT LinkCollection, + USAGE Usage, + updates_bytes_(UsageValueByteLength) PCHAR UsageValue, + USHORT UsageValueByteLength, + PHIDP_PREPARSED_DATA PreparsedData, + reads_bytes_(ReportLength) PCHAR Report, + ULONG ReportLength + ); + +/*++ +Routine Descripton: + A usage value array occurs when the last usage in the list of usages + describing a main item must be repeated because there are less usages defined + than there are report counts declared for the given main item. In this case + a single value cap is allocated for that usage and the report count of that + value cap is set to reflect the number of fields to which that usage refers. + + HidP_GetUsageValueArray returns the raw bits for that usage which spans + more than one field in a report. + + NOTE: This function currently does not support value arrays where the + ReportSize for each of the fields in the array is not a multiple + of 8 bits. + + The UsageValue buffer will have the raw values as they are set + in the report packet. + +Parameters: + + ReportType One of HidP_Input, HidP_Output or HidP_Feature. + + UsagePage The usage page to which the given usage refers. + + LinkCollection (Optional) This value can be used to differentiate + between two fields that may have the same + UsagePage and Usage but exist in different + collections. If the link collection value + is zero, this function will set the first field + it finds that matches the usage page and + usage. + + Usage The usage whose value HidP_GetUsageValueArray will retreive. + + UsageValue A pointer to an array of characters where the value will be + placed. The number of BITS required is found by multiplying the + BitSize and ReportCount fields of the Value Cap for this + control. The least significant bit of this control found in the + given report will be placed in the least significant bit location + of the buffer (little-endian format), regardless of whether + or not the field is byte aligned or if the BitSize is a multiple + of sizeof (CHAR). + + See note above about current implementation limitations + + UsageValueByteLength + the length of the given UsageValue buffer. + + PreparsedData The preparsed data returned by the HIDCLASS + + Report The report packet. + + ReportLength Length of the given report packet. + +Return Value: + + HIDP_STATUS_SUCCESS -- upon successfully retrieving the value + from the report packet + HIDP_STATUS_INVALID_REPORT_TYPE -- if ReportType is not valid. + HIDP_STATUS_INVALID_PREPARSED_DATA -- if PreparsedData is not valid + HIDP_STATUS_INVALID_REPORT_LENGTH -- the length of the report packet is not + equal to the length specified in + the HIDP_CAPS structure for the given + ReportType + HIDP_STATUS_NOT_VALUE_ARRAY -- if the control specified is not a + value array -- a value array will have + a ReportCount field in the + HIDP_VALUE_CAPS structure that is > 1 + Use HidP_GetUsageValue instead + HIDP_STATUS_BUFFER_TOO_SMALL -- if the size of the passed in buffer in + which to return the array is too small + (ie. has fewer values than the number of + fields in the array + HIDP_STATUS_NOT_IMPLEMENTED -- if the usage value array has field sizes + that are not multiples of 8 bits, this + error code is returned since the function + currently does not handle getting values + from such arrays. + HIDP_STATUS_INCOMPATIBLE_REPORT_ID -- the specified usage page, usage and + link collection exist but exists in + a report with a different report ID + than the report being passed in. To + set this value, call + HidP_GetUsageValueArray with a + different report packet + HIDP_STATUS_USAGE_NOT_FOUND -- if the usage page, usage, and link + collection combination does not exist + in any reports for this ReportType +--*/ + + +_IRQL_requires_max_(PASSIVE_LEVEL) +NTSTATUS __stdcall +HidP_UsageListDifference ( + reads_(UsageListLength) PUSAGE PreviousUsageList, + reads_(UsageListLength) PUSAGE CurrentUsageList, + writes_(UsageListLength) PUSAGE BreakUsageList, + writes_(UsageListLength) PUSAGE MakeUsageList, + ULONG UsageListLength + ); +/*++ +Routine Description: + This function will return the difference between a two lists of usages + (as might be returned from HidP_GetUsages), In other words, it will return + return a list of usages that are in the current list but not the previous + list as well as a list of usages that are in the previous list but not + the current list. + +Parameters: + + PreviousUsageList The list of usages before. + CurrentUsageList The list of usages now. + BreakUsageList Previous - Current. + MakeUsageList Current - Previous. + UsageListLength Represents the length of the usage lists in array + elements. If comparing two lists with a differing + number of array elements, this value should be + the size of the larger of the two lists. Any + zero found with a list indicates an early termination + of the list and any usages found after the first zero + will be ignored. +--*/ + + +_IRQL_requires_max_(PASSIVE_LEVEL) +NTSTATUS __stdcall +HidP_UsageAndPageListDifference ( + reads_(UsageListLength) PUSAGE_AND_PAGE PreviousUsageList, + reads_(UsageListLength) PUSAGE_AND_PAGE CurrentUsageList, + writes_(UsageListLength) PUSAGE_AND_PAGE BreakUsageList, + writes_(UsageListLength) PUSAGE_AND_PAGE MakeUsageList, + ULONG UsageListLength + ); + +// +// Produce Make or Break Codes +// +typedef enum _HIDP_KEYBOARD_DIRECTION { + HidP_Keyboard_Break, + HidP_Keyboard_Make +} HIDP_KEYBOARD_DIRECTION; + +// +// A bitmap of the current shift state of the keyboard when using the +// below keyboard usages to i8042 translation function. +// +typedef struct _HIDP_KEYBOARD_MODIFIER_STATE { + union { + struct { + ULONG LeftControl: 1; + ULONG LeftShift: 1; + ULONG LeftAlt: 1; + ULONG LeftGUI: 1; + ULONG RightControl: 1; + ULONG RightShift: 1; + ULONG RightAlt: 1; + ULONG RigthGUI: 1; + ULONG CapsLock: 1; + ULONG ScollLock: 1; + ULONG NumLock: 1; + ULONG Reserved: 21; + }; + ULONG ul; + }; + +} HIDP_KEYBOARD_MODIFIER_STATE, * PHIDP_KEYBOARD_MODIFIER_STATE; + +// +// A call back function to give the i8042 scan codes to the caller of +// the below translation function. +// +typedef BOOLEAN (* PHIDP_INSERT_SCANCODES) ( + PVOID Context, // Some caller supplied context. + reads_bytes_(Length) PCHAR NewScanCodes, // A list of i8042 scan codes. + ULONG Length // the length of the scan codes. + ); + + +NTSTATUS __stdcall +HidP_TranslateUsageAndPagesToI8042ScanCodes ( + reads_(UsageListLength) PUSAGE_AND_PAGE ChangedUsageList, + ULONG UsageListLength, + HIDP_KEYBOARD_DIRECTION KeyAction, + PHIDP_KEYBOARD_MODIFIER_STATE ModifierState, + PHIDP_INSERT_SCANCODES InsertCodesProcedure, + PVOID InsertCodesContext + ); +/*++ +Routine Description: +Parameters: +--*/ + +NTSTATUS __stdcall +HidP_TranslateUsagesToI8042ScanCodes ( + reads_(UsageListLength) PUSAGE ChangedUsageList, + ULONG UsageListLength, + HIDP_KEYBOARD_DIRECTION KeyAction, + PHIDP_KEYBOARD_MODIFIER_STATE ModifierState, + PHIDP_INSERT_SCANCODES InsertCodesProcedure, + PVOID InsertCodesContext + ); +/*++ +Routine Description: +Parameters: +--*/ + + + +// +// Define NT Status codes with Facility Code of FACILITY_HID_ERROR_CODE +// + +// FACILITY_HID_ERROR_CODE defined in ntstatus.h +#ifndef FACILITY_HID_ERROR_CODE +#define FACILITY_HID_ERROR_CODE 0x11 +#endif + +#define HIDP_ERROR_CODES(SEV, CODE) \ + ((NTSTATUS) (((SEV) << 28) | (FACILITY_HID_ERROR_CODE << 16) | (CODE))) + +#define HIDP_STATUS_SUCCESS (HIDP_ERROR_CODES(0x0,0)) +#define HIDP_STATUS_NULL (HIDP_ERROR_CODES(0x8,1)) +#define HIDP_STATUS_INVALID_PREPARSED_DATA (HIDP_ERROR_CODES(0xC,1)) +#define HIDP_STATUS_INVALID_REPORT_TYPE (HIDP_ERROR_CODES(0xC,2)) +#define HIDP_STATUS_INVALID_REPORT_LENGTH (HIDP_ERROR_CODES(0xC,3)) +#define HIDP_STATUS_USAGE_NOT_FOUND (HIDP_ERROR_CODES(0xC,4)) +#define HIDP_STATUS_VALUEOF_RANGE (HIDP_ERROR_CODES(0xC,5)) +#define HIDP_STATUS_BAD_LOG_PHY_VALUES (HIDP_ERROR_CODES(0xC,6)) +#define HIDP_STATUS_BUFFER_TOO_SMALL (HIDP_ERROR_CODES(0xC,7)) +#define HIDP_STATUS_INTERNAL_ERROR (HIDP_ERROR_CODES(0xC,8)) +#define HIDP_STATUS_I8042_TRANS_UNKNOWN (HIDP_ERROR_CODES(0xC,9)) +#define HIDP_STATUS_INCOMPATIBLE_REPORT_ID (HIDP_ERROR_CODES(0xC,0xA)) +#define HIDP_STATUS_NOT_VALUE_ARRAY (HIDP_ERROR_CODES(0xC,0xB)) +#define HIDP_STATUS_IS_VALUE_ARRAY (HIDP_ERROR_CODES(0xC,0xC)) +#define HIDP_STATUS_DATA_INDEX_NOT_FOUND (HIDP_ERROR_CODES(0xC,0xD)) +#define HIDP_STATUS_DATA_INDEXOF_RANGE (HIDP_ERROR_CODES(0xC,0xE)) +#define HIDP_STATUS_BUTTON_NOT_PRESSED (HIDP_ERROR_CODES(0xC,0xF)) +#define HIDP_STATUS_REPORT_DOES_NOT_EXIST (HIDP_ERROR_CODES(0xC,0x10)) +#define HIDP_STATUS_NOT_IMPLEMENTED (HIDP_ERROR_CODES(0xC,0x20)) + +// +// We blundered this status code. +// +#define HIDP_STATUS_I8242_TRANS_UNKNOWN HIDP_STATUS_I8042_TRANS_UNKNOWN + +/*++ + +Copyright (c) Microsoft Corporation. All rights reserved. + +Module Name: + + HIDSDI.H + +Abstract: + + This module contains the PUBLIC definitions for the + code that implements the HID dll. + +Environment: + + Kernel & user mode + +--*/ + + + + +typedef struct _HIDD_CONFIGURATION { + PVOID cookie; + ULONG size; + ULONG RingBufferSize; +} HIDD_CONFIGURATION, *PHIDD_CONFIGURATION; + +typedef struct _HIDD_ATTRIBUTES { + ULONG Size; // = sizeof (struct _HIDD_ATTRIBUTES) + + // + // Vendor ids of this hid device + // + USHORT VendorID; + USHORT ProductID; + USHORT VersionNumber; + + // + // Additional fields will be added to the end of this structure. + // +} HIDD_ATTRIBUTES, *PHIDD_ATTRIBUTES; + + +BOOLEAN __stdcall +HidD_GetAttributes ( + HANDLE HidDeviceObject, + PHIDD_ATTRIBUTES Attributes + ); +/*++ +Routine Description: + Fill in the given HIDD_ATTRIBUTES structure with the attributes of the + given hid device. + +--*/ + + +void __stdcall +HidD_GetHidGuid ( + LPGUID HidGuid + ); + + +BOOLEAN __stdcall +HidD_GetPreparsedData ( + HANDLE HidDeviceObject, + PHIDP_PREPARSED_DATA * PreparsedData + ); +/*++ +Routine Description: + Given a handle to a valid Hid Class Device Object, retrieve the preparsed + data for the device. This routine will allocate the appropriately + sized buffer to hold this preparsed data. It is up to client to call + HidP_FreePreparsedData to free the memory allocated to this structure when + it is no longer needed. + +Arguments: + HidDeviceObject A handle to a Hid Device that the client obtains using + a call to CreateFile on a valid Hid device string name. + The string name can be obtained using standard PnP calls. + + PreparsedData An opaque data structure used by other functions in this + library to retrieve information about a given device. + +Return Value: + TRUE if successful. + FALSE otherwise -- Use GetLastError() to get extended error information +--*/ +BOOLEAN __stdcall +HidD_FreePreparsedData ( + __drv_freesMem(Mem) PHIDP_PREPARSED_DATA PreparsedData + ); + +BOOLEAN __stdcall +HidD_FlushQueue ( + HANDLE HidDeviceObject + ); +/*++ +Routine Description: + Flush the input queue for the given HID device. + +Arguments: + HidDeviceObject A handle to a Hid Device that the client obtains using + a call to CreateFile on a valid Hid device string name. + The string name can be obtained using standard PnP calls. + +Return Value: + TRUE if successful + FALSE otherwise -- Use GetLastError() to get extended error information +--*/ + +BOOLEAN __stdcall +HidD_GetConfiguration ( + HANDLE HidDeviceObject, + PHIDD_CONFIGURATION Configuration, + ULONG ConfigurationLength + ); +/*++ +Routine Description: + Get the configuration information for this Hid device + +Arguments: + HidDeviceObject A handle to a Hid Device Object. + + Configuration A configuration structure. HidD_GetConfiguration MUST + be called before the configuration can be modified and + set using HidD_SetConfiguration + + ConfigurationLength That is ``sizeof (HIDD_CONFIGURATION)''. Using this + parameter, we can later increase the length of the + configuration array and not break older apps. + +Return Value: + TRUE if successful + FALSE otherwise -- Use GetLastError() to get extended error information +--*/ + +BOOLEAN __stdcall +HidD_SetConfiguration ( + HANDLE HidDeviceObject, + reads_bytes_(ConfigurationLength) PHIDD_CONFIGURATION Configuration, + ULONG ConfigurationLength + ); +/*++ +Routine Description: + Set the configuration information for this Hid device... + + NOTE: HidD_GetConfiguration must be called to retrieve the current + configuration information before this information can be modified + and set. + +Arguments: + HidDeviceObject A handle to a Hid Device Object. + + Configuration A configuration structure. HidD_GetConfiguration MUST + be called before the configuration can be modified and + set using HidD_SetConfiguration + + ConfigurationLength That is ``sizeof (HIDD_CONFIGURATION)''. Using this + parameter, we can later increase the length of the + configuration array and not break older apps. + +Return Value: + TRUE if successful + FALSE otherwise -- Use GetLastError() to get extended error information +--*/ + +BOOLEAN __stdcall +HidD_GetFeature ( + HANDLE HidDeviceObject, + PVOID ReportBuffer, + ULONG ReportBufferLength + ); +/*++ +Routine Description: + Retrieve a feature report from a HID device. + +Arguments: + HidDeviceObject A handle to a Hid Device Object. + + ReportBuffer The buffer that the feature report should be placed + into. The first byte of the buffer should be set to + the report ID of the desired report + + ReportBufferLength The size (in bytes) of ReportBuffer. This value + should be greater than or equal to the + FeatureReportByteLength field as specified in the + HIDP_CAPS structure for the device +Return Value: + TRUE if successful + FALSE otherwise -- Use GetLastError() to get extended error information +--*/ + +BOOLEAN __stdcall +HidD_SetFeature ( + HANDLE HidDeviceObject, + reads_bytes_(ReportBufferLength) PVOID ReportBuffer, + ULONG ReportBufferLength + ); +/*++ +Routine Description: + Send a feature report to a HID device. + +Arguments: + HidDeviceObject A handle to a Hid Device Object. + + ReportBuffer The buffer of the feature report to send to the device + + ReportBufferLength The size (in bytes) of ReportBuffer. This value + should be greater than or equal to the + FeatureReportByteLength field as specified in the + HIDP_CAPS structure for the device +Return Value: + TRUE if successful + FALSE otherwise -- Use GetLastError() to get extended error information +--*/ + + + +BOOLEAN __stdcall +HidD_GetInputReport ( + HANDLE HidDeviceObject, + PVOID ReportBuffer, + ULONG ReportBufferLength + ); +/*++ +Routine Description: + Retrieve an input report from a HID device. + +Arguments: + HidDeviceObject A handle to a Hid Device Object. + + ReportBuffer The buffer that the input report should be placed + into. The first byte of the buffer should be set to + the report ID of the desired report + + ReportBufferLength The size (in bytes) of ReportBuffer. This value + should be greater than or equal to the + InputReportByteLength field as specified in the + HIDP_CAPS structure for the device +Return Value: + TRUE if successful + FALSE otherwise -- Use GetLastError() to get extended error information +--*/ + +BOOLEAN __stdcall +HidD_SetOutputReport ( + HANDLE HidDeviceObject, + reads_bytes_(ReportBufferLength) PVOID ReportBuffer, + ULONG ReportBufferLength + ); +/*++ +Routine Description: + Send an output report to a HID device. + +Arguments: + HidDeviceObject A handle to a Hid Device Object. + + ReportBuffer The buffer of the output report to send to the device + + ReportBufferLength The size (in bytes) of ReportBuffer. This value + should be greater than or equal to the + OutputReportByteLength field as specified in the + HIDP_CAPS structure for the device +Return Value: + TRUE if successful + FALSE otherwise -- Use GetLastError() to get extended error information +--*/ + +#endif + +BOOLEAN __stdcall +HidD_GetNumInputBuffers ( + HANDLE HidDeviceObject, + PULONG NumberBuffers + ); +/*++ +Routine Description: + This function returns the number of input buffers used by the specified + file handle to the Hid device. Each file object has a number of buffers + associated with it to queue reports read from the device but which have + not yet been read by the user-mode app with a handle to that device. + +Arguments: + HidDeviceObject A handle to a Hid Device Object. + + NumberBuffers Number of buffers currently being used for this file + handle to the Hid device + +Return Value: + TRUE if successful + FALSE otherwise -- Use GetLastError() to get extended error information +--*/ + +BOOLEAN __stdcall +HidD_SetNumInputBuffers ( + HANDLE HidDeviceObject, + ULONG NumberBuffers + ); +/*++ + +Routine Description: + This function sets the number of input buffers used by the specified + file handle to the Hid device. Each file object has a number of buffers + associated with it to queue reports read from the device but which have + not yet been read by the user-mode app with a handle to that device. + +Arguments: + HidDeviceObject A handle to a Hid Device Object. + + NumberBuffers New number of buffers to use for this file handle to + the Hid device + +Return Value: + TRUE if successful + FALSE otherwise -- Use GetLastError() to get extended error information +--*/ + +BOOLEAN __stdcall +HidD_GetPhysicalDescriptor ( + HANDLE HidDeviceObject, + PVOID Buffer, + ULONG BufferLength + ); +/*++ +Routine Description: + This function retrieves the raw physical descriptor for the specified + Hid device. + +Arguments: + HidDeviceObject A handle to a Hid Device Object. + + Buffer Buffer which on return will contain the physical + descriptor if one exists for the specified device + handle + + BufferLength Length of buffer (in bytes) + + +Return Value: + TRUE if successful + FALSE otherwise -- Use GetLastError() to get extended error information +--*/ + +BOOLEAN __stdcall +HidD_GetManufacturerString ( + HANDLE HidDeviceObject, + PVOID Buffer, + ULONG BufferLength + ); +/*++ +Routine Description: + This function retrieves the manufacturer string from the specified + Hid device. + +Arguments: + HidDeviceObject A handle to a Hid Device Object. + + Buffer Buffer which on return will contain the manufacturer + string returned from the device. This string is a + wide-character string + + BufferLength Length of Buffer (in bytes) + + +Return Value: + TRUE if successful + FALSE otherwise -- Use GetLastError() to get extended error information +--*/ + +BOOLEAN __stdcall +HidD_GetProductString ( + HANDLE HidDeviceObject, + PVOID Buffer, + ULONG BufferLength + ); +/*++ +Routine Description: + This function retrieves the product string from the specified + Hid device. + +Arguments: + HidDeviceObject A handle to a Hid Device Object. + + Buffer Buffer which on return will contain the product + string returned from the device. This string is a + wide-character string + + BufferLength Length of Buffer (in bytes) + + +Return Value: + TRUE if successful + FALSE otherwise -- Use GetLastError() to get extended error information +--*/ + +BOOLEAN __stdcall +HidD_GetIndexedString ( + HANDLE HidDeviceObject, + ULONG StringIndex, + PVOID Buffer, + ULONG BufferLength + ); +/*++ +Routine Description: + This function retrieves a string from the specified Hid device that is + specified with a certain string index. + +Arguments: + HidDeviceObject A handle to a Hid Device Object. + + StringIndex Index of the string to retrieve + + Buffer Buffer which on return will contain the product + string returned from the device. This string is a + wide-character string + + BufferLength Length of Buffer (in bytes) + +Return Value: + TRUE if successful + FALSE otherwise -- Use GetLastError() to get extended error information +--*/ + +BOOLEAN __stdcall +HidD_GetSerialNumberString ( + HANDLE HidDeviceObject, + PVOID Buffer, + ULONG BufferLength + ); +/*++ +Routine Description: + This function retrieves the serial number string from the specified + Hid device. + +Arguments: + HidDeviceObject A handle to a Hid Device Object. + + Buffer Buffer which on return will contain the serial number + string returned from the device. This string is a + wide-character string + + BufferLength Length of Buffer (in bytes) + +Return Value: + TRUE if successful + FALSE otherwise -- Use GetLastError() to get extended error information +--*/ + + + +BOOLEAN __stdcall +HidD_GetMsGenreDescriptor ( + HANDLE HidDeviceObject, + PVOID Buffer, + ULONG BufferLength + ); + + + + + diff -r cdc5f8f1b79e -r e2acfa51664f Win32/PInvoke/pinvoke-interop-assistant-input.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Win32/PInvoke/pinvoke-interop-assistant-input.c Sun Mar 15 20:30:00 2015 +0100 @@ -0,0 +1,154 @@ + +typedef USHORT USAGE, *PUSAGE; +typedef LONG NTSTATUS; + +typedef struct _HIDP_PREPARSED_DATA * PHIDP_PREPARSED_DATA; + +typedef enum _HIDP_REPORT_TYPE +{ + HidP_Input, + HidP_Output, + HidP_Feature +} HIDP_REPORT_TYPE; + +typedef struct _HIDP_CAPS +{ + USAGE Usage; + USAGE UsagePage; + USHORT InputReportByteLength; + USHORT OutputReportByteLength; + USHORT FeatureReportByteLength; + USHORT Reserved[17]; + + USHORT NumberLinkCollectionNodes; + + USHORT NumberInputButtonCaps; + USHORT NumberInputValueCaps; + USHORT NumberInputDataIndices; + + USHORT NumberOutputButtonCaps; + USHORT NumberOutputValueCaps; + USHORT NumberOutputDataIndices; + + USHORT NumberFeatureButtonCaps; + USHORT NumberFeatureValueCaps; + USHORT NumberFeatureDataIndices; +} HIDP_CAPS, *PHIDP_CAPS; + + +typedef struct _HIDP_BUTTON_CAPS +{ + USAGE UsagePage; + UCHAR ReportID; + BOOLEAN IsAlias; + + USHORT BitField; + USHORT LinkCollection; // A unique internal index pointer + + USAGE LinkUsage; + USAGE LinkUsagePage; + + BOOLEAN IsRange; + BOOLEAN IsStringRange; + BOOLEAN IsDesignatorRange; + BOOLEAN IsAbsolute; + + ULONG Reserved[10]; + union { + struct { + USAGE UsageMin, UsageMax; + USHORT StringMin, StringMax; + USHORT DesignatorMin, DesignatorMax; + USHORT DataIndexMin, DataIndexMax; + } Range; + struct { + USAGE Usage, Reserved1; + USHORT StringIndex, Reserved2; + USHORT DesignatorIndex, Reserved3; + USHORT DataIndex, Reserved4; + } NotRange; + }; + +} HIDP_BUTTON_CAPS, *PHIDP_BUTTON_CAPS; + +typedef struct _HIDP_VALUE_CAPS +{ + USAGE UsagePage; + UCHAR ReportID; + BOOLEAN IsAlias; + + USHORT BitField; + USHORT LinkCollection; // A unique internal index pointer + + USAGE LinkUsage; + USAGE LinkUsagePage; + + BOOLEAN IsRange; + BOOLEAN IsStringRange; + BOOLEAN IsDesignatorRange; + BOOLEAN IsAbsolute; + + BOOLEAN HasNull; // Does this channel have a null report union + UCHAR Reserved; + USHORT BitSize; // How many bits are devoted to this value? + + USHORT ReportCount; // See Note below. Usually set to 1. + USHORT Reserved2[5]; + + ULONG UnitsExp; + ULONG Units; + + LONG LogicalMin, LogicalMax; + LONG PhysicalMin, PhysicalMax; + + union { + struct { + USAGE UsageMin, UsageMax; + USHORT StringMin, StringMax; + USHORT DesignatorMin, DesignatorMax; + USHORT DataIndexMin, DataIndexMax; + } Range; + + struct { + USAGE Usage, Reserved1; + USHORT StringIndex, Reserved2; + USHORT DesignatorIndex, Reserved3; + USHORT DataIndex, Reserved4; + } NotRange; + }; +} HIDP_VALUE_CAPS, *PHIDP_VALUE_CAPS; + +NTSTATUS __stdcall +HidP_GetCaps ( + PHIDP_PREPARSED_DATA PreparsedData, + PHIDP_CAPS Capabilities + ); + + NTSTATUS __stdcall +HidP_GetButtonCaps ( + HIDP_REPORT_TYPE ReportType, + PHIDP_BUTTON_CAPS ButtonCaps, + PUSHORT ButtonCapsLength, + PHIDP_PREPARSED_DATA PreparsedData +); + +NTSTATUS __stdcall +HidP_GetValueCaps ( + HIDP_REPORT_TYPE ReportType, + PHIDP_VALUE_CAPS ValueCaps, + PUSHORT ValueCapsLength, + PHIDP_PREPARSED_DATA PreparsedData +); + +NTSTATUS __stdcall +HidP_GetUsageValue ( + HIDP_REPORT_TYPE ReportType, + USAGE UsagePage, + USHORT LinkCollection, + USAGE Usage, + PULONG UsageValue, + PHIDP_PREPARSED_DATA PreparsedData, + PCHAR Report, + ULONG ReportLength + ); + diff -r cdc5f8f1b79e -r e2acfa51664f genUsageTableEnum.pl --- a/genUsageTableEnum.pl Sun Mar 15 20:25:58 2015 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,106 +0,0 @@ -#!/usr/local/bin/perl -#Developed by Stéphane Lenclud -#Generate C# enumeration from parsing Hid Usage Table -#See ../data/gl.h -#Usage example -#perl -S genUsageTableEnum.pl ../data/gl.h - -use strict; -use warnings; - - -my $inputFile = $ARGV[0]; - -#my $dummy="lala"; -#$dummy=~s/(^\w)/uc($1)/e; -#print "$dummy"; -#exit(0); - -#Open input file -open INPUT, "< $inputFile" or die "Can't read $inputFile\n"; -my @lines = ; -close INPUT; - - -my %hash = (); - -my $count=0; -foreach my $line(@lines) - { - #if ($line=~ /^([a-fA-FxX\d]+)(.+)\s+\w+\s+15\..*$/) - if ($line=~ /^([a-fA-FxX\d]+)(.+)\s+\w+\s+\d+\..*$/) - { - my $string=$2; - my $value=$1; - - my $varName=FormatVarName($string); - - - $hash{$string}=$value; - - print "$varName = 0x$value,\n"; - } - else - { - #print "NO MATCH $line\n"; - } - } - -exit(0); - -#Output in sorted order -for my $string ( sort keys %hash ) - { - #print "_S8(\"$string\"),$hash{$string}, //$count\n"; - print "_S8(\"$string\"),$string, //$count\n"; - $count++; - } - - -print "$count const found.\n"; - -exit(0); - -# - -sub FormatVarName - { - my $text=$_[0]; - my $varName=""; - Trim($text); - #Make sure AC ends up as AppCtrl - $text=~s/(^AC)/App Ctrl/; - #Make sure AL ends up as AppLaunch - $text=~s/(^AL)/App Launch/; - #Replace / by white-space - $text=~s/\// /g; - #Replace + with Plus - $text=~s/\+/Plus/g; - #Replace - with white-space - $text=~s/-/ /g; - - - $text=lc($text); - while ($text=~/(\w+)\s+(.+)/) - { - my $word=$1; - $text=$2; - #upper case the first letter - $word=~s/(^\w)/uc($1)/e; - $varName.=$word; - } - - $text=~s/(^\w)/uc($1)/e; - $varName.=$text; - #get ride of - - $varName=~s/-(\w)/uc($1)/e; - - return $varName; - } - -sub Trim - { - $_[0] =~ s/^\s+//; #Trim leading space and line return char - $_[0] =~ s/\s+$//; #Trim trailling space and line return char - } - diff -r cdc5f8f1b79e -r e2acfa51664f pinvoke-input.txt --- a/pinvoke-input.txt Sun Mar 15 20:25:58 2015 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2226 +0,0 @@ -// -// SL: We use this file to generate P/Invoke using P/Invoke Interop Assistant. -// - - -typedef USHORT USAGE, *PUSAGE; -typedef LONG NTSTATUS; - -#define HIDP_LINK_COLLECTION_ROOT ((USHORT) -1) -#define HIDP_LINK_COLLECTION_UNSPECIFIED ((USHORT) 0) - - -typedef enum _HIDP_REPORT_TYPE -{ - HidP_Input, - HidP_Output, - HidP_Feature -} HIDP_REPORT_TYPE; - -typedef struct _USAGE_AND_PAGE -{ - USAGE Usage; - USAGE UsagePage; -} USAGE_AND_PAGE, *PUSAGE_AND_PAGE; - -#define HidP_IsSameUsageAndPage(u1, u2) ((* (PULONG) &u1) == (* (PULONG) &u2)) - -typedef struct _HIDP_BUTTON_CAPS -{ - USAGE UsagePage; - UCHAR ReportID; - BOOLEAN IsAlias; - - USHORT BitField; - USHORT LinkCollection; // A unique internal index pointer - - USAGE LinkUsage; - USAGE LinkUsagePage; - - BOOLEAN IsRange; - BOOLEAN IsStringRange; - BOOLEAN IsDesignatorRange; - BOOLEAN IsAbsolute; - - ULONG Reserved[10]; - union { - struct { - USAGE UsageMin, UsageMax; - USHORT StringMin, StringMax; - USHORT DesignatorMin, DesignatorMax; - USHORT DataIndexMin, DataIndexMax; - } Range; - struct { - USAGE Usage, Reserved1; - USHORT StringIndex, Reserved2; - USHORT DesignatorIndex, Reserved3; - USHORT DataIndex, Reserved4; - } NotRange; - }; - -} HIDP_BUTTON_CAPS, *PHIDP_BUTTON_CAPS; - - -typedef struct _HIDP_VALUE_CAPS -{ - USAGE UsagePage; - UCHAR ReportID; - BOOLEAN IsAlias; - - USHORT BitField; - USHORT LinkCollection; // A unique internal index pointer - - USAGE LinkUsage; - USAGE LinkUsagePage; - - BOOLEAN IsRange; - BOOLEAN IsStringRange; - BOOLEAN IsDesignatorRange; - BOOLEAN IsAbsolute; - - BOOLEAN HasNull; // Does this channel have a null report union - UCHAR Reserved; - USHORT BitSize; // How many bits are devoted to this value? - - USHORT ReportCount; // See Note below. Usually set to 1. - USHORT Reserved2[5]; - - ULONG UnitsExp; - ULONG Units; - - LONG LogicalMin, LogicalMax; - LONG PhysicalMin, PhysicalMax; - - union { - struct { - USAGE UsageMin, UsageMax; - USHORT StringMin, StringMax; - USHORT DesignatorMin, DesignatorMax; - USHORT DataIndexMin, DataIndexMax; - } Range; - - struct { - USAGE Usage, Reserved1; - USHORT StringIndex, Reserved2; - USHORT DesignatorIndex, Reserved3; - USHORT DataIndex, Reserved4; - } NotRange; - }; -} HIDP_VALUE_CAPS, *PHIDP_VALUE_CAPS; - -// -// Notes: -// -// ReportCount: When a report descriptor declares an Input, Output, or -// Feature main item with fewer usage declarations than the report count, then -// the last usage applies to all remaining unspecified count in that main item. -// (As an example you might have data that required many fields to describe, -// possibly buffered bytes.) In this case, only one value cap structure is -// allocated for these associtated fields, all with the same usage, and Report -// Count reflects the number of fields involved. Normally ReportCount is 1. -// To access all of the fields in such a value structure would require using -// HidP_GetUsageValueArray and HidP_SetUsageValueArray. HidP_GetUsageValue/ -// HidP_SetScaledUsageValue will also work, however, these functions will only -// work with the first field of the structure. -// - -// -// The link collection tree consists of an array of LINK_COLLECTION_NODES -// where the index into this array is the same as the collection number. -// -// Given a collection A which contains a subcollection B, A is defined to be -// the parent B, and B is defined to be the child. -// -// Given collections A, B, and C where B and C are children of A, and B was -// encountered before C in the report descriptor, B is defined as a sibling of -// C. (This implies, of course, that if B is a sibling of C, then C is NOT a -// sibling of B). -// -// B is defined as the NextSibling of C if and only if there exists NO -// child collection of A, call it D, such that B is a sibling of D and D -// is a sibling of C. -// -// E is defined to be the FirstChild of A if and only if for all children of A, -// F, that are not equivalent to E, F is a sibling of E. -// (This implies, of course, that the does not exist a child of A, call it G, -// where E is a sibling of G). In other words the first sibling is the last -// link collection found in the list. -// -// In other words, if a collection B is defined within the definition of another -// collection A, B becomes a child of A. All collections with the same parent -// are considered siblings. The FirstChild of the parent collection, A, will be -// last collection defined that has A as a parent. The order of sibling pointers -// is similarly determined. When a collection B is defined, it becomes the -// FirstChild of it's parent collection. The previously defined FirstChild of the -// parent collection becomes the NextSibling of the new collection. As new -// collections with the same parent are discovered, the chain of sibling is built. -// -// With that in mind, the following describes conclusively a data structure -// that provides direct traversal up, down, and accross the link collection -// tree. -// -// -typedef struct _HIDP_LINK_COLLECTION_NODE -{ - USAGE LinkUsage; - USAGE LinkUsagePage; - USHORT Parent; - USHORT NumberOfChildren; - USHORT NextSibling; - USHORT FirstChild; - ULONG CollectionType: 8; // As defined in 6.2.2.6 of HID spec - ULONG IsAlias : 1; // This link node is an allias of the next link node. - ULONG Reserved: 23; - PVOID UserContext; // The user can hang his coat here. -} HIDP_LINK_COLLECTION_NODE, *PHIDP_LINK_COLLECTION_NODE; - -// -// When a link collection is described by a delimiter, alias link collection -// nodes are created. (One for each usage within the delimiter). -// The parser assigns each capability description listed above only one -// link collection. -// -// If a control is defined within a collection defined by -// delimited usages, then that control is said to be within multiple link -// collections, one for each usage within the open and close delimiter tokens. -// Such multiple link collecions are said to be aliases. The first N-1 such -// collections, listed in the link collection node array, have their IsAlias -// bit set. The last such link collection is the link collection index used -// in the capabilities described above. -// Clients wishing to set a control in an aliased collection, should walk the -// collection array once for each time they see the IsAlias flag set, and use -// the last link collection as the index for the below accessor functions. -// -// NB: if IsAlias is set, then NextSibling should be one more than the current -// link collection node index. -// - -typedef PUCHAR PHIDP_REPORT_DESCRIPTOR; -typedef struct _HIDP_PREPARSED_DATA * PHIDP_PREPARSED_DATA; - -typedef struct _HIDP_CAPS -{ - USAGE Usage; - USAGE UsagePage; - USHORT InputReportByteLength; - USHORT OutputReportByteLength; - USHORT FeatureReportByteLength; - USHORT Reserved[17]; - - USHORT NumberLinkCollectionNodes; - - USHORT NumberInputButtonCaps; - USHORT NumberInputValueCaps; - USHORT NumberInputDataIndices; - - USHORT NumberOutputButtonCaps; - USHORT NumberOutputValueCaps; - USHORT NumberOutputDataIndices; - - USHORT NumberFeatureButtonCaps; - USHORT NumberFeatureValueCaps; - USHORT NumberFeatureDataIndices; -} HIDP_CAPS, *PHIDP_CAPS; - -typedef struct _HIDP_DATA -{ - USHORT DataIndex; - USHORT Reserved; - union { - ULONG RawValue; // for values - BOOLEAN On; // for buttons MUST BE TRUE for buttons. - }; -} HIDP_DATA, *PHIDP_DATA; -// -// The HIDP_DATA structure is used with HidP_GetData and HidP_SetData -// functions. -// -// The parser contiguously assigns every control (button or value) in a hid -// device a unique data index from zero to NumberXXXDataIndices -1 , inclusive. -// This value is found in the HIDP_BUTTON_CAPS and HIDP_VALUE_CAPS structures. -// -// Most clients will find the Get/Set Buttons / Value accessor functions -// sufficient to their needs, as they will allow the clients to access the -// data known to them while ignoring the other controls. -// -// More complex clients, which actually read the Button / Value Caps, and which -// do a value add service to these routines (EG Direct Input), will need to -// access all the data in the device without interest in the individual usage -// or link collection location. These are the clients that will find -// HidP_Data useful. -// - -typedef struct _HIDP_UNKNOWN_TOKEN -{ - UCHAR Token; - UCHAR Reserved[3]; - ULONG BitField; -} HIDP_UNKNOWN_TOKEN, *PHIDP_UNKNOWN_TOKEN; - -typedef struct _HIDP_EXTENDED_ATTRIBUTES -{ - UCHAR NumGlobalUnknowns; - UCHAR Reserved [3]; - PHIDP_UNKNOWN_TOKEN GlobalUnknowns; - // ... Additional attributes - ULONG Data [1]; // variableLength DO NOT ACCESS THIS FIELD -} HIDP_EXTENDED_ATTRIBUTES, *PHIDP_EXTENDED_ATTRIBUTES; - -NTSTATUS __stdcall -HidP_GetCaps ( - PHIDP_PREPARSED_DATA PreparsedData, - PHIDP_CAPS Capabilities - ); -/*++ -Routine Description: - Returns a list of capabilities of a given hid device as described by its - preparsed data. - -Arguments: - PreparsedData The preparsed data returned from HIDCLASS. - Capabilities a HIDP_CAPS structure - -Return Value: - HIDP_STATUS_SUCCESS - HIDP_STATUS_INVALID_PREPARSED_DATA ---*/ - -NTSTATUS __stdcall -HidP_GetLinkCollectionNodes ( - PHIDP_LINK_COLLECTION_NODE LinkCollectionNodes, - PULONG LinkCollectionNodesLength, - PHIDP_PREPARSED_DATA PreparsedData - ); -/*++ -Routine Description: - Return a list of PHIDP_LINK_COLLECTION_NODEs used to describe the link - collection tree of this hid device. See the above description of - struct _HIDP_LINK_COLLECTION_NODE. - -Arguments: - LinkCollectionNodes - a caller allocated array into which - HidP_GetLinkCollectionNodes will store the information - - LinKCollectionNodesLength - the caller sets this value to the length of the - the array in terms of number of elements. - HidP_GetLinkCollectionNodes sets this value to the actual - number of elements set. The total number of nodes required to - describe this HID device can be found in the - NumberLinkCollectionNodes field in the HIDP_CAPS structure. - ---*/ - -NTSTATUS __stdcall -HidP_GetSpecificButtonCaps ( - HIDP_REPORT_TYPE ReportType, - USAGE UsagePage, // Optional (0 => ignore) - USHORT LinkCollection, // Optional (0 => ignore) - USAGE Usage, // Optional (0 => ignore) - PHIDP_BUTTON_CAPS ButtonCaps, - PUSHORT ButtonCapsLength, - PHIDP_PREPARSED_DATA PreparsedData - ); -/*++ -Description: - HidP_GetButtonCaps returns all the buttons (binary values) that are a part - of the given report type for the Hid device represented by the given - preparsed data. - -Parameters: - ReportType One of HidP_Input, HidP_Output, or HidP_Feature. - - UsagePage A usage page value used to limit the button caps returned to - those on a given usage page. If set to 0, this parameter is - ignored. Can be used with LinkCollection and Usage parameters - to further limit the number of button caps structures returned. - - LinkCollection HIDP_LINK_COLLECTION node array index used to limit the - button caps returned to those buttons in a given link - collection. If set to 0, this parameter is - ignored. Can be used with UsagePage and Usage parameters - to further limit the number of button caps structures - returned. - - Usage A usage value used to limit the button caps returned to those - with the specified usage value. If set to 0, this parameter - is ignored. Can be used with LinkCollection and UsagePage - parameters to further limit the number of button caps - structures returned. - - ButtonCaps A _HIDP_BUTTON_CAPS array containing information about all the - binary values in the given report. This buffer is provided by - the caller. - - ButtonLength As input, this parameter specifies the length of the - ButtonCaps parameter (array) in number of array elements. - As output, this value is set to indicate how many of those - array elements were filled in by the function. The maximum number of - button caps that can be returned is found in the HIDP_CAPS - structure. If HIDP_STATUS_BUFFER_TOO_SMALL is returned, - this value contains the number of array elements needed to - successfully complete the request. - - PreparsedData The preparsed data returned from HIDCLASS. - - -Return Value -HidP_GetSpecificButtonCaps returns the following error codes: - HIDP_STATUS_SUCCESS. - HIDP_STATUS_INVALID_REPORT_TYPE - HIDP_STATUS_INVALID_PREPARSED_DATA - HIDP_STATUS_BUFFER_TOO_SMALL (all given entries however have been filled in) - HIDP_STATUS_USAGE_NOT_FOUND ---*/ -NTSTATUS __stdcall -HidP_GetButtonCaps ( - HIDP_REPORT_TYPE ReportType, - PHIDP_BUTTON_CAPS ButtonCaps, - PUSHORT ButtonCapsLength, - PHIDP_PREPARSED_DATA PreparsedData -); - -NTSTATUS __stdcall -HidP_GetSpecificValueCaps ( - HIDP_REPORT_TYPE ReportType, - USAGE UsagePage, // Optional (0 => ignore) - USHORT LinkCollection, // Optional (0 => ignore) - USAGE Usage, // Optional (0 => ignore) - PHIDP_VALUE_CAPS ValueCaps, - PUSHORT ValueCapsLength, - PHIDP_PREPARSED_DATA PreparsedData - ); -/*++ -Description: - HidP_GetValueCaps returns all the values (non-binary) that are a part - of the given report type for the Hid device represented by the given - preparsed data. - -Parameters: - ReportType One of HidP_Input, HidP_Output, or HidP_Feature. - - UsagePage A usage page value used to limit the value caps returned to - those on a given usage page. If set to 0, this parameter is - ignored. Can be used with LinkCollection and Usage parameters - to further limit the number of value caps structures returned. - - LinkCollection HIDP_LINK_COLLECTION node array index used to limit the - value caps returned to those buttons in a given link - collection. If set to 0, this parameter is - ignored. Can be used with UsagePage and Usage parameters - to further limit the number of value caps structures - returned. - - Usage A usage value used to limit the value caps returned to those - with the specified usage value. If set to 0, this parameter - is ignored. Can be used with LinkCollection and UsagePage - parameters to further limit the number of value caps - structures returned. - - ValueCaps A _HIDP_VALUE_CAPS array containing information about all the - non-binary values in the given report. This buffer is provided - by the caller. - - ValueLength As input, this parameter specifies the length of the ValueCaps - parameter (array) in number of array elements. As output, - this value is set to indicate how many of those array elements - were filled in by the function. The maximum number of - value caps that can be returned is found in the HIDP_CAPS - structure. If HIDP_STATUS_BUFFER_TOO_SMALL is returned, - this value contains the number of array elements needed to - successfully complete the request. - - PreparsedData The preparsed data returned from HIDCLASS. - - -Return Value -HidP_GetValueCaps returns the following error codes: - HIDP_STATUS_SUCCESS. - HIDP_STATUS_INVALID_REPORT_TYPE - HIDP_STATUS_INVALID_PREPARSED_DATA - HIDP_STATUS_BUFFER_TOO_SMALL (all given entries however have been filled in) - HIDP_STATUS_USAGE_NOT_FOUND - ---*/ - -NTSTATUS __stdcall -HidP_GetValueCaps ( - HIDP_REPORT_TYPE ReportType, - PHIDP_VALUE_CAPS ValueCaps, - PUSHORT ValueCapsLength, - PHIDP_PREPARSED_DATA PreparsedData -); - -NTSTATUS __stdcall -HidP_GetExtendedAttributes ( - HIDP_REPORT_TYPE ReportType, - USHORT DataIndex, - PHIDP_PREPARSED_DATA PreparsedData, - PHIDP_EXTENDED_ATTRIBUTES Attributes, - PULONG LengthAttributes - ); -/*++ -Description: - Given a data index from the value or button capabilities of a given control - return any extended attributes for the control if any exist. - -Parameters: - ReportType One of HidP_Input, HidP_Output, or HidP_Feature. - - DataIndex The data index for the given control, found in the capabilities - structure for that control - - PreparsedData The preparsed data returned from HIDCLASS. - - Attributes Pointer to a buffer into which the extended attribute data will - be copied. - - LengthAttributes Length of the given buffer in bytes. - -Return Value - HIDP_STATUS_SUCCESS - HIDP_STATUS_DATA_INDEX_NOT_FOUND ---*/ - -NTSTATUS __stdcall -HidP_InitializeReportForID ( - HIDP_REPORT_TYPE ReportType, - UCHAR ReportID, - PHIDP_PREPARSED_DATA PreparsedData, - PCHAR Report, - ULONG ReportLength - ); -/*++ - -Routine Description: - - Initialize a report based on the given report ID. - -Parameters: - - ReportType One of HidP_Input, HidP_Output, or HidP_Feature. - - PreparasedData Preparsed data structure returned by HIDCLASS - - Report Buffer which to set the data into. - - ReportLength Length of Report...Report should be at least as long as the - value indicated in the HIDP_CAPS structure for the device and - the corresponding ReportType - -Return Value - - HIDP_STATUS_INVALID_REPORT_TYPE -- if ReportType is not valid. - HIDP_STATUS_INVALID_PREPARSED_DATA -- if PreparsedData is not valid - HIDP_STATUS_INVALID_REPORT_LENGTH -- the length of the report packet is not equal - to the length specified in HIDP_CAPS - structure for the given ReportType - HIDP_STATUS_REPORT_DOES_NOT_EXIST -- if there are no reports on this device - for the given ReportType - ---*/ - -NTSTATUS __stdcall -HidP_SetData ( - HIDP_REPORT_TYPE ReportType, - PHIDP_DATA DataList, - PULONG DataLength, - PHIDP_PREPARSED_DATA PreparsedData, - PCHAR Report, - ULONG ReportLength - ); -/*++ - -Routine Description: - - Please Note: Since usage value arrays deal with multiple fields for - for one usage value, they cannot be used with HidP_SetData - and HidP_GetData. In this case, - HIDP_STATUS_IS_USAGE_VALUE_ARRAY will be returned. - -Parameters: - - ReportType One of HidP_Input, HidP_Output, or HidP_Feature. - - DataList Array of HIDP_DATA structures that contains the data values - that are to be set into the given report - - DataLength As input, length in array elements of DataList. As output, - contains the number of data elements set on successful - completion or an index into the DataList array to identify - the faulting HIDP_DATA value if an error code is returned. - - PreparasedData Preparsed data structure returned by HIDCLASS - - Report Buffer which to set the data into. - - ReportLength Length of Report...Report should be at least as long as the - value indicated in the HIDP_CAPS structure for the device and - the corresponding ReportType - -Return Value - HidP_SetData returns the following error codes. The report packet will - have all the data set up until the HIDP_DATA structure that caused the - error. DataLength, in the error case, will return this problem index. - - HIDP_STATUS_SUCCESS -- upon successful insertion of all data - into the report packet. - HIDP_STATUS_INVALID_REPORT_TYPE -- if ReportType is not valid. - HIDP_STATUS_INVALID_PREPARSED_DATA -- if PreparsedData is not valid - HIDP_STATUS_DATA_INDEX_NOT_FOUND -- if a HIDP_DATA structure referenced a - data index that does not exist for this - device's ReportType - HIDP_STATUS_INVALID_REPORT_LENGTH -- the length of the report packet is not equal - to the length specified in HIDP_CAPS - structure for the given ReportType - HIDP_STATUS_REPORT_DOES_NOT_EXIST -- if there are no reports on this device - for the given ReportType - HIDP_STATUS_IS_USAGE_VALUE_ARRAY -- if one of the HIDP_DATA structures - references a usage value array. - DataLength will contain the index into - the array that was invalid - HIDP_STATUS_BUTTON_NOT_PRESSED -- if a HIDP_DATA structure attempted - to unset a button that was not already - set in the Report - HIDP_STATUS_INCOMPATIBLE_REPORT_ID -- a HIDP_DATA structure was found with - a valid index value but is contained - in a different report than the one - currently being processed - HIDP_STATUS_BUFFER_TOO_SMALL -- if there are not enough entries in - a given Main Array Item to report all - buttons that have been requested to be - set ---*/ - -NTSTATUS __stdcall -HidP_GetData ( - HIDP_REPORT_TYPE ReportType, - PHIDP_DATA DataList, - PULONG DataLength, - PHIDP_PREPARSED_DATA PreparsedData, - PCHAR Report, - ULONG ReportLength - ); -/*++ - -Routine Description: - - Please Note: For obvious reasons HidP_SetData and HidP_GetData will not - access UsageValueArrays. - -Parameters: - ReportType One of HidP_Input, HidP_Output, or HidP_Feature. - - DataList Array of HIDP_DATA structures that will receive the data - values that are set in the given report - - DataLength As input, length in array elements of DataList. As output, - contains the number of data elements that were successfully - set by HidP_GetData. The maximum size necessary for DataList - can be determined by calling HidP_MaxDataListLength - - PreparasedData Preparsed data structure returned by HIDCLASS - - Report Buffer which to set the data into. - - ReportLength Length of Report...Report should be at least as long as the - value indicated in the HIDP_CAPS structure for the device and - the corresponding ReportType - -Return Value - HidP_GetData returns the following error codes. - - HIDP_STATUS_SUCCESS -- upon successful retrieval of all data - from the report packet. - HIDP_STATUS_INVALID_REPORT_TYPE -- if ReportType is not valid. - HIDP_STATUS_INVALID_PREPARSED_DATA -- if PreparsedData is not valid - HIDP_STATUS_INVALID_REPORT_LENGTH -- the length of the report packet is not equal - to the length specified in HIDP_CAPS - structure for the given ReportType - HIDP_STATUS_REPORT_DOES_NOT_EXIST -- if there are no reports on this device - for the given ReportType - HIDP_STATUS_BUFFER_TOO_SMALL -- if there are not enough array entries in - DataList to store all the indice values - in the given report. DataLength will - contain the number of array entries - required to hold all data ---*/ - - -ULONG __stdcall -HidP_MaxDataListLength ( - HIDP_REPORT_TYPE ReportType, - PHIDP_PREPARSED_DATA PreparsedData - ); -/*++ -Routine Description: - - This function returns the maximum length of HIDP_DATA elements that - HidP_GetData could return for the given report type. - -Parameters: - - ReportType One of HidP_Input, HidP_Output or HidP_Feature. - - PreparsedData Preparsed data structure returned by HIDCLASS - -Return Value: - - The length of the data list array required for the HidP_GetData function - call. If an error occurs (either HIDP_STATUS_INVALID_REPORT_TYPE or - HIDP_STATUS_INVALID_PREPARSED_DATA), this function returns 0. - ---*/ - -#define HidP_SetButtons(Rty, Up, Lco, ULi, ULe, Ppd, Rep, Rle) \ - HidP_SetUsages(Rty, Up, Lco, ULi, ULe, Ppd, Rep, Rle) - - -NTSTATUS __stdcall -HidP_SetUsages ( - HIDP_REPORT_TYPE ReportType, - USAGE UsagePage, - USHORT LinkCollection, - PUSAGE UsageList, - PULONG UsageLength, - PHIDP_PREPARSED_DATA PreparsedData, - PCHAR Report, - ULONG ReportLength - ); -/*++ - -Routine Description: - This function sets binary values (buttons) in a report. Given an - initialized packet of correct length, it modifies the report packet so that - each element in the given list of usages has been set in the report packet. - For example, in an output report with 5 LED's, each with a given usage, - an application could turn on any subset of these lights by placing their - usages in any order into the usage array (UsageList). HidP_SetUsages would, - in turn, set the appropriate bit or add the corresponding byte into the - HID Main Array Item. - - A properly initialized Report packet is one of the correct byte length, - and all zeros. - - NOTE: A packet that has already been set with a call to a HidP_Set routine - can also be passed in. This routine then sets processes the UsageList - in the same fashion but verifies that the ReportID already set in - Report matches the report ID for the given usages. - -Parameters: - ReportType One of HidP_Input, HidP_Output or HidP_Feature. - - UsagePage All of the usages in the usage array, which HidP_SetUsages will - set in the report, refer to this same usage page. - If a client wishes to set usages in a report for multiple - usage pages then that client needs to make multiple calls to - HidP_SetUsages for each of the usage pages. - - UsageList A usage array containing the usages that HidP_SetUsages will set in - the report packet. - - UsageLength The length of the given usage array in array elements. - The parser will set this value to the position in the usage - array where it stopped processing. If successful, UsageLength - will be unchanged. In any error condition, this parameter - reflects how many of the usages in the usage list have - actually been set by the parser. This is useful for finding - the usage in the list which caused the error. - - PreparsedData The preparsed data recevied from HIDCLASS - - Report The report packet. - - ReportLength Length of the given report packet...Must be equal to the - value reported in the HIDP_CAPS structure for the device - and corresponding report type. - -Return Value - HidP_SetUsages returns the following error codes. On error, the report packet - will be correct up until the usage element that caused the error. - - HIDP_STATUS_SUCCESS -- upon successful insertion of all usages - into the report packet. - HIDP_STATUS_INVALID_REPORT_TYPE -- if ReportType is not valid. - HIDP_STATUS_INVALID_PREPARSED_DATA -- if PreparsedData is not valid - HIDP_STATUS_INVALID_REPORT_LENGTH -- the length of the report packet is not - equal to the length specified in - the HIDP_CAPS structure for the given - ReportType - HIDP_STATUS_REPORT_DOES_NOT_EXIST -- if there are no reports on this device - for the given ReportType - HIDP_STATUS_INCOMPATIBLE_REPORT_ID -- if a usage was found that exists in a - different report. If the report is - zero-initialized on entry the first - usage in the list will determine which - report ID is used. Otherwise, the - parser will verify that usage matches - the passed in report's ID - HIDP_STATUS_USAGE_NOT_FOUND -- if the usage does not exist for any - report (no matter what the report ID) - for the given report type. - HIDP_STATUS_BUFFER_TOO_SMALL -- if there are not enough entries in a - given Main Array Item to list all of - the given usages. The caller needs - to split his request into more than - one call ---*/ - -#define HidP_UnsetButtons(Rty, Up, Lco, ULi, ULe, Ppd, Rep, Rle) \ - HidP_UnsetUsages(Rty, Up, Lco, ULi, ULe, Ppd, Rep, Rle) - - -NTSTATUS __stdcall -HidP_UnsetUsages ( - HIDP_REPORT_TYPE ReportType, - USAGE UsagePage, - USHORT LinkCollection, - PUSAGE UsageList, - PULONG UsageLength, - PHIDP_PREPARSED_DATA PreparsedData, - PCHAR Report, - ULONG ReportLength - ); -/*++ - -Routine Description: - This function unsets (turns off) binary values (buttons) in the report. Given - an initialized packet of correct length, it modifies the report packet so - that each element in the given list of usages has been unset in the - report packet. - - This function is the "undo" operation for SetUsages. If the given usage - is not already set in the Report, it will return an error code of - HIDP_STATUS_BUTTON_NOT_PRESSED. If the button is pressed, HidP_UnsetUsages - will unset the appropriate bit or remove the corresponding index value from - the HID Main Array Item. - - A properly initialized Report packet is one of the correct byte length, - and all zeros.. - - NOTE: A packet that has already been set with a call to a HidP_Set routine - can also be passed in. This routine then processes the UsageList - in the same fashion but verifies that the ReportID already set in - Report matches the report ID for the given usages. - -Parameters: - ReportType One of HidP_Input, HidP_Output or HidP_Feature. - - UsagePage All of the usages in the usage array, which HidP_UnsetUsages will - unset in the report, refer to this same usage page. - If a client wishes to unset usages in a report for multiple - usage pages then that client needs to make multiple calls to - HidP_UnsetUsages for each of the usage pages. - - UsageList A usage array containing the usages that HidP_UnsetUsages will - unset in the report packet. - - UsageLength The length of the given usage array in array elements. - The parser will set this value to the position in the usage - array where it stopped processing. If successful, UsageLength - will be unchanged. In any error condition, this parameter - reflects how many of the usages in the usage list have - actually been unset by the parser. This is useful for finding - the usage in the list which caused the error. - - PreparsedData The preparsed data recevied from HIDCLASS - - Report The report packet. - - ReportLength Length of the given report packet...Must be equal to the - value reported in the HIDP_CAPS structure for the device - and corresponding report type. - -Return Value - HidP_UnsetUsages returns the following error codes. On error, the report - packet will be correct up until the usage element that caused the error. - - HIDP_STATUS_SUCCESS -- upon successful "unsetting" of all usages - in the report packet. - HIDP_STATUS_INVALID_REPORT_TYPE -- if ReportType is not valid. - HIDP_STATUS_INVALID_PREPARSED_DATA -- if PreparsedData is not valid - HIDP_STATUS_INVALID_REPORT_LENGTH -- the length of the report packet is not - equal to the length specified in - the HIDP_CAPS structure for the given - ReportType - HIDP_STATUS_REPORT_DOES_NOT_EXIST -- if there are no reports on this device - for the given ReportType - HIDP_STATUS_INCOMPATIBLE_REPORT_ID -- if a usage was found that exists in a - different report. If the report is - zero-initialized on entry the first - usage in the list will determine which - report ID is used. Otherwise, the - parser will verify that usage matches - the passed in report's ID - HIDP_STATUS_USAGE_NOT_FOUND -- if the usage does not exist for any - report (no matter what the report ID) - for the given report type. - HIDP_STATUS_BUTTON_NOT_PRESSED -- if a usage corresponds to a button that - is not already set in the given report ---*/ - -#define HidP_GetButtons(Rty, UPa, LCo, ULi, ULe, Ppd, Rep, RLe) \ - HidP_GetUsages(Rty, UPa, LCo, ULi, ULe, Ppd, Rep, RLe) - - -NTSTATUS __stdcall -HidP_GetUsages ( - HIDP_REPORT_TYPE ReportType, - USAGE UsagePage, - USHORT LinkCollection, - PUSAGE UsageList, - PULONG UsageLength, - PHIDP_PREPARSED_DATA PreparsedData, - PCHAR Report, - ULONG ReportLength - ); -/*++ - -Routine Description: - This function returns the binary values (buttons) that are set in a HID - report. Given a report packet of correct length, it searches the report - packet for each usage for the given usage page and returns them in the - usage list. - -Parameters: - ReportType One of HidP_Input, HidP_Output or HidP_Feature. - - UsagePage All of the usages in the usage list, which HidP_GetUsages will - retrieve in the report, refer to this same usage page. - If the client wishes to get usages in a packet for multiple - usage pages then that client needs to make multiple calls - to HidP_GetUsages. - - LinkCollection An optional value which can limit which usages are returned - in the UsageList to those usages that exist in a specific - LinkCollection. A non-zero value indicates the index into - the HIDP_LINK_COLLECITON_NODE list returned by - HidP_GetLinkCollectionNodes of the link collection the - usage should belong to. A value of 0 indicates this - should value be ignored. - - UsageList The usage array that will contain all the usages found in - the report packet. - - UsageLength The length of the given usage array in array elements. - On input, this value describes the length of the usage list. - On output, HidP_GetUsages sets this value to the number of - usages that was found. Use HidP_MaxUsageListLength to - determine the maximum length needed to return all the usages - that a given report packet may contain. - - PreparsedData Preparsed data structure returned by HIDCLASS - - Report The report packet. - - ReportLength Length (in bytes) of the given report packet - - -Return Value - HidP_GetUsages returns the following error codes: - - HIDP_STATUS_SUCCESS -- upon successfully retrieving all the - usages from the report packet - HIDP_STATUS_INVALID_REPORT_TYPE -- if ReportType is not valid. - HIDP_STATUS_INVALID_PREPARSED_DATA -- if PreparsedData is not valid - HIDP_STATUS_INVALID_REPORT_LENGTH -- the length of the report packet is not - equal to the length specified in - the HIDP_CAPS structure for the given - ReportType - HIDP_STATUS_REPORT_DOES_NOT_EXIST -- if there are no reports on this device - for the given ReportType - HIDP_STATUS_BUFFER_TOO_SMALL -- if the UsageList is not big enough to - hold all the usages found in the report - packet. If this is returned, the buffer - will contain UsageLength number of - usages. Use HidP_MaxUsageListLength to - find the maximum length needed - HIDP_STATUS_INCOMPATIBLE_REPORT_ID -- if no usages were found but usages - that match the UsagePage and - LinkCollection specified could be found - in a report with a different report ID - HIDP_STATUS_USAGE_NOT_FOUND -- if there are no usages in a reports for - the device and ReportType that match the - UsagePage and LinkCollection that were - specified ---*/ - -#define HidP_GetButtonsEx(Rty, LCo, BLi, ULe, Ppd, Rep, RLe) \ - HidP_GetUsagesEx(Rty, LCo, BLi, ULe, Ppd, Rep, RLe) - -NTSTATUS __stdcall -HidP_GetUsagesEx ( - HIDP_REPORT_TYPE ReportType, - USHORT LinkCollection, // Optional - PUSAGE_AND_PAGE ButtonList, - ULONG * UsageLength, - PHIDP_PREPARSED_DATA PreparsedData, - reads_bytes_(ReportLength) PCHAR Report, - ULONG ReportLength - ); - -/*++ - -Routine Description: - This function returns the binary values (buttons) in a HID report. - Given a report packet of correct length, it searches the report packet - for all buttons and returns the UsagePage and Usage for each of the buttons - it finds. - -Parameters: - ReportType One of HidP_Input, HidP_Output or HidP_Feature. - - LinkCollection An optional value which can limit which usages are returned - in the ButtonList to those usages that exist in a specific - LinkCollection. A non-zero value indicates the index into - the HIDP_LINK_COLLECITON_NODE list returned by - HidP_GetLinkCollectionNodes of the link collection the - usage should belong to. A value of 0 indicates this - should value be ignored. - - ButtonList An array of USAGE_AND_PAGE structures describing all the - buttons currently ``down'' in the device. - - UsageLength The length of the given array in terms of elements. - On input, this value describes the length of the list. On - output, HidP_GetUsagesEx sets this value to the number of - usages that were found. Use HidP_MaxUsageListLength to - determine the maximum length needed to return all the usages - that a given report packet may contain. - - PreparsedData Preparsed data returned by HIDCLASS - - Report The report packet. - - ReportLength Length (in bytes) of the given report packet. - - -Return Value - HidP_GetUsagesEx returns the following error codes: - - HIDP_STATUS_SUCCESS -- upon successfully retrieving all the - usages from the report packet - HIDP_STATUS_INVALID_REPORT_TYPE -- if ReportType is not valid. - HIDP_STATUS_INVALID_PREPARSED_DATA -- if PreparsedData is not valid - HIDP_STATUS_INVALID_REPORT_LENGTH -- the length of the report packet is not - equal to the length specified in - the HIDP_CAPS structure for the given - ReportType - HIDP_STATUS_REPORT_DOES_NOT_EXIST -- if there are no reports on this device - for the given ReportType - HIDP_STATUS_BUFFER_TOO_SMALL -- if ButtonList is not big enough to - hold all the usages found in the report - packet. If this is returned, the buffer - will contain UsageLength number of - usages. Use HidP_MaxUsageListLength to - find the maximum length needed - HIDP_STATUS_INCOMPATIBLE_REPORT_ID -- if no usages were found but usages - that match the specified LinkCollection - exist in report with a different report - ID. - HIDP_STATUS_USAGE_NOT_FOUND -- if there are no usages in any reports that - match the LinkCollection parameter ---*/ - -_IRQL_requires_max_(PASSIVE_LEVEL) -ULONG __stdcall -HidP_MaxUsageListLength ( - HIDP_REPORT_TYPE ReportType, - USAGE UsagePage, // Optional - PHIDP_PREPARSED_DATA PreparsedData - ); -/*++ -Routine Description: - This function returns the maximum number of usages that a call to - HidP_GetUsages or HidP_GetUsagesEx could return for a given HID report. - If calling for number of usages returned by HidP_GetUsagesEx, use 0 as - the UsagePage value. - -Parameters: - ReportType One of HidP_Input, HidP_Output or HidP_Feature. - - UsagePage Specifies the optional UsagePage to query for. If 0, will - return all the maximum number of usage values that could be - returned for a given ReportType. If non-zero, will return - the maximum number of usages that would be returned for the - ReportType with the given UsagePage. - - PreparsedData Preparsed data returned from HIDCLASS - -Return Value: - The length of the usage list array required for the HidP_GetUsages or - HidP_GetUsagesEx function call. If an error occurs (such as - HIDP_STATUS_INVALID_REPORT_TYPE or HIDP_INVALID_PREPARSED_DATA, this - returns 0. ---*/ - - -NTSTATUS __stdcall -HidP_SetUsageValue ( - HIDP_REPORT_TYPE ReportType, - USAGE UsagePage, - USHORT LinkCollection, - USAGE Usage, - ULONG UsageValue, - PHIDP_PREPARSED_DATA PreparsedData, - updates_bytes_(ReportLength) PCHAR Report, - ULONG ReportLength - ); -/*++ -Description: - HidP_SetUsageValue inserts a value into the HID Report Packet in the field - corresponding to the given usage page and usage. HidP_SetUsageValue - casts this value to the appropriate bit length. If a report packet - contains two different fields with the same Usage and UsagePage, - they can be distinguished with the optional LinkCollection field value. - Using this function sets the raw value into the report packet with - no checking done as to whether it actually falls within the logical - minimum/logical maximum range. Use HidP_SetScaledUsageValue for this... - - NOTE: Although the UsageValue parameter is a ULONG, any casting that is - done will preserve or sign-extend the value. The value being set - should be considered a LONG value and will be treated as such by - this function. - -Parameters: - - ReportType One of HidP_Output or HidP_Feature. - - UsagePage The usage page to which the given usage refers. - - LinkCollection (Optional) This value can be used to differentiate - between two fields that may have the same - UsagePage and Usage but exist in different - collections. If the link collection value - is zero, this function will set the first field - it finds that matches the usage page and - usage. - - Usage The usage whose value HidP_SetUsageValue will set. - - UsageValue The raw value to set in the report buffer. This value must be within - the logical range or if a NULL value this value should be the - most negative value that can be represented by the number of bits - for this field. - - PreparsedData The preparsed data returned for HIDCLASS - - Report The report packet. - - ReportLength Length (in bytes) of the given report packet. - - -Return Value: - HidP_SetUsageValue returns the following error codes: - - HIDP_STATUS_SUCCESS -- upon successfully setting the value - in the report packet - HIDP_STATUS_INVALID_REPORT_TYPE -- if ReportType is not valid. - HIDP_STATUS_INVALID_PREPARSED_DATA -- if PreparsedData is not valid - HIDP_STATUS_INVALID_REPORT_LENGTH -- the length of the report packet is not - equal to the length specified in - the HIDP_CAPS structure for the given - ReportType - HIDP_STATUS_REPORT_DOES_NOT_EXIST -- if there are no reports on this device - for the given ReportType - HIDP_STATUS_INCOMPATIBLE_REPORT_ID -- the specified usage page, usage and - link collection exist but exists in - a report with a different report ID - than the report being passed in. To - set this value, call HidP_SetUsageValue - again with a zero-initizialed report - packet - HIDP_STATUS_USAGE_NOT_FOUND -- if the usage page, usage, and link - collection combination does not exist - in any reports for this ReportType ---*/ - -NTSTATUS __stdcall -HidP_SetScaledUsageValue ( - HIDP_REPORT_TYPE ReportType, - USAGE UsagePage, - USHORT LinkCollection, - USAGE Usage, - LONG UsageValue, - PHIDP_PREPARSED_DATA PreparsedData, - updates_bytes_(ReportLength) PCHAR Report, - ULONG ReportLength - ); - -/*++ -Description: - HidP_SetScaledUsageValue inserts the UsageValue into the HID report packet - in the field corresponding to the given usage page and usage. If a report - packet contains two different fields with the same Usage and UsagePage, - they can be distinguished with the optional LinkCollection field value. - - If the specified field has a defined physical range, this function converts - the physical value specified to the corresponding logical value for the - report. If a physical value does not exist, the function will verify that - the value specified falls within the logical range and set according. - - If the range checking fails but the field has NULL values, the function will - set the field to the defined NULL value (most negative number possible) and - return HIDP_STATUS_NULL. In other words, use this function to set NULL - values for a given field by passing in a value that falls outside the - physical range if it is defined or the logical range otherwise. - - If the field does not support NULL values, an out of range error will be - returned instead. - -Parameters: - - ReportType One of HidP_Output or HidP_Feature. - - UsagePage The usage page to which the given usage refers. - - LinkCollection (Optional) This value can be used to differentiate - between two fields that may have the same - UsagePage and Usage but exist in different - collections. If the link collection value - is zero, this function will set the first field - it finds that matches the usage page and - usage. - - Usage The usage whose value HidP_SetScaledUsageValue will set. - - UsageValue The value to set in the report buffer. See the routine - description above for the different interpretations of this - value - - PreparsedData The preparsed data returned from HIDCLASS - - Report The report packet. - - ReportLength Length (in bytes) of the given report packet. - - -Return Value: - HidP_SetScaledUsageValue returns the following error codes: - - HIDP_STATUS_SUCCESS -- upon successfully setting the value - in the report packet - HIDP_STATUS_NULL -- upon successfully setting the value - in the report packet as a NULL value - HIDP_STATUS_INVALID_REPORT_TYPE -- if ReportType is not valid. - HIDP_STATUS_INVALID_PREPARSED_DATA -- if PreparsedData is not valid - HIDP_STATUS_INVALID_REPORT_LENGTH -- the length of the report packet is not - equal to the length specified in - the HIDP_CAPS structure for the given - ReportType - HIDP_STATUS_VALUEOF_RANGE -- if the value specified failed to fall - within the physical range if it exists - or within the logical range otherwise - and the field specified by the usage - does not allow NULL values - HIDP_STATUS_BAD_LOG_PHY_VALUES -- if the field has a physical range but - either the logical range is invalid - (max <= min) or the physical range is - invalid - HIDP_STATUS_INCOMPATIBLE_REPORT_ID -- the specified usage page, usage and - link collection exist but exists in - a report with a different report ID - than the report being passed in. To - set this value, call - HidP_SetScaledUsageValue again with - a zero-initialized report packet - HIDP_STATUS_USAGE_NOT_FOUND -- if the usage page, usage, and link - collection combination does not exist - in any reports for this ReportType ---*/ - -NTSTATUS __stdcall -HidP_SetUsageValueArray ( - HIDP_REPORT_TYPE ReportType, - USAGE UsagePage, - USHORT LinkCollection, - USAGE Usage, - reads_bytes_(UsageValueByteLength) PCHAR UsageValue, - USHORT UsageValueByteLength, - PHIDP_PREPARSED_DATA PreparsedData, - updates_bytes_(ReportLength) PCHAR Report, - ULONG ReportLength - ); - -/*++ -Routine Descripton: - A usage value array occurs when the last usage in the list of usages - describing a main item must be repeated because there are less usages defined - than there are report counts declared for the given main item. In this case - a single value cap is allocated for that usage and the report count of that - value cap is set to reflect the number of fields to which that usage refers. - - HidP_SetUsageValueArray sets the raw bits for that usage which spans - more than one field in a report. - - NOTE: This function currently does not support value arrays where the - ReportSize for each of the fields in the array is not a multiple - of 8 bits. - - The UsageValue buffer should have the values set as they would appear - in the report buffer. If this function supported non 8-bit multiples - for the ReportSize then caller should format the input buffer so that - each new value begins at the bit immediately following the last bit - of the previous value - -Parameters: - - ReportType One of HidP_Output or HidP_Feature. - - UsagePage The usage page to which the given usage refers. - - LinkCollection (Optional) This value can be used to differentiate - between two fields that may have the same - UsagePage and Usage but exist in different - collections. If the link collection value - is zero, this function will set the first field - it finds that matches the usage page and - usage. - - Usage The usage whose value array HidP_SetUsageValueArray will set. - - UsageValue The buffer with the values to set into the value array. - The number of BITS required is found by multiplying the - BitSize and ReportCount fields of the Value Cap for this - control. The least significant bit of this control found in the - given report will be placed in the least significan bit location - of the array given (little-endian format), regardless of whether - or not the field is byte alligned or if the BitSize is a multiple - of sizeof (CHAR). - - See the above note for current implementation limitations. - - UsageValueByteLength Length of the UsageValue buffer (in bytes) - - PreparsedData The preparsed data returned from HIDCLASS - - Report The report packet. - - ReportLength Length (in bytes) of the given report packet. - - -Return Value: - HIDP_STATUS_SUCCESS -- upon successfully setting the value - array in the report packet - HIDP_STATUS_INVALID_REPORT_TYPE -- if ReportType is not valid. - HIDP_STATUS_INVALID_PREPARSED_DATA -- if PreparsedData is not valid - HIDP_STATUS_INVALID_REPORT_LENGTH -- the length of the report packet is not - equal to the length specified in - the HIDP_CAPS structure for the given - ReportType - HIDP_STATUS_REPORT_DOES_NOT_EXIST -- if there are no reports on this device - for the given ReportType - HIDP_STATUS_NOT_VALUE_ARRAY -- if the control specified is not a - value array -- a value array will have - a ReportCount field in the - HIDP_VALUE_CAPS structure that is > 1 - Use HidP_SetUsageValue instead - HIDP_STATUS_BUFFER_TOO_SMALL -- if the size of the passed in buffer with - the values to set is too small (ie. has - fewer values than the number of fields in - the array - HIDP_STATUS_NOT_IMPLEMENTED -- if the usage value array has field sizes - that are not multiples of 8 bits, this - error code is returned since the function - currently does not handle setting into - such arrays. - HIDP_STATUS_INCOMPATIBLE_REPORT_ID -- the specified usage page, usage and - link collection exist but exists in - a report with a different report ID - than the report being passed in. To - set this value, call - HidP_SetUsageValueArray again with - a zero-initialized report packet - HIDP_STATUS_USAGE_NOT_FOUND -- if the usage page, usage, and link - collection combination does not exist - in any reports for this ReportType ---*/ - - -NTSTATUS __stdcall -HidP_GetUsageValue ( - HIDP_REPORT_TYPE ReportType, - USAGE UsagePage, - USHORT LinkCollection, - USAGE Usage, - PULONG UsageValue, - PHIDP_PREPARSED_DATA PreparsedData, - reads_bytes_(ReportLength) PCHAR Report, - ULONG ReportLength - ); - -/* -Description - HidP_GetUsageValue retrieves the value from the HID Report for the usage - specified by the combination of usage page, usage and link collection. - If a report packet contains two different fields with the same - Usage and UsagePage, they can be distinguished with the optional - LinkCollection field value. - -Parameters: - - ReportType One of HidP_Input or HidP_Feature. - - UsagePage The usage page to which the given usage refers. - - LinkCollection (Optional) This value can be used to differentiate - between two fields that may have the same - UsagePage and Usage but exist in different - collections. If the link collection value - is zero, this function will set the first field - it finds that matches the usage page and - usage. - - Usage The usage whose value HidP_GetUsageValue will retrieve - - UsageValue The raw value that is set for the specified field in the report - buffer. This value will either fall within the logical range - or if NULL values are allowed, a number outside the range to - indicate a NULL - - PreparsedData The preparsed data returned for HIDCLASS - - Report The report packet. - - ReportLength Length (in bytes) of the given report packet. - - -Return Value: - HidP_GetUsageValue returns the following error codes: - - HIDP_STATUS_SUCCESS -- upon successfully retrieving the value - from the report packet - HIDP_STATUS_INVALID_REPORT_TYPE -- if ReportType is not valid. - HIDP_STATUS_INVALID_PREPARSED_DATA -- if PreparsedData is not valid - HIDP_STATUS_INVALID_REPORT_LENGTH -- the length of the report packet is not - equal to the length specified in - the HIDP_CAPS structure for the given - ReportType - HIDP_STATUS_REPORT_DOES_NOT_EXIST -- if there are no reports on this device - for the given ReportType - HIDP_STATUS_INCOMPATIBLE_REPORT_ID -- the specified usage page, usage and - link collection exist but exists in - a report with a different report ID - than the report being passed in. To - set this value, call HidP_GetUsageValue - again with a different report packet - HIDP_STATUS_USAGE_NOT_FOUND -- if the usage page, usage, and link - collection combination does not exist - in any reports for this ReportType ---*/ - - -NTSTATUS __stdcall -HidP_GetScaledUsageValue ( - HIDP_REPORT_TYPE ReportType, - USAGE UsagePage, - USHORT LinkCollection, - USAGE Usage, - PLONG UsageValue, - PHIDP_PREPARSED_DATA PreparsedData, - reads_bytes_(ReportLength) PCHAR Report, - ULONG ReportLength - ); - -/*++ -Description - HidP_GetScaledUsageValue retrieves a UsageValue from the HID report packet - in the field corresponding to the given usage page and usage. If a report - packet contains two different fields with the same Usage and UsagePage, - they can be distinguished with the optional LinkCollection field value. - - If the specified field has a defined physical range, this function converts - the logical value that exists in the report packet to the corresponding - physical value. If a physical range does not exist, the function will - return the logical value. This function will check to verify that the - logical value in the report falls within the declared logical range. - - When doing the conversion between logical and physical values, this - function assumes a linear extrapolation between the physical max/min and - the logical max/min. (Where logical is the values reported by the device - and physical is the value returned by this function). If the data field - size is less than 32 bits, then HidP_GetScaledUsageValue will sign extend - the value to 32 bits. - - If the range checking fails but the field has NULL values, the function - will set UsageValue to 0 and return HIDP_STATUS_NULL. Otherwise, it - returns a HIDP_STATUSOF_RANGE error. - -Parameters: - - ReportType One of HidP_Output or HidP_Feature. - - UsagePage The usage page to which the given usage refers. - - LinkCollection (Optional) This value can be used to differentiate - between two fields that may have the same - UsagePage and Usage but exist in different - collections. If the link collection value - is zero, this function will retrieve the first - field it finds that matches the usage page - and usage. - - Usage The usage whose value HidP_GetScaledUsageValue will retrieve - - UsageValue The value retrieved from the report buffer. See the routine - description above for the different interpretations of this - value - - PreparsedData The preparsed data returned from HIDCLASS - - Report The report packet. - - ReportLength Length (in bytes) of the given report packet. - - -Return Value: - HidP_GetScaledUsageValue returns the following error codes: - - HIDP_STATUS_SUCCESS -- upon successfully retrieving the value - from the report packet - HIDP_STATUS_NULL -- if the report packet had a NULL value - set - HIDP_STATUS_INVALID_REPORT_TYPE -- if ReportType is not valid. - HIDP_STATUS_INVALID_PREPARSED_DATA -- if PreparsedData is not valid - HIDP_STATUS_INVALID_REPORT_LENGTH -- the length of the report packet is not - equal to the length specified in - the HIDP_CAPS structure for the given - ReportType - HIDP_STATUS_VALUEOF_RANGE -- if the value retrieved from the packet - falls outside the logical range and - the field does not support NULL values - HIDP_STATUS_BAD_LOG_PHY_VALUES -- if the field has a physical range but - either the logical range is invalid - (max <= min) or the physical range is - invalid - HIDP_STATUS_INCOMPATIBLE_REPORT_ID -- the specified usage page, usage and - link collection exist but exists in - a report with a different report ID - than the report being passed in. To - set this value, call - HidP_GetScaledUsageValue with a - different report packet - HIDP_STATUS_USAGE_NOT_FOUND -- if the usage page, usage, and link - collection combination does not exist - in any reports for this ReportType ---*/ - -NTSTATUS __stdcall -HidP_GetUsageValueArray ( - HIDP_REPORT_TYPE ReportType, - USAGE UsagePage, - USHORT LinkCollection, - USAGE Usage, - updates_bytes_(UsageValueByteLength) PCHAR UsageValue, - USHORT UsageValueByteLength, - PHIDP_PREPARSED_DATA PreparsedData, - reads_bytes_(ReportLength) PCHAR Report, - ULONG ReportLength - ); - -/*++ -Routine Descripton: - A usage value array occurs when the last usage in the list of usages - describing a main item must be repeated because there are less usages defined - than there are report counts declared for the given main item. In this case - a single value cap is allocated for that usage and the report count of that - value cap is set to reflect the number of fields to which that usage refers. - - HidP_GetUsageValueArray returns the raw bits for that usage which spans - more than one field in a report. - - NOTE: This function currently does not support value arrays where the - ReportSize for each of the fields in the array is not a multiple - of 8 bits. - - The UsageValue buffer will have the raw values as they are set - in the report packet. - -Parameters: - - ReportType One of HidP_Input, HidP_Output or HidP_Feature. - - UsagePage The usage page to which the given usage refers. - - LinkCollection (Optional) This value can be used to differentiate - between two fields that may have the same - UsagePage and Usage but exist in different - collections. If the link collection value - is zero, this function will set the first field - it finds that matches the usage page and - usage. - - Usage The usage whose value HidP_GetUsageValueArray will retreive. - - UsageValue A pointer to an array of characters where the value will be - placed. The number of BITS required is found by multiplying the - BitSize and ReportCount fields of the Value Cap for this - control. The least significant bit of this control found in the - given report will be placed in the least significant bit location - of the buffer (little-endian format), regardless of whether - or not the field is byte aligned or if the BitSize is a multiple - of sizeof (CHAR). - - See note above about current implementation limitations - - UsageValueByteLength - the length of the given UsageValue buffer. - - PreparsedData The preparsed data returned by the HIDCLASS - - Report The report packet. - - ReportLength Length of the given report packet. - -Return Value: - - HIDP_STATUS_SUCCESS -- upon successfully retrieving the value - from the report packet - HIDP_STATUS_INVALID_REPORT_TYPE -- if ReportType is not valid. - HIDP_STATUS_INVALID_PREPARSED_DATA -- if PreparsedData is not valid - HIDP_STATUS_INVALID_REPORT_LENGTH -- the length of the report packet is not - equal to the length specified in - the HIDP_CAPS structure for the given - ReportType - HIDP_STATUS_NOT_VALUE_ARRAY -- if the control specified is not a - value array -- a value array will have - a ReportCount field in the - HIDP_VALUE_CAPS structure that is > 1 - Use HidP_GetUsageValue instead - HIDP_STATUS_BUFFER_TOO_SMALL -- if the size of the passed in buffer in - which to return the array is too small - (ie. has fewer values than the number of - fields in the array - HIDP_STATUS_NOT_IMPLEMENTED -- if the usage value array has field sizes - that are not multiples of 8 bits, this - error code is returned since the function - currently does not handle getting values - from such arrays. - HIDP_STATUS_INCOMPATIBLE_REPORT_ID -- the specified usage page, usage and - link collection exist but exists in - a report with a different report ID - than the report being passed in. To - set this value, call - HidP_GetUsageValueArray with a - different report packet - HIDP_STATUS_USAGE_NOT_FOUND -- if the usage page, usage, and link - collection combination does not exist - in any reports for this ReportType ---*/ - - -_IRQL_requires_max_(PASSIVE_LEVEL) -NTSTATUS __stdcall -HidP_UsageListDifference ( - reads_(UsageListLength) PUSAGE PreviousUsageList, - reads_(UsageListLength) PUSAGE CurrentUsageList, - writes_(UsageListLength) PUSAGE BreakUsageList, - writes_(UsageListLength) PUSAGE MakeUsageList, - ULONG UsageListLength - ); -/*++ -Routine Description: - This function will return the difference between a two lists of usages - (as might be returned from HidP_GetUsages), In other words, it will return - return a list of usages that are in the current list but not the previous - list as well as a list of usages that are in the previous list but not - the current list. - -Parameters: - - PreviousUsageList The list of usages before. - CurrentUsageList The list of usages now. - BreakUsageList Previous - Current. - MakeUsageList Current - Previous. - UsageListLength Represents the length of the usage lists in array - elements. If comparing two lists with a differing - number of array elements, this value should be - the size of the larger of the two lists. Any - zero found with a list indicates an early termination - of the list and any usages found after the first zero - will be ignored. ---*/ - - -_IRQL_requires_max_(PASSIVE_LEVEL) -NTSTATUS __stdcall -HidP_UsageAndPageListDifference ( - reads_(UsageListLength) PUSAGE_AND_PAGE PreviousUsageList, - reads_(UsageListLength) PUSAGE_AND_PAGE CurrentUsageList, - writes_(UsageListLength) PUSAGE_AND_PAGE BreakUsageList, - writes_(UsageListLength) PUSAGE_AND_PAGE MakeUsageList, - ULONG UsageListLength - ); - -// -// Produce Make or Break Codes -// -typedef enum _HIDP_KEYBOARD_DIRECTION { - HidP_Keyboard_Break, - HidP_Keyboard_Make -} HIDP_KEYBOARD_DIRECTION; - -// -// A bitmap of the current shift state of the keyboard when using the -// below keyboard usages to i8042 translation function. -// -typedef struct _HIDP_KEYBOARD_MODIFIER_STATE { - union { - struct { - ULONG LeftControl: 1; - ULONG LeftShift: 1; - ULONG LeftAlt: 1; - ULONG LeftGUI: 1; - ULONG RightControl: 1; - ULONG RightShift: 1; - ULONG RightAlt: 1; - ULONG RigthGUI: 1; - ULONG CapsLock: 1; - ULONG ScollLock: 1; - ULONG NumLock: 1; - ULONG Reserved: 21; - }; - ULONG ul; - }; - -} HIDP_KEYBOARD_MODIFIER_STATE, * PHIDP_KEYBOARD_MODIFIER_STATE; - -// -// A call back function to give the i8042 scan codes to the caller of -// the below translation function. -// -typedef BOOLEAN (* PHIDP_INSERT_SCANCODES) ( - PVOID Context, // Some caller supplied context. - reads_bytes_(Length) PCHAR NewScanCodes, // A list of i8042 scan codes. - ULONG Length // the length of the scan codes. - ); - - -NTSTATUS __stdcall -HidP_TranslateUsageAndPagesToI8042ScanCodes ( - reads_(UsageListLength) PUSAGE_AND_PAGE ChangedUsageList, - ULONG UsageListLength, - HIDP_KEYBOARD_DIRECTION KeyAction, - PHIDP_KEYBOARD_MODIFIER_STATE ModifierState, - PHIDP_INSERT_SCANCODES InsertCodesProcedure, - PVOID InsertCodesContext - ); -/*++ -Routine Description: -Parameters: ---*/ - -NTSTATUS __stdcall -HidP_TranslateUsagesToI8042ScanCodes ( - reads_(UsageListLength) PUSAGE ChangedUsageList, - ULONG UsageListLength, - HIDP_KEYBOARD_DIRECTION KeyAction, - PHIDP_KEYBOARD_MODIFIER_STATE ModifierState, - PHIDP_INSERT_SCANCODES InsertCodesProcedure, - PVOID InsertCodesContext - ); -/*++ -Routine Description: -Parameters: ---*/ - - - -// -// Define NT Status codes with Facility Code of FACILITY_HID_ERROR_CODE -// - -// FACILITY_HID_ERROR_CODE defined in ntstatus.h -#ifndef FACILITY_HID_ERROR_CODE -#define FACILITY_HID_ERROR_CODE 0x11 -#endif - -#define HIDP_ERROR_CODES(SEV, CODE) \ - ((NTSTATUS) (((SEV) << 28) | (FACILITY_HID_ERROR_CODE << 16) | (CODE))) - -#define HIDP_STATUS_SUCCESS (HIDP_ERROR_CODES(0x0,0)) -#define HIDP_STATUS_NULL (HIDP_ERROR_CODES(0x8,1)) -#define HIDP_STATUS_INVALID_PREPARSED_DATA (HIDP_ERROR_CODES(0xC,1)) -#define HIDP_STATUS_INVALID_REPORT_TYPE (HIDP_ERROR_CODES(0xC,2)) -#define HIDP_STATUS_INVALID_REPORT_LENGTH (HIDP_ERROR_CODES(0xC,3)) -#define HIDP_STATUS_USAGE_NOT_FOUND (HIDP_ERROR_CODES(0xC,4)) -#define HIDP_STATUS_VALUEOF_RANGE (HIDP_ERROR_CODES(0xC,5)) -#define HIDP_STATUS_BAD_LOG_PHY_VALUES (HIDP_ERROR_CODES(0xC,6)) -#define HIDP_STATUS_BUFFER_TOO_SMALL (HIDP_ERROR_CODES(0xC,7)) -#define HIDP_STATUS_INTERNAL_ERROR (HIDP_ERROR_CODES(0xC,8)) -#define HIDP_STATUS_I8042_TRANS_UNKNOWN (HIDP_ERROR_CODES(0xC,9)) -#define HIDP_STATUS_INCOMPATIBLE_REPORT_ID (HIDP_ERROR_CODES(0xC,0xA)) -#define HIDP_STATUS_NOT_VALUE_ARRAY (HIDP_ERROR_CODES(0xC,0xB)) -#define HIDP_STATUS_IS_VALUE_ARRAY (HIDP_ERROR_CODES(0xC,0xC)) -#define HIDP_STATUS_DATA_INDEX_NOT_FOUND (HIDP_ERROR_CODES(0xC,0xD)) -#define HIDP_STATUS_DATA_INDEXOF_RANGE (HIDP_ERROR_CODES(0xC,0xE)) -#define HIDP_STATUS_BUTTON_NOT_PRESSED (HIDP_ERROR_CODES(0xC,0xF)) -#define HIDP_STATUS_REPORT_DOES_NOT_EXIST (HIDP_ERROR_CODES(0xC,0x10)) -#define HIDP_STATUS_NOT_IMPLEMENTED (HIDP_ERROR_CODES(0xC,0x20)) - -// -// We blundered this status code. -// -#define HIDP_STATUS_I8242_TRANS_UNKNOWN HIDP_STATUS_I8042_TRANS_UNKNOWN - -/*++ - -Copyright (c) Microsoft Corporation. All rights reserved. - -Module Name: - - HIDSDI.H - -Abstract: - - This module contains the PUBLIC definitions for the - code that implements the HID dll. - -Environment: - - Kernel & user mode - ---*/ - - - - -typedef struct _HIDD_CONFIGURATION { - PVOID cookie; - ULONG size; - ULONG RingBufferSize; -} HIDD_CONFIGURATION, *PHIDD_CONFIGURATION; - -typedef struct _HIDD_ATTRIBUTES { - ULONG Size; // = sizeof (struct _HIDD_ATTRIBUTES) - - // - // Vendor ids of this hid device - // - USHORT VendorID; - USHORT ProductID; - USHORT VersionNumber; - - // - // Additional fields will be added to the end of this structure. - // -} HIDD_ATTRIBUTES, *PHIDD_ATTRIBUTES; - - -BOOLEAN __stdcall -HidD_GetAttributes ( - HANDLE HidDeviceObject, - PHIDD_ATTRIBUTES Attributes - ); -/*++ -Routine Description: - Fill in the given HIDD_ATTRIBUTES structure with the attributes of the - given hid device. - ---*/ - - -void __stdcall -HidD_GetHidGuid ( - LPGUID HidGuid - ); - - -BOOLEAN __stdcall -HidD_GetPreparsedData ( - HANDLE HidDeviceObject, - PHIDP_PREPARSED_DATA * PreparsedData - ); -/*++ -Routine Description: - Given a handle to a valid Hid Class Device Object, retrieve the preparsed - data for the device. This routine will allocate the appropriately - sized buffer to hold this preparsed data. It is up to client to call - HidP_FreePreparsedData to free the memory allocated to this structure when - it is no longer needed. - -Arguments: - HidDeviceObject A handle to a Hid Device that the client obtains using - a call to CreateFile on a valid Hid device string name. - The string name can be obtained using standard PnP calls. - - PreparsedData An opaque data structure used by other functions in this - library to retrieve information about a given device. - -Return Value: - TRUE if successful. - FALSE otherwise -- Use GetLastError() to get extended error information ---*/ -BOOLEAN __stdcall -HidD_FreePreparsedData ( - __drv_freesMem(Mem) PHIDP_PREPARSED_DATA PreparsedData - ); - -BOOLEAN __stdcall -HidD_FlushQueue ( - HANDLE HidDeviceObject - ); -/*++ -Routine Description: - Flush the input queue for the given HID device. - -Arguments: - HidDeviceObject A handle to a Hid Device that the client obtains using - a call to CreateFile on a valid Hid device string name. - The string name can be obtained using standard PnP calls. - -Return Value: - TRUE if successful - FALSE otherwise -- Use GetLastError() to get extended error information ---*/ - -BOOLEAN __stdcall -HidD_GetConfiguration ( - HANDLE HidDeviceObject, - PHIDD_CONFIGURATION Configuration, - ULONG ConfigurationLength - ); -/*++ -Routine Description: - Get the configuration information for this Hid device - -Arguments: - HidDeviceObject A handle to a Hid Device Object. - - Configuration A configuration structure. HidD_GetConfiguration MUST - be called before the configuration can be modified and - set using HidD_SetConfiguration - - ConfigurationLength That is ``sizeof (HIDD_CONFIGURATION)''. Using this - parameter, we can later increase the length of the - configuration array and not break older apps. - -Return Value: - TRUE if successful - FALSE otherwise -- Use GetLastError() to get extended error information ---*/ - -BOOLEAN __stdcall -HidD_SetConfiguration ( - HANDLE HidDeviceObject, - reads_bytes_(ConfigurationLength) PHIDD_CONFIGURATION Configuration, - ULONG ConfigurationLength - ); -/*++ -Routine Description: - Set the configuration information for this Hid device... - - NOTE: HidD_GetConfiguration must be called to retrieve the current - configuration information before this information can be modified - and set. - -Arguments: - HidDeviceObject A handle to a Hid Device Object. - - Configuration A configuration structure. HidD_GetConfiguration MUST - be called before the configuration can be modified and - set using HidD_SetConfiguration - - ConfigurationLength That is ``sizeof (HIDD_CONFIGURATION)''. Using this - parameter, we can later increase the length of the - configuration array and not break older apps. - -Return Value: - TRUE if successful - FALSE otherwise -- Use GetLastError() to get extended error information ---*/ - -BOOLEAN __stdcall -HidD_GetFeature ( - HANDLE HidDeviceObject, - PVOID ReportBuffer, - ULONG ReportBufferLength - ); -/*++ -Routine Description: - Retrieve a feature report from a HID device. - -Arguments: - HidDeviceObject A handle to a Hid Device Object. - - ReportBuffer The buffer that the feature report should be placed - into. The first byte of the buffer should be set to - the report ID of the desired report - - ReportBufferLength The size (in bytes) of ReportBuffer. This value - should be greater than or equal to the - FeatureReportByteLength field as specified in the - HIDP_CAPS structure for the device -Return Value: - TRUE if successful - FALSE otherwise -- Use GetLastError() to get extended error information ---*/ - -BOOLEAN __stdcall -HidD_SetFeature ( - HANDLE HidDeviceObject, - reads_bytes_(ReportBufferLength) PVOID ReportBuffer, - ULONG ReportBufferLength - ); -/*++ -Routine Description: - Send a feature report to a HID device. - -Arguments: - HidDeviceObject A handle to a Hid Device Object. - - ReportBuffer The buffer of the feature report to send to the device - - ReportBufferLength The size (in bytes) of ReportBuffer. This value - should be greater than or equal to the - FeatureReportByteLength field as specified in the - HIDP_CAPS structure for the device -Return Value: - TRUE if successful - FALSE otherwise -- Use GetLastError() to get extended error information ---*/ - - - -BOOLEAN __stdcall -HidD_GetInputReport ( - HANDLE HidDeviceObject, - PVOID ReportBuffer, - ULONG ReportBufferLength - ); -/*++ -Routine Description: - Retrieve an input report from a HID device. - -Arguments: - HidDeviceObject A handle to a Hid Device Object. - - ReportBuffer The buffer that the input report should be placed - into. The first byte of the buffer should be set to - the report ID of the desired report - - ReportBufferLength The size (in bytes) of ReportBuffer. This value - should be greater than or equal to the - InputReportByteLength field as specified in the - HIDP_CAPS structure for the device -Return Value: - TRUE if successful - FALSE otherwise -- Use GetLastError() to get extended error information ---*/ - -BOOLEAN __stdcall -HidD_SetOutputReport ( - HANDLE HidDeviceObject, - reads_bytes_(ReportBufferLength) PVOID ReportBuffer, - ULONG ReportBufferLength - ); -/*++ -Routine Description: - Send an output report to a HID device. - -Arguments: - HidDeviceObject A handle to a Hid Device Object. - - ReportBuffer The buffer of the output report to send to the device - - ReportBufferLength The size (in bytes) of ReportBuffer. This value - should be greater than or equal to the - OutputReportByteLength field as specified in the - HIDP_CAPS structure for the device -Return Value: - TRUE if successful - FALSE otherwise -- Use GetLastError() to get extended error information ---*/ - -#endif - -BOOLEAN __stdcall -HidD_GetNumInputBuffers ( - HANDLE HidDeviceObject, - PULONG NumberBuffers - ); -/*++ -Routine Description: - This function returns the number of input buffers used by the specified - file handle to the Hid device. Each file object has a number of buffers - associated with it to queue reports read from the device but which have - not yet been read by the user-mode app with a handle to that device. - -Arguments: - HidDeviceObject A handle to a Hid Device Object. - - NumberBuffers Number of buffers currently being used for this file - handle to the Hid device - -Return Value: - TRUE if successful - FALSE otherwise -- Use GetLastError() to get extended error information ---*/ - -BOOLEAN __stdcall -HidD_SetNumInputBuffers ( - HANDLE HidDeviceObject, - ULONG NumberBuffers - ); -/*++ - -Routine Description: - This function sets the number of input buffers used by the specified - file handle to the Hid device. Each file object has a number of buffers - associated with it to queue reports read from the device but which have - not yet been read by the user-mode app with a handle to that device. - -Arguments: - HidDeviceObject A handle to a Hid Device Object. - - NumberBuffers New number of buffers to use for this file handle to - the Hid device - -Return Value: - TRUE if successful - FALSE otherwise -- Use GetLastError() to get extended error information ---*/ - -BOOLEAN __stdcall -HidD_GetPhysicalDescriptor ( - HANDLE HidDeviceObject, - PVOID Buffer, - ULONG BufferLength - ); -/*++ -Routine Description: - This function retrieves the raw physical descriptor for the specified - Hid device. - -Arguments: - HidDeviceObject A handle to a Hid Device Object. - - Buffer Buffer which on return will contain the physical - descriptor if one exists for the specified device - handle - - BufferLength Length of buffer (in bytes) - - -Return Value: - TRUE if successful - FALSE otherwise -- Use GetLastError() to get extended error information ---*/ - -BOOLEAN __stdcall -HidD_GetManufacturerString ( - HANDLE HidDeviceObject, - PVOID Buffer, - ULONG BufferLength - ); -/*++ -Routine Description: - This function retrieves the manufacturer string from the specified - Hid device. - -Arguments: - HidDeviceObject A handle to a Hid Device Object. - - Buffer Buffer which on return will contain the manufacturer - string returned from the device. This string is a - wide-character string - - BufferLength Length of Buffer (in bytes) - - -Return Value: - TRUE if successful - FALSE otherwise -- Use GetLastError() to get extended error information ---*/ - -BOOLEAN __stdcall -HidD_GetProductString ( - HANDLE HidDeviceObject, - PVOID Buffer, - ULONG BufferLength - ); -/*++ -Routine Description: - This function retrieves the product string from the specified - Hid device. - -Arguments: - HidDeviceObject A handle to a Hid Device Object. - - Buffer Buffer which on return will contain the product - string returned from the device. This string is a - wide-character string - - BufferLength Length of Buffer (in bytes) - - -Return Value: - TRUE if successful - FALSE otherwise -- Use GetLastError() to get extended error information ---*/ - -BOOLEAN __stdcall -HidD_GetIndexedString ( - HANDLE HidDeviceObject, - ULONG StringIndex, - PVOID Buffer, - ULONG BufferLength - ); -/*++ -Routine Description: - This function retrieves a string from the specified Hid device that is - specified with a certain string index. - -Arguments: - HidDeviceObject A handle to a Hid Device Object. - - StringIndex Index of the string to retrieve - - Buffer Buffer which on return will contain the product - string returned from the device. This string is a - wide-character string - - BufferLength Length of Buffer (in bytes) - -Return Value: - TRUE if successful - FALSE otherwise -- Use GetLastError() to get extended error information ---*/ - -BOOLEAN __stdcall -HidD_GetSerialNumberString ( - HANDLE HidDeviceObject, - PVOID Buffer, - ULONG BufferLength - ); -/*++ -Routine Description: - This function retrieves the serial number string from the specified - Hid device. - -Arguments: - HidDeviceObject A handle to a Hid Device Object. - - Buffer Buffer which on return will contain the serial number - string returned from the device. This string is a - wide-character string - - BufferLength Length of Buffer (in bytes) - -Return Value: - TRUE if successful - FALSE otherwise -- Use GetLastError() to get extended error information ---*/ - - - -BOOLEAN __stdcall -HidD_GetMsGenreDescriptor ( - HANDLE HidDeviceObject, - PVOID Buffer, - ULONG BufferLength - ); - - - - - diff -r cdc5f8f1b79e -r e2acfa51664f pinvoke-interop-assistant-input.c --- a/pinvoke-interop-assistant-input.c Sun Mar 15 20:25:58 2015 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,154 +0,0 @@ - -typedef USHORT USAGE, *PUSAGE; -typedef LONG NTSTATUS; - -typedef struct _HIDP_PREPARSED_DATA * PHIDP_PREPARSED_DATA; - -typedef enum _HIDP_REPORT_TYPE -{ - HidP_Input, - HidP_Output, - HidP_Feature -} HIDP_REPORT_TYPE; - -typedef struct _HIDP_CAPS -{ - USAGE Usage; - USAGE UsagePage; - USHORT InputReportByteLength; - USHORT OutputReportByteLength; - USHORT FeatureReportByteLength; - USHORT Reserved[17]; - - USHORT NumberLinkCollectionNodes; - - USHORT NumberInputButtonCaps; - USHORT NumberInputValueCaps; - USHORT NumberInputDataIndices; - - USHORT NumberOutputButtonCaps; - USHORT NumberOutputValueCaps; - USHORT NumberOutputDataIndices; - - USHORT NumberFeatureButtonCaps; - USHORT NumberFeatureValueCaps; - USHORT NumberFeatureDataIndices; -} HIDP_CAPS, *PHIDP_CAPS; - - -typedef struct _HIDP_BUTTON_CAPS -{ - USAGE UsagePage; - UCHAR ReportID; - BOOLEAN IsAlias; - - USHORT BitField; - USHORT LinkCollection; // A unique internal index pointer - - USAGE LinkUsage; - USAGE LinkUsagePage; - - BOOLEAN IsRange; - BOOLEAN IsStringRange; - BOOLEAN IsDesignatorRange; - BOOLEAN IsAbsolute; - - ULONG Reserved[10]; - union { - struct { - USAGE UsageMin, UsageMax; - USHORT StringMin, StringMax; - USHORT DesignatorMin, DesignatorMax; - USHORT DataIndexMin, DataIndexMax; - } Range; - struct { - USAGE Usage, Reserved1; - USHORT StringIndex, Reserved2; - USHORT DesignatorIndex, Reserved3; - USHORT DataIndex, Reserved4; - } NotRange; - }; - -} HIDP_BUTTON_CAPS, *PHIDP_BUTTON_CAPS; - -typedef struct _HIDP_VALUE_CAPS -{ - USAGE UsagePage; - UCHAR ReportID; - BOOLEAN IsAlias; - - USHORT BitField; - USHORT LinkCollection; // A unique internal index pointer - - USAGE LinkUsage; - USAGE LinkUsagePage; - - BOOLEAN IsRange; - BOOLEAN IsStringRange; - BOOLEAN IsDesignatorRange; - BOOLEAN IsAbsolute; - - BOOLEAN HasNull; // Does this channel have a null report union - UCHAR Reserved; - USHORT BitSize; // How many bits are devoted to this value? - - USHORT ReportCount; // See Note below. Usually set to 1. - USHORT Reserved2[5]; - - ULONG UnitsExp; - ULONG Units; - - LONG LogicalMin, LogicalMax; - LONG PhysicalMin, PhysicalMax; - - union { - struct { - USAGE UsageMin, UsageMax; - USHORT StringMin, StringMax; - USHORT DesignatorMin, DesignatorMax; - USHORT DataIndexMin, DataIndexMax; - } Range; - - struct { - USAGE Usage, Reserved1; - USHORT StringIndex, Reserved2; - USHORT DesignatorIndex, Reserved3; - USHORT DataIndex, Reserved4; - } NotRange; - }; -} HIDP_VALUE_CAPS, *PHIDP_VALUE_CAPS; - -NTSTATUS __stdcall -HidP_GetCaps ( - PHIDP_PREPARSED_DATA PreparsedData, - PHIDP_CAPS Capabilities - ); - - NTSTATUS __stdcall -HidP_GetButtonCaps ( - HIDP_REPORT_TYPE ReportType, - PHIDP_BUTTON_CAPS ButtonCaps, - PUSHORT ButtonCapsLength, - PHIDP_PREPARSED_DATA PreparsedData -); - -NTSTATUS __stdcall -HidP_GetValueCaps ( - HIDP_REPORT_TYPE ReportType, - PHIDP_VALUE_CAPS ValueCaps, - PUSHORT ValueCapsLength, - PHIDP_PREPARSED_DATA PreparsedData -); - -NTSTATUS __stdcall -HidP_GetUsageValue ( - HIDP_REPORT_TYPE ReportType, - USAGE UsagePage, - USHORT LinkCollection, - USAGE Usage, - PULONG UsageValue, - PHIDP_PREPARSED_DATA PreparsedData, - PCHAR Report, - ULONG ReportLength - ); -