USB Host Shield 2.0
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
hidescriptorparser.cpp
Go to the documentation of this file.
1 #include "hidescriptorparser.h"
2 
4 {
5  pstrUsagePageGenericDesktopControls ,
6  pstrUsagePageSimulationControls ,
7  pstrUsagePageVRControls ,
8  pstrUsagePageSportControls ,
9  pstrUsagePageGameControls ,
10  pstrUsagePageGenericDeviceControls ,
11  pstrUsagePageKeyboardKeypad ,
12  pstrUsagePageLEDs ,
13  pstrUsagePageButton ,
14  pstrUsagePageOrdinal ,
15  pstrUsagePageTelephone ,
16  pstrUsagePageConsumer ,
17  pstrUsagePageDigitizer ,
18  pstrUsagePagePID ,
19  pstrUsagePageUnicode
20 };
21 
23 {
24  pstrUsagePageBarCodeScanner ,
25  pstrUsagePageScale ,
26  pstrUsagePageMSRDevices ,
27  pstrUsagePagePointOfSale ,
28  pstrUsagePageCameraControl ,
29  pstrUsagePageArcade
30 };
32 {
33  pstrUsagePointer ,
34  pstrUsageMouse ,
35  pstrUsageJoystick ,
36  pstrUsageGamePad ,
37  pstrUsageKeyboard ,
38  pstrUsageKeypad ,
39  pstrUsageMultiAxisController ,
40  pstrUsageTabletPCSystemControls
41 
42 };
44 {
45  pstrUsageX ,
46  pstrUsageY ,
47  pstrUsageZ ,
48  pstrUsageRx ,
49  pstrUsageRy ,
50  pstrUsageRz ,
51  pstrUsageSlider ,
52  pstrUsageDial ,
53  pstrUsageWheel ,
54  pstrUsageHatSwitch ,
55  pstrUsageCountedBuffer ,
56  pstrUsageByteCount ,
57  pstrUsageMotionWakeup ,
58  pstrUsageStart ,
59  pstrUsageSelect ,
60  pstrUsagePageReserved ,
61  pstrUsageVx ,
62  pstrUsageVy ,
63  pstrUsageVz ,
64  pstrUsageVbrx ,
65  pstrUsageVbry ,
66  pstrUsageVbrz ,
67  pstrUsageVno ,
68  pstrUsageFeatureNotification ,
69  pstrUsageResolutionMultiplier
70 };
72 {
73  pstrUsageSystemControl ,
74  pstrUsageSystemPowerDown ,
75  pstrUsageSystemSleep ,
76  pstrUsageSystemWakeup ,
77  pstrUsageSystemContextMenu ,
78  pstrUsageSystemMainMenu ,
79  pstrUsageSystemAppMenu ,
80  pstrUsageSystemMenuHelp ,
81  pstrUsageSystemMenuExit ,
82  pstrUsageSystemMenuSelect ,
83  pstrUsageSystemMenuRight ,
84  pstrUsageSystemMenuLeft ,
85  pstrUsageSystemMenuUp ,
86  pstrUsageSystemMenuDown ,
87  pstrUsageSystemColdRestart ,
88  pstrUsageSystemWarmRestart ,
89  pstrUsageDPadUp ,
90  pstrUsageDPadDown ,
91  pstrUsageDPadRight ,
92  pstrUsageDPadLeft
93 };
95 {
96  pstrUsageSystemDock ,
97  pstrUsageSystemUndock ,
98  pstrUsageSystemSetup ,
99  pstrUsageSystemBreak ,
100  pstrUsageSystemDebuggerBreak ,
101  pstrUsageApplicationBreak ,
102  pstrUsageApplicationDebuggerBreak,
103  pstrUsageSystemSpeakerMute ,
104  pstrUsageSystemHibernate
105 };
107 {
108  pstrUsageSystemDisplayInvert ,
109  pstrUsageSystemDisplayInternal ,
110  pstrUsageSystemDisplayExternal ,
111  pstrUsageSystemDisplayBoth ,
112  pstrUsageSystemDisplayDual ,
113  pstrUsageSystemDisplayToggleIntExt ,
114  pstrUsageSystemDisplaySwapPriSec ,
115  pstrUsageSystemDisplayLCDAutoscale
116 };
118 {
119  pstrUsageFlightSimulationDevice ,
120  pstrUsageAutomobileSimulationDevice ,
121  pstrUsageTankSimulationDevice ,
122  pstrUsageSpaceshipSimulationDevice ,
123  pstrUsageSubmarineSimulationDevice ,
124  pstrUsageSailingSimulationDevice ,
125  pstrUsageMotocicleSimulationDevice ,
126  pstrUsageSportsSimulationDevice ,
127  pstrUsageAirplaneSimulationDevice ,
128  pstrUsageHelicopterSimulationDevice ,
129  pstrUsageMagicCarpetSimulationDevice,
130  pstrUsageBicycleSimulationDevice
131 };
133 {
134  pstrUsageFlightControlStick ,
135  pstrUsageFlightStick ,
136  pstrUsageCyclicControl ,
137  pstrUsageCyclicTrim ,
138  pstrUsageFlightYoke ,
139  pstrUsageTrackControl
140 };
142 {
143  pstrUsageAileron ,
144  pstrUsageAileronTrim ,
145  pstrUsageAntiTorqueControl ,
146  pstrUsageAutopilotEnable ,
147  pstrUsageChaffRelease ,
148  pstrUsageCollectiveControl ,
149  pstrUsageDiveBrake ,
150  pstrUsageElectronicCountermeasures ,
151  pstrUsageElevator ,
152  pstrUsageElevatorTrim ,
153  pstrUsageRudder ,
154  pstrUsageThrottle ,
155  pstrUsageFlightCommunications ,
156  pstrUsageFlareRelease ,
157  pstrUsageLandingGear ,
158  pstrUsageToeBrake ,
159  pstrUsageTrigger ,
160  pstrUsageWeaponsArm ,
161  pstrUsageWeaponsSelect ,
162  pstrUsageWingFlaps ,
163  pstrUsageAccelerator ,
164  pstrUsageBrake ,
165  pstrUsageClutch ,
166  pstrUsageShifter ,
167  pstrUsageSteering ,
168  pstrUsageTurretDirection ,
169  pstrUsageBarrelElevation ,
170  pstrUsageDivePlane ,
171  pstrUsageBallast ,
172  pstrUsageBicycleCrank ,
173  pstrUsageHandleBars ,
174  pstrUsageFrontBrake ,
175  pstrUsageRearBrake
176 };
178 {
179  pstrUsageBelt ,
180  pstrUsageBodySuit ,
181  pstrUsageFlexor ,
182  pstrUsageGlove ,
183  pstrUsageHeadTracker ,
184  pstrUsageHeadMountedDisplay ,
185  pstrUsageHandTracker ,
186  pstrUsageOculometer ,
187  pstrUsageVest ,
188  pstrUsageAnimatronicDevice
189 };
191 {
192  pstrUsageStereoEnable ,
193  pstrUsageDisplayEnable
194 };
196 {
197  pstrUsageBaseballBat ,
198  pstrUsageGolfClub ,
199  pstrUsageRowingMachine ,
200  pstrUsageTreadmill
201 };
203 {
204  pstrUsageOar ,
205  pstrUsageSlope ,
206  pstrUsageRate ,
207  pstrUsageStickSpeed ,
208  pstrUsageStickFaceAngle ,
209  pstrUsageStickHeelToe ,
210  pstrUsageStickFollowThough ,
211  pstrUsageStickTempo ,
212  pstrUsageStickType ,
213  pstrUsageStickHeight
214 };
216 {
217  pstrUsagePutter ,
218  pstrUsage1Iron ,
219  pstrUsage2Iron ,
220  pstrUsage3Iron ,
221  pstrUsage4Iron ,
222  pstrUsage5Iron ,
223  pstrUsage6Iron ,
224  pstrUsage7Iron ,
225  pstrUsage8Iron ,
226  pstrUsage9Iron ,
227  pstrUsage10Iron ,
228  pstrUsage11Iron ,
229  pstrUsageSandWedge ,
230  pstrUsageLoftWedge ,
231  pstrUsagePowerWedge ,
232  pstrUsage1Wood ,
233  pstrUsage3Wood ,
234  pstrUsage5Wood ,
235  pstrUsage7Wood ,
236  pstrUsage9Wood
237 };
239 {
240  pstrUsage3DGameController ,
241  pstrUsagePinballDevice ,
242  pstrUsageGunDevice
243 };
245 {
246  pstrUsagePointOfView ,
247  pstrUsageTurnRightLeft ,
248  pstrUsagePitchForwardBackward ,
249  pstrUsageRollRightLeft ,
250  pstrUsageMoveRightLeft ,
251  pstrUsageMoveForwardBackward ,
252  pstrUsageMoveUpDown ,
253  pstrUsageLeanRightLeft ,
254  pstrUsageLeanForwardBackward ,
255  pstrUsageHeightOfPOV ,
256  pstrUsageFlipper ,
257  pstrUsageSecondaryFlipper ,
258  pstrUsageBump ,
259  pstrUsageNewGame ,
260  pstrUsageShootBall ,
261  pstrUsagePlayer ,
262  pstrUsageGunBolt ,
263  pstrUsageGunClip ,
264  pstrUsageGunSelector ,
265  pstrUsageGunSingleShot ,
266  pstrUsageGunBurst ,
267  pstrUsageGunAutomatic ,
268  pstrUsageGunSafety ,
269  pstrUsageGamepadFireJump ,
270  pstrUsageGamepadTrigger
271 };
273 {
274  pstrUsageBatteryStrength,
275  pstrUsageWirelessChannel,
276  pstrUsageWirelessID,
277  pstrUsageDiscoverWirelessControl,
278  pstrUsageSecurityCodeCharEntered,
279  pstrUsageSecurityCodeCharErased,
280  pstrUsageSecurityCodeCleared
281 };
283 {
284  pstrUsageNumLock ,
285  pstrUsageCapsLock ,
286  pstrUsageScrollLock ,
287  pstrUsageCompose ,
288  pstrUsageKana ,
289  pstrUsagePower ,
290  pstrUsageShift ,
291  pstrUsageDoNotDisturb ,
292  pstrUsageMute ,
293  pstrUsageToneEnable ,
294  pstrUsageHighCutFilter ,
295  pstrUsageLowCutFilter ,
296  pstrUsageEqualizerEnable ,
297  pstrUsageSoundFieldOn ,
298  pstrUsageSurroundOn ,
299  pstrUsageRepeat ,
300  pstrUsageStereo ,
301  pstrUsageSamplingRateDetect ,
302  pstrUsageSpinning ,
303  pstrUsageCAV ,
304  pstrUsageCLV ,
305  pstrUsageRecordingFormatDetect ,
306  pstrUsageOffHook ,
307  pstrUsageRing ,
308  pstrUsageMessageWaiting ,
309  pstrUsageDataMode ,
310  pstrUsageBatteryOperation ,
311  pstrUsageBatteryOK ,
312  pstrUsageBatteryLow ,
313  pstrUsageSpeaker ,
314  pstrUsageHeadSet ,
315  pstrUsageHold ,
316  pstrUsageMicrophone ,
317  pstrUsageCoverage ,
318  pstrUsageNightMode ,
319  pstrUsageSendCalls ,
320  pstrUsageCallPickup ,
321  pstrUsageConference ,
322  pstrUsageStandBy ,
323  pstrUsageCameraOn ,
324  pstrUsageCameraOff ,
325  pstrUsageOnLine ,
326  pstrUsageOffLine ,
327  pstrUsageBusy ,
328  pstrUsageReady ,
329  pstrUsagePaperOut ,
330  pstrUsagePaperJam ,
331  pstrUsageRemote ,
332  pstrUsageForward ,
333  pstrUsageReverse ,
334  pstrUsageStop ,
335  pstrUsageRewind ,
336  pstrUsageFastForward ,
337  pstrUsagePlay ,
338  pstrUsagePause ,
339  pstrUsageRecord ,
340  pstrUsageError ,
341  pstrUsageSelectedIndicator ,
342  pstrUsageInUseIndicator ,
343  pstrUsageMultiModeIndicator ,
344  pstrUsageIndicatorOn ,
345  pstrUsageIndicatorFlash ,
346  pstrUsageIndicatorSlowBlink ,
347  pstrUsageIndicatorFastBlink ,
348  pstrUsageIndicatorOff ,
349  pstrUsageFlashOnTime ,
350  pstrUsageSlowBlinkOnTime ,
351  pstrUsageSlowBlinkOffTime ,
352  pstrUsageFastBlinkOnTime ,
353  pstrUsageFastBlinkOffTime ,
354  pstrUsageIndicatorColor ,
355  pstrUsageIndicatorRed ,
356  pstrUsageIndicatorGreen ,
357  pstrUsageIndicatorAmber ,
358  pstrUsageGenericIndicator ,
359  pstrUsageSystemSuspend ,
360  pstrUsageExternalPowerConnected
361 };
363 {
364  pstrUsagePhone ,
365  pstrUsageAnsweringMachine ,
366  pstrUsageMessageControls ,
367  pstrUsageHandset ,
368  pstrUsageHeadset ,
369  pstrUsageTelephonyKeyPad ,
370  pstrUsageProgrammableButton
371 };
373 {
374  pstrUsageHookSwitch ,
375  pstrUsageFlash ,
376  pstrUsageFeature ,
377  pstrUsageHold ,
378  pstrUsageRedial ,
379  pstrUsageTransfer ,
380  pstrUsageDrop ,
381  pstrUsagePark ,
382  pstrUsageForwardCalls ,
383  pstrUsageAlternateFunction ,
384  pstrUsageLine ,
385  pstrUsageSpeakerPhone ,
386  pstrUsageConference ,
387  pstrUsageRingEnable ,
388  pstrUsageRingSelect ,
389  pstrUsagePhoneMute ,
390  pstrUsageCallerID ,
391  pstrUsageSend
392 };
394 {
395  pstrUsageSpeedDial ,
396  pstrUsageStoreNumber ,
397  pstrUsageRecallNumber ,
398  pstrUsagePhoneDirectory
399 };
401 {
402  pstrUsageVoiceMail ,
403  pstrUsageScreenCalls ,
404  pstrUsageDoNotDisturb ,
405  pstrUsageMessage ,
406  pstrUsageAnswerOnOff
407 };
409 {
410  pstrUsageInsideDialTone ,
411  pstrUsageOutsideDialTone ,
412  pstrUsageInsideRingTone ,
413  pstrUsageOutsideRingTone ,
414  pstrUsagePriorityRingTone ,
415  pstrUsageInsideRingback ,
416  pstrUsagePriorityRingback ,
417  pstrUsageLineBusyTone ,
418  pstrUsageReorderTone ,
419  pstrUsageCallWaitingTone ,
420  pstrUsageConfirmationTone1 ,
421  pstrUsageConfirmationTone2 ,
422  pstrUsageTonesOff ,
423  pstrUsageOutsideRingback ,
424  pstrUsageRinger
425 };
427 {
428  pstrUsagePhoneKey0 ,
429  pstrUsagePhoneKey1 ,
430  pstrUsagePhoneKey2 ,
431  pstrUsagePhoneKey3 ,
432  pstrUsagePhoneKey4 ,
433  pstrUsagePhoneKey5 ,
434  pstrUsagePhoneKey6 ,
435  pstrUsagePhoneKey7 ,
436  pstrUsagePhoneKey8 ,
437  pstrUsagePhoneKey9 ,
438  pstrUsagePhoneKeyStar ,
439  pstrUsagePhoneKeyPound ,
440  pstrUsagePhoneKeyA ,
441  pstrUsagePhoneKeyB ,
442  pstrUsagePhoneKeyC ,
443  pstrUsagePhoneKeyD
444 };
446 {
447  pstrUsageConsumerControl,
448  pstrUsageNumericKeyPad,
449  pstrUsageProgrammableButton,
450  pstrUsageMicrophone,
451  pstrUsageHeadphone,
452  pstrUsageGraphicEqualizer
453 };
455 {
456  pstrUsagePlus10 ,
457  pstrUsagePlus100,
458  pstrUsageAMPM
459 };
461 {
462  pstrUsagePower ,
463  pstrUsageReset ,
464  pstrUsageSleep ,
465  pstrUsageSleepAfter ,
466  pstrUsageSleepMode ,
467  pstrUsageIllumination ,
468  pstrUsageFunctionButtons
469 
470 };
472 {
473  pstrUsageMenu ,
474  pstrUsageMenuPick ,
475  pstrUsageMenuUp ,
476  pstrUsageMenuDown ,
477  pstrUsageMenuLeft ,
478  pstrUsageMenuRight ,
479  pstrUsageMenuEscape ,
480  pstrUsageMenuValueIncrease,
481  pstrUsageMenuValueDecrease
482 };
484 {
485  pstrUsageDataOnScreen ,
486  pstrUsageClosedCaption ,
487  pstrUsageClosedCaptionSelect,
488  pstrUsageVCRTV ,
489  pstrUsageBroadcastMode ,
490  pstrUsageSnapshot ,
491  pstrUsageStill
492 };
494 {
495  pstrUsageSelection ,
496  pstrUsageAssignSelection ,
497  pstrUsageModeStep ,
498  pstrUsageRecallLast ,
499  pstrUsageEnterChannel ,
500  pstrUsageOrderMovie ,
501  pstrUsageChannel ,
502  pstrUsageMediaSelection ,
503  pstrUsageMediaSelectComputer ,
504  pstrUsageMediaSelectTV ,
505  pstrUsageMediaSelectWWW ,
506  pstrUsageMediaSelectDVD ,
507  pstrUsageMediaSelectTelephone ,
508  pstrUsageMediaSelectProgramGuide ,
509  pstrUsageMediaSelectVideoPhone ,
510  pstrUsageMediaSelectGames ,
511  pstrUsageMediaSelectMessages ,
512  pstrUsageMediaSelectCD ,
513  pstrUsageMediaSelectVCR ,
514  pstrUsageMediaSelectTuner ,
515  pstrUsageQuit ,
516  pstrUsageHelp ,
517  pstrUsageMediaSelectTape ,
518  pstrUsageMediaSelectCable ,
519  pstrUsageMediaSelectSatellite ,
520  pstrUsageMediaSelectSecurity ,
521  pstrUsageMediaSelectHome ,
522  pstrUsageMediaSelectCall ,
523  pstrUsageChannelIncrement ,
524  pstrUsageChannelDecrement ,
525  pstrUsageMediaSelectSAP ,
526  pstrUsagePageReserved ,
527  pstrUsageVCRPlus ,
528  pstrUsageOnce ,
529  pstrUsageDaily ,
530  pstrUsageWeekly ,
531  pstrUsageMonthly
532 };
534 {
535  pstrUsagePlay ,
536  pstrUsagePause ,
537  pstrUsageRecord ,
538  pstrUsageFastForward ,
539  pstrUsageRewind ,
540  pstrUsageScanNextTrack ,
541  pstrUsageScanPreviousTrack ,
542  pstrUsageStop ,
543  pstrUsageEject ,
544  pstrUsageRandomPlay ,
545  pstrUsageSelectDisk ,
546  pstrUsageEnterDisk ,
547  pstrUsageRepeat ,
548  pstrUsageTracking ,
549  pstrUsageTrackNormal ,
550  pstrUsageSlowTracking ,
551  pstrUsageFrameForward ,
552  pstrUsageFrameBackwards ,
553  pstrUsageMark ,
554  pstrUsageClearMark ,
555  pstrUsageRepeatFromMark ,
556  pstrUsageReturnToMark ,
557  pstrUsageSearchMarkForward ,
558  pstrUsageSearchMarkBackwards ,
559  pstrUsageCounterReset ,
560  pstrUsageShowCounter ,
561  pstrUsageTrackingIncrement ,
562  pstrUsageTrackingDecrement ,
563  pstrUsageStopEject ,
564  pstrUsagePlayPause ,
565  pstrUsagePlaySkip
566 };
568 {
569  pstrUsageVolume ,
570  pstrUsageBalance ,
571  pstrUsageMute ,
572  pstrUsageBass ,
573  pstrUsageTreble ,
574  pstrUsageBassBoost ,
575  pstrUsageSurroundMode ,
576  pstrUsageLoudness ,
577  pstrUsageMPX ,
578  pstrUsageVolumeIncrement ,
579  pstrUsageVolumeDecrement
580 };
582 {
583  pstrUsageSpeedSelect ,
584  pstrUsagePlaybackSpeed ,
585  pstrUsageStandardPlay ,
586  pstrUsageLongPlay ,
587  pstrUsageExtendedPlay ,
588  pstrUsageSlow
589 };
591 {
592  pstrUsageFanEnable ,
593  pstrUsageFanSpeed ,
594  pstrUsageLightEnable ,
595  pstrUsageLightIlluminationLevel ,
596  pstrUsageClimateControlEnable ,
597  pstrUsageRoomTemperature ,
598  pstrUsageSecurityEnable ,
599  pstrUsageFireAlarm ,
600  pstrUsagePoliceAlarm ,
601  pstrUsageProximity ,
602  pstrUsageMotion ,
603  pstrUsageDuresAlarm ,
604  pstrUsageHoldupAlarm ,
605  pstrUsageMedicalAlarm
606 };
608 {
609  pstrUsageBalanceRight ,
610  pstrUsageBalanceLeft ,
611  pstrUsageBassIncrement ,
612  pstrUsageBassDecrement ,
613  pstrUsageTrebleIncrement ,
614  pstrUsageTrebleDecrement
615 };
617 {
618  pstrUsageSpeakerSystem ,
619  pstrUsageChannelLeft ,
620  pstrUsageChannelRight ,
621  pstrUsageChannelCenter ,
622  pstrUsageChannelFront ,
623  pstrUsageChannelCenterFront ,
624  pstrUsageChannelSide ,
625  pstrUsageChannelSurround ,
626  pstrUsageChannelLowFreqEnhancement ,
627  pstrUsageChannelTop ,
628  pstrUsageChannelUnknown
629 };
631 {
632  pstrUsageSubChannel ,
633  pstrUsageSubChannelIncrement ,
634  pstrUsageSubChannelDecrement ,
635  pstrUsageAlternateAudioIncrement ,
636  pstrUsageAlternateAudioDecrement
637 };
639 {
640  pstrUsageApplicationLaunchButtons ,
641  pstrUsageALLaunchButtonConfigTool ,
642  pstrUsageALProgrammableButton ,
643  pstrUsageALConsumerControlConfig ,
644  pstrUsageALWordProcessor ,
645  pstrUsageALTextEditor ,
646  pstrUsageALSpreadsheet ,
647  pstrUsageALGraphicsEditor ,
648  pstrUsageALPresentationApp ,
649  pstrUsageALDatabaseApp ,
650  pstrUsageALEmailReader ,
651  pstrUsageALNewsreader ,
652  pstrUsageALVoicemail ,
653  pstrUsageALContactsAddressBook ,
654  pstrUsageALCalendarSchedule ,
655  pstrUsageALTaskProjectManager ,
656  pstrUsageALLogJournalTimecard ,
657  pstrUsageALCheckbookFinance ,
658  pstrUsageALCalculator ,
659  pstrUsageALAVCapturePlayback ,
660  pstrUsageALLocalMachineBrowser ,
661  pstrUsageALLANWANBrow ,
662  pstrUsageALInternetBrowser ,
663  pstrUsageALRemoteNetISPConnect ,
664  pstrUsageALNetworkConference ,
665  pstrUsageALNetworkChat ,
666  pstrUsageALTelephonyDialer ,
667  pstrUsageALLogon ,
668  pstrUsageALLogoff ,
669  pstrUsageALLogonLogoff ,
670  pstrUsageALTermLockScrSav ,
671  pstrUsageALControlPannel ,
672  pstrUsageALCommandLineProcessorRun ,
673  pstrUsageALProcessTaskManager ,
674  pstrUsageALSelectTaskApplication ,
675  pstrUsageALNextTaskApplication ,
676  pstrUsageALPreviousTaskApplication ,
677  pstrUsageALPreemptiveHaltTaskApp ,
678  pstrUsageALIntegratedHelpCenter ,
679  pstrUsageALDocuments ,
680  pstrUsageALThesaurus ,
681  pstrUsageALDictionary ,
682  pstrUsageALDesktop ,
683  pstrUsageALSpellCheck ,
684  pstrUsageALGrammarCheck ,
685  pstrUsageALWirelessStatus ,
686  pstrUsageALKeyboardLayout ,
687  pstrUsageALVirusProtection ,
688  pstrUsageALEncryption ,
689  pstrUsageALScreenSaver ,
690  pstrUsageALAlarms ,
691  pstrUsageALClock ,
692  pstrUsageALFileBrowser ,
693  pstrUsageALPowerStatus ,
694  pstrUsageALImageBrowser ,
695  pstrUsageALAudioBrowser ,
696  pstrUsageALMovieBrowser ,
697  pstrUsageALDigitalRightsManager ,
698  pstrUsageALDigitalWallet ,
699  pstrUsagePageReserved ,
700  pstrUsageALInstantMessaging ,
701  pstrUsageALOEMFeaturesBrowser ,
702  pstrUsageALOEMHelp ,
703  pstrUsageALOnlineCommunity ,
704  pstrUsageALEntertainmentContentBrow ,
705  pstrUsageALOnlineShoppingBrowser ,
706  pstrUsageALSmartCardInfoHelp ,
707  pstrUsageALMarketMonitorFinBrowser ,
708  pstrUsageALCustomCorpNewsBrowser ,
709  pstrUsageALOnlineActivityBrowser ,
710  pstrUsageALResearchSearchBrowser ,
711  pstrUsageALAudioPlayer
712 };
714 {
715  pstrUsageGenericGUIAppControls ,
716  pstrUsageACNew ,
717  pstrUsageACOpen ,
718  pstrUsageACClose ,
719  pstrUsageACExit ,
720  pstrUsageACMaximize ,
721  pstrUsageACMinimize ,
722  pstrUsageACSave ,
723  pstrUsageACPrint ,
724  pstrUsageACProperties ,
725  pstrUsageACUndo ,
726  pstrUsageACCopy ,
727  pstrUsageACCut ,
728  pstrUsageACPaste ,
729  pstrUsageACSelectAll ,
730  pstrUsageACFind ,
731  pstrUsageACFindAndReplace ,
732  pstrUsageACSearch ,
733  pstrUsageACGoto ,
734  pstrUsageACHome ,
735  pstrUsageACBack ,
736  pstrUsageACForward ,
737  pstrUsageACStop ,
738  pstrUsageACRefresh ,
739  pstrUsageACPreviousLink ,
740  pstrUsageACNextLink ,
741  pstrUsageACBookmarks ,
742  pstrUsageACHistory ,
743  pstrUsageACSubscriptions ,
744  pstrUsageACZoomIn ,
745  pstrUsageACZoomOut ,
746  pstrUsageACZoom ,
747  pstrUsageACFullScreenView ,
748  pstrUsageACNormalView ,
749  pstrUsageACViewToggle ,
750  pstrUsageACScrollUp ,
751  pstrUsageACScrollDown ,
752  pstrUsageACScroll ,
753  pstrUsageACPanLeft ,
754  pstrUsageACPanRight ,
755  pstrUsageACPan ,
756  pstrUsageACNewWindow ,
757  pstrUsageACTileHoriz ,
758  pstrUsageACTileVert ,
759  pstrUsageACFormat ,
760  pstrUsageACEdit ,
761  pstrUsageACBold ,
762  pstrUsageACItalics ,
763  pstrUsageACUnderline ,
764  pstrUsageACStrikethrough ,
765  pstrUsageACSubscript ,
766  pstrUsageACSuperscript ,
767  pstrUsageACAllCaps ,
768  pstrUsageACRotate ,
769  pstrUsageACResize ,
770  pstrUsageACFlipHorizontal ,
771  pstrUsageACFlipVertical ,
772  pstrUsageACMirrorHorizontal ,
773  pstrUsageACMirrorVertical ,
774  pstrUsageACFontSelect ,
775  pstrUsageACFontColor ,
776  pstrUsageACFontSize ,
777  pstrUsageACJustifyLeft ,
778  pstrUsageACJustifyCenterH ,
779  pstrUsageACJustifyRight ,
780  pstrUsageACJustifyBlockH ,
781  pstrUsageACJustifyTop ,
782  pstrUsageACJustifyCenterV ,
783  pstrUsageACJustifyBottom ,
784  pstrUsageACJustifyBlockV ,
785  pstrUsageACIndentDecrease ,
786  pstrUsageACIndentIncrease ,
787  pstrUsageACNumberedList ,
788  pstrUsageACRestartNumbering ,
789  pstrUsageACBulletedList ,
790  pstrUsageACPromote ,
791  pstrUsageACDemote ,
792  pstrUsageACYes ,
793  pstrUsageACNo ,
794  pstrUsageACCancel ,
795  pstrUsageACCatalog ,
796  pstrUsageACBuyChkout ,
797  pstrUsageACAddToCart ,
798  pstrUsageACExpand ,
799  pstrUsageACExpandAll ,
800  pstrUsageACCollapse ,
801  pstrUsageACCollapseAll ,
802  pstrUsageACPrintPreview ,
803  pstrUsageACPasteSpecial ,
804  pstrUsageACInsertMode ,
805  pstrUsageACDelete ,
806  pstrUsageACLock ,
807  pstrUsageACUnlock ,
808  pstrUsageACProtect ,
809  pstrUsageACUnprotect ,
810  pstrUsageACAttachComment ,
811  pstrUsageACDeleteComment ,
812  pstrUsageACViewComment ,
813  pstrUsageACSelectWord ,
814  pstrUsageACSelectSentence ,
815  pstrUsageACSelectParagraph ,
816  pstrUsageACSelectColumn ,
817  pstrUsageACSelectRow ,
818  pstrUsageACSelectTable ,
819  pstrUsageACSelectObject ,
820  pstrUsageACRedoRepeat ,
821  pstrUsageACSort ,
822  pstrUsageACSortAscending ,
823  pstrUsageACSortDescending ,
824  pstrUsageACFilter ,
825  pstrUsageACSetClock ,
826  pstrUsageACViewClock ,
827  pstrUsageACSelectTimeZone ,
828  pstrUsageACEditTimeZone ,
829  pstrUsageACSetAlarm ,
830  pstrUsageACClearAlarm ,
831  pstrUsageACSnoozeAlarm ,
832  pstrUsageACResetAlarm ,
833  pstrUsageACSyncronize ,
834  pstrUsageACSendReceive ,
835  pstrUsageACSendTo ,
836  pstrUsageACReply ,
837  pstrUsageACReplyAll ,
838  pstrUsageACForwardMessage ,
839  pstrUsageACSend ,
840  pstrUsageACAttachFile ,
841  pstrUsageACUpload ,
842  pstrUsageACDownload ,
843  pstrUsageACSetBorders ,
844  pstrUsageACInsertRow ,
845  pstrUsageACInsertColumn ,
846  pstrUsageACInsertFile ,
847  pstrUsageACInsertPicture ,
848  pstrUsageACInsertObject ,
849  pstrUsageACInsertSymbol ,
850  pstrUsageACSaveAndClose ,
851  pstrUsageACRename ,
852  pstrUsageACMerge ,
853  pstrUsageACSplit ,
854  pstrUsageACDistributeHorizontaly ,
855  pstrUsageACDistributeVerticaly
856 };
858 {
859  pstrUsageDigitizer ,
860  pstrUsagePen ,
861  pstrUsageLightPen ,
862  pstrUsageTouchScreen ,
863  pstrUsageTouchPad ,
864  pstrUsageWhiteBoard ,
865  pstrUsageCoordinateMeasuringMachine ,
866  pstrUsage3DDigitizer ,
867  pstrUsageStereoPlotter ,
868  pstrUsageArticulatedArm ,
869  pstrUsageArmature ,
870  pstrUsageMultiplePointDigitizer ,
871  pstrUsageFreeSpaceWand
872 };
874 {
875  pstrUsageStylus ,
876  pstrUsagePuck ,
877  pstrUsageFinger
878 
879 };
881 {
882  pstrUsageTipPressure ,
883  pstrUsageBarrelPressure ,
884  pstrUsageInRange ,
885  pstrUsageTouch ,
886  pstrUsageUntouch ,
887  pstrUsageTap ,
888  pstrUsageQuality ,
889  pstrUsageDataValid ,
890  pstrUsageTransducerIndex ,
891  pstrUsageTabletFunctionKeys ,
892  pstrUsageProgramChangeKeys ,
893  pstrUsageBatteryStrength ,
894  pstrUsageInvert ,
895  pstrUsageXTilt ,
896  pstrUsageYTilt ,
897  pstrUsageAzimuth ,
898  pstrUsageAltitude ,
899  pstrUsageTwist ,
900  pstrUsageTipSwitch ,
901  pstrUsageSecondaryTipSwitch ,
902  pstrUsageBarrelSwitch ,
903  pstrUsageEraser ,
904  pstrUsageTabletPick
905 };
907 {
908  pstrUsageAlphanumericDisplay,
909  pstrUsageBitmappedDisplay
910 };
912 {
913  pstrUsageDisplayAttributesReport ,
914  pstrUsageASCIICharacterSet ,
915  pstrUsageDataReadBack ,
916  pstrUsageFontReadBack ,
917  pstrUsageDisplayControlReport ,
918  pstrUsageClearDisplay ,
919  pstrUsageDisplayEnable ,
920  pstrUsageScreenSaverDelay ,
921  pstrUsageScreenSaverEnable ,
922  pstrUsageVerticalScroll ,
923  pstrUsageHorizontalScroll ,
924  pstrUsageCharacterReport ,
925  pstrUsageDisplayData ,
926  pstrUsageDisplayStatus ,
927  pstrUsageStatusNotReady ,
928  pstrUsageStatusReady ,
929  pstrUsageErrorNotALoadableCharacter ,
930  pstrUsageErrorFotDataCanNotBeRead ,
931  pstrUsageCursorPositionReport ,
932  pstrUsageRow ,
933  pstrUsageColumn ,
934  pstrUsageRows ,
935  pstrUsageColumns ,
936  pstrUsageCursorPixelPosition ,
937  pstrUsageCursorMode ,
938  pstrUsageCursorEnable ,
939  pstrUsageCursorBlink ,
940  pstrUsageFontReport ,
941  pstrUsageFontData ,
942  pstrUsageCharacterWidth ,
943  pstrUsageCharacterHeight ,
944  pstrUsageCharacterSpacingHorizontal ,
945  pstrUsageCharacterSpacingVertical ,
946  pstrUsageUnicodeCharset ,
947  pstrUsageFont7Segment ,
948  pstrUsage7SegmentDirectMap ,
949  pstrUsageFont14Segment ,
950  pstrUsage14SegmentDirectMap ,
951  pstrUsageDisplayBrightness ,
952  pstrUsageDisplayContrast ,
953  pstrUsageCharacterAttribute ,
954  pstrUsageAttributeReadback ,
955  pstrUsageAttributeData ,
956  pstrUsageCharAttributeEnhance ,
957  pstrUsageCharAttributeUnderline ,
958  pstrUsageCharAttributeBlink
959 };
961 {
962  pstrUsageBitmapSizeX ,
963  pstrUsageBitmapSizeY ,
964  pstrUsagePageReserved ,
965  pstrUsageBitDepthFormat ,
966  pstrUsageDisplayOrientation ,
967  pstrUsagePaletteReport ,
968  pstrUsagePaletteDataSize ,
969  pstrUsagePaletteDataOffset ,
970  pstrUsagePaletteData ,
971  pstrUsageBlitReport ,
972  pstrUsageBlitRectangleX1 ,
973  pstrUsageBlitRectangleY1 ,
974  pstrUsageBlitRectangleX2 ,
975  pstrUsageBlitRectangleY2 ,
976  pstrUsageBlitData ,
977  pstrUsageSoftButton ,
978  pstrUsageSoftButtonID ,
979  pstrUsageSoftButtonSide ,
980  pstrUsageSoftButtonOffset1 ,
981  pstrUsageSoftButtonOffset2 ,
982  pstrUsageSoftButtonReport
983 };
985 {
986  pstrUsageVCRAcquisition ,
987  pstrUsageFreezeThaw ,
988  pstrUsageClipStore ,
989  pstrUsageUpdate ,
990  pstrUsageNext ,
991  pstrUsageSave ,
992  pstrUsagePrint ,
993  pstrUsageMicrophoneEnable
994 };
996 {
997  pstrUsageCine ,
998  pstrUsageTransmitPower ,
999  pstrUsageVolume ,
1000  pstrUsageFocus ,
1001  pstrUsageDepth
1002 };
1004 {
1005  pstrUsageSoftStepPrimary ,
1006  pstrUsageSoftStepSecondary
1007 };
1009 {
1010  pstrUsageZoomSelect ,
1011  pstrUsageZoomAdjust ,
1012  pstrUsageSpectralDopplerModeSelect ,
1013  pstrUsageSpectralDopplerModeAdjust ,
1014  pstrUsageColorDopplerModeSelect ,
1015  pstrUsageColorDopplerModeAdjust ,
1016  pstrUsageMotionModeSelect ,
1017  pstrUsageMotionModeAdjust ,
1018  pstrUsage2DModeSelect ,
1019  pstrUsage2DModeAdjust
1020 };
1022 {
1023  pstrUsageSoftControlSelect ,
1024  pstrUsageSoftControlAdjust
1025 };
1026 
1027 void ReportDescParserBase::Parse(const uint16_t len, const uint8_t *pbuf, const uint16_t &offset)
1028 {
1029  uint16_t cntdn = (uint16_t)len;
1030  uint8_t *p = (uint8_t*)pbuf;
1031 
1032 
1033  totalSize = 0;
1034 
1035  while(cntdn)
1036  {
1037  //Serial.println("");
1038  //PrintHex<uint16_t>(offset + len - cntdn);
1039  //Serial.print(":");
1040 
1041  ParseItem(&p, &cntdn);
1042 
1043  //if (ParseItem(&p, &cntdn))
1044  // return;
1045  }
1046  //USBTRACE2("Total:", totalSize);
1047 }
1048 
1049 void ReportDescParserBase::PrintValue(uint8_t *p, uint8_t len)
1050 {
1051  Notify(PSTR("("));
1052  for (; len; p++, len--)
1053  PrintHex<uint8_t>(*p);
1054  Notify(PSTR(")"));
1055 }
1056 
1058 {
1059  Notify(PSTR("("));
1060  PrintHex<uint8_t>(data);
1061  Notify(PSTR(")"));
1062 }
1063 
1065 {
1066  switch (prefix & (TYPE_MASK | TAG_MASK))
1067  {
1068  case (TYPE_GLOBAL | TAG_GLOBAL_PUSH):
1069  Notify(PSTR("\r\nPush"));
1070  break;
1071  case (TYPE_GLOBAL | TAG_GLOBAL_POP):
1072  Notify(PSTR("\r\nPop"));
1073  break;
1075  Notify(PSTR("\r\nUsage Page"));
1076  break;
1078  Notify(PSTR("\r\nLogical Min"));
1079  break;
1081  Notify(PSTR("\r\nLogical Max"));
1082  break;
1084  Notify(PSTR("\r\nPhysical Min"));
1085  break;
1087  Notify(PSTR("\r\nPhysical Max"));
1088  break;
1090  Notify(PSTR("\r\nUnit Exp"));
1091  break;
1092  case (TYPE_GLOBAL | TAG_GLOBAL_UNIT):
1093  Notify(PSTR("\r\nUnit"));
1094  break;
1096  Notify(PSTR("\r\nReport Size"));
1097  break;
1099  Notify(PSTR("\r\nReport Count"));
1100  break;
1102  Notify(PSTR("\r\nReport Id"));
1103  break;
1104  case (TYPE_LOCAL | TAG_LOCAL_USAGE):
1105  Notify(PSTR("\r\nUsage"));
1106  break;
1107  case (TYPE_LOCAL | TAG_LOCAL_USAGEMIN):
1108  Notify(PSTR("\r\nUsage Min"));
1109  break;
1110  case (TYPE_LOCAL | TAG_LOCAL_USAGEMAX):
1111  Notify(PSTR("\r\nUsage Max"));
1112  break;
1113  case (TYPE_MAIN | TAG_MAIN_COLLECTION):
1114  Notify(PSTR("\r\nCollection"));
1115  break;
1117  Notify(PSTR("\r\nEnd Collection"));
1118  break;
1119  case (TYPE_MAIN | TAG_MAIN_INPUT):
1120  Notify(PSTR("\r\nInput"));
1121  break;
1122  case (TYPE_MAIN | TAG_MAIN_OUTPUT):
1123  Notify(PSTR("\r\nOutput"));
1124  break;
1125  case (TYPE_MAIN | TAG_MAIN_FEATURE):
1126  Notify(PSTR("\r\nFeature"));
1127  break;
1128  } // switch (**pp & (TYPE_MASK | TAG_MASK))
1129 }
1130 uint8_t ReportDescParserBase::ParseItem(uint8_t **pp, uint16_t *pcntdn)
1131 {
1132  uint8_t ret = enErrorSuccess;
1133 
1134  switch (itemParseState)
1135  {
1136  case 0:
1137  if (**pp == HID_LONG_ITEM_PREFIX)
1138  USBTRACE("\r\nLONG\r\n");
1139  else
1140  {
1141  uint8_t size = ((**pp) & DATA_SIZE_MASK);
1142 
1143  itemPrefix = (**pp);
1144  itemSize = 1 + ((size == DATA_SIZE_4) ? 4 : size);
1145 
1147  }
1148  (*pp) ++;
1149  (*pcntdn) --;
1150  itemSize --;
1151  itemParseState = 1;
1152 
1153  if (!itemSize)
1154  break;
1155 
1156  if (!pcntdn)
1157  return enErrorIncomplete;
1158  case 1:
1159  //USBTRACE2("\r\niSz:",itemSize);
1160 
1163  itemParseState = 2;
1164  case 2:
1165  if (!valParser.Parse(pp, pcntdn))
1166  return enErrorIncomplete;
1167  itemParseState = 3;
1168  case 3:
1169  {
1170  uint8_t data = *((uint8_t*)varBuffer);
1171 
1172  switch (itemPrefix & (TYPE_MASK | TAG_MASK))
1173  {
1174  case (TYPE_LOCAL | TAG_LOCAL_USAGE):
1175  if (pfUsage)
1176  if (theBuffer.valueSize > 1)
1177  pfUsage(*((uint16_t*)varBuffer));
1178  else
1179  pfUsage(data);
1180  break;
1182  rptSize = data;
1183  PrintByteValue(data);
1184  break;
1186  rptCount = data;
1187  PrintByteValue(data);
1188  break;
1194  case (TYPE_LOCAL | TAG_LOCAL_USAGEMIN):
1195  case (TYPE_LOCAL | TAG_LOCAL_USAGEMAX):
1197  case (TYPE_GLOBAL | TAG_GLOBAL_UNIT):
1199  break;
1200  case (TYPE_GLOBAL | TAG_GLOBAL_PUSH):
1201  case (TYPE_GLOBAL | TAG_GLOBAL_POP):
1202  break;
1204  SetUsagePage(data);
1205  PrintUsagePage(data);
1206  PrintByteValue(data);
1207  break;
1208  case (TYPE_MAIN | TAG_MAIN_COLLECTION):
1210  switch (data)
1211  {
1212  case 0x00:
1213  Notify(PSTR(" Physical"));
1214  break;
1215  case 0x01:
1216  Notify(PSTR(" Application"));
1217  break;
1218  case 0x02:
1219  Notify(PSTR(" Logical"));
1220  break;
1221  case 0x03:
1222  Notify(PSTR(" Report"));
1223  break;
1224  case 0x04:
1225  Notify(PSTR(" Named Array"));
1226  break;
1227  case 0x05:
1228  Notify(PSTR(" Usage Switch"));
1229  break;
1230  case 0x06:
1231  Notify(PSTR(" Usage Modifier"));
1232  break;
1233  default:
1234  Notify(PSTR(" Vendor Defined("));
1235  PrintHex<uint8_t>(data);
1236  Notify(PSTR(")"));
1237  }
1238  break;
1239  case (TYPE_MAIN | TAG_MAIN_INPUT):
1240  case (TYPE_MAIN | TAG_MAIN_OUTPUT):
1241  case (TYPE_MAIN | TAG_MAIN_FEATURE):
1242  totalSize += (uint16_t)rptSize * (uint16_t)rptCount;
1243  rptSize = 0;
1244  rptCount = 0;
1245  Notify(PSTR("("));
1246  PrintBin<uint8_t>(data);
1247  Notify(PSTR(")"));
1248  break;
1249  } // switch (**pp & (TYPE_MASK | TAG_MASK))
1250  }
1251  } // switch (itemParseState)
1252  itemParseState = 0;
1253  return enErrorSuccess;
1254 }
1255 
1257 {
1264  NULL, // Keyboard/Keypad
1271  NULL, // Reserved
1272  NULL, // PID
1273  NULL // Unicode
1274 };
1275 
1277 {
1278  pfUsage = NULL;
1279 
1280  if (page > 0x00 && page < 0x11)
1281  pfUsage = /*(UsagePageFunc)pgm_read_word*/(usagePageFunctions[page - 1]);
1282  //else if (page > 0x7f && page < 0x84)
1283  // Notify(pstrUsagePageMonitor);
1284  //else if (page > 0x83 && page < 0x8c)
1285  // Notify(pstrUsagePagePower);
1286  //else if (page > 0x8b && page < 0x92)
1287  // Notify((char*)pgm_read_word(&usagePageTitles1[page - 0x8c]));
1288  //else if (page > 0xfeff && page <= 0xffff)
1289  // Notify(pstrUsagePageVendorDefined);
1290  else
1291  switch (page)
1292  {
1293  case 0x14:
1295  break;
1296  case 0x40:
1298  break;
1299  }
1300 }
1301 
1303 {
1304  Notify(pstrSpace);
1305 
1306  if (page > 0x00 && page < 0x11)
1307  Notify((char*)pgm_read_word(&usagePageTitles0[page - 1]));
1308  else if (page > 0x7f && page < 0x84)
1309  Notify(pstrUsagePageMonitor);
1310  else if (page > 0x83 && page < 0x8c)
1311  Notify(pstrUsagePagePower);
1312  else if (page > 0x8b && page < 0x92)
1313  Notify((char*)pgm_read_word(&usagePageTitles1[page - 0x8c]));
1314  else if (page > 0xfeff && page <= 0xffff)
1315  Notify(pstrUsagePageVendorDefined);
1316  else
1317  switch (page)
1318  {
1319  case 0x14:
1320  Notify(pstrUsagePageAlphaNumericDisplay);
1321  break;
1322  case 0x40:
1323  Notify(pstrUsagePageMedicalInstruments);
1324  break;
1325  default:
1326  Notify(pstrUsagePageUndefined);
1327  }
1328 }
1329 
1331 {
1332  Notify(pstrSpace);
1333  Notify(PSTR("Btn"));
1334  Serial.print(usage, HEX);
1335 }
1336 
1338 {
1339  Notify(pstrSpace);
1340  Notify(PSTR("Inst"));
1341  Serial.print(usage, DEC);
1342 }
1343 
1345 {
1346  Notify(pstrSpace);
1347 
1348  if (usage > 0x00 && usage < 0x0a)
1349  Notify((char*)pgm_read_word(&genDesktopTitles0[usage - 1]));
1350  else if (usage > 0x2f && usage < 0x49)
1351  Notify((char*)pgm_read_word(&genDesktopTitles1[usage - 0x30]));
1352  else if (usage > 0x7f && usage < 0x94)
1353  Notify((char*)pgm_read_word(&genDesktopTitles2[usage - 0x80]));
1354  else if (usage > 0x9f && usage < 0xa9)
1355  Notify((char*)pgm_read_word(&genDesktopTitles3[usage - 0xa0]));
1356  else if (usage > 0xaf && usage < 0xb8)
1357  Notify((char*)pgm_read_word(&genDesktopTitles4[usage - 0xb0]));
1358  else
1359  Notify(pstrUsagePageUndefined);
1360 }
1361 
1363 {
1364  Notify(pstrSpace);
1365 
1366  if (usage > 0x00 && usage < 0x0d)
1367  Notify((char*)pgm_read_word(&simuTitles0[usage - 1]));
1368  else if (usage > 0x1f && usage < 0x26)
1369  Notify((char*)pgm_read_word(&simuTitles1[usage - 0x20]));
1370  else if (usage > 0xaf && usage < 0xd1)
1371  Notify((char*)pgm_read_word(&simuTitles2[usage - 0xb0]));
1372  else
1373  Notify(pstrUsagePageUndefined);
1374 }
1375 
1377 {
1378  Notify(pstrSpace);
1379 
1380  if (usage > 0x00 && usage < 0x0b)
1381  Notify((char*)pgm_read_word(&vrTitles0[usage - 1]));
1382  else if (usage > 0x1f && usage < 0x22)
1383  Notify((char*)pgm_read_word(&vrTitles1[usage - 0x20]));
1384  else
1385  Notify(pstrUsagePageUndefined);
1386 }
1387 
1389 {
1390  Notify(pstrSpace);
1391 
1392  if (usage > 0x00 && usage < 0x05)
1393  Notify((char*)pgm_read_word(&sportsCtrlTitles0[usage - 1]));
1394  else if (usage > 0x2f && usage < 0x3a)
1395  Notify((char*)pgm_read_word(&sportsCtrlTitles1[usage - 0x30]));
1396  else if (usage > 0x4f && usage < 0x64)
1397  Notify((char*)pgm_read_word(&sportsCtrlTitles2[usage - 0x50]));
1398  else
1399  Notify(pstrUsagePageUndefined);
1400 }
1401 
1403 {
1404  Notify(pstrSpace);
1405 
1406  if (usage > 0x00 && usage < 0x04)
1407  Notify((char*)pgm_read_word(&gameTitles0[usage - 1]));
1408  else if (usage > 0x1f && usage < 0x3a)
1409  Notify((char*)pgm_read_word(&gameTitles1[usage - 0x20]));
1410  else
1411  Notify(pstrUsagePageUndefined);
1412 }
1413 
1415 {
1416  Notify(pstrSpace);
1417 
1418  if (usage > 0x1f && usage < 0x27)
1419  Notify((char*)pgm_read_word(&genDevCtrlTitles[usage - 0x20]));
1420  else
1421  Notify(pstrUsagePageUndefined);
1422 }
1423 
1425 {
1426  Notify(pstrSpace);
1427 
1428  if (usage > 0x00 && usage < 0x4e)
1429  Notify((char*)pgm_read_word(&ledTitles[usage - 1]));
1430  else
1431  Notify(pstrUsagePageUndefined);
1432 }
1433 
1435 {
1436  Notify(pstrSpace);
1437 
1438  if (usage > 0x00 && usage < 0x08)
1439  Notify((char*)pgm_read_word(&telTitles0[usage - 1]));
1440  else if (usage > 0x1f && usage < 0x32)
1441  Notify((char*)pgm_read_word(&telTitles1[usage - 0x1f]));
1442  else if (usage > 0x4f && usage < 0x54)
1443  Notify((char*)pgm_read_word(&telTitles2[usage - 0x4f]));
1444  else if (usage > 0x6f && usage < 0x75)
1445  Notify((char*)pgm_read_word(&telTitles3[usage - 0x6f]));
1446  else if (usage > 0x8f && usage < 0x9f)
1447  Notify((char*)pgm_read_word(&telTitles4[usage - 0x8f]));
1448  else if (usage > 0xaf && usage < 0xc0)
1449  Notify((char*)pgm_read_word(&telTitles5[usage - 0xaf]));
1450  else
1451  Notify(pstrUsagePageUndefined);
1452 }
1453 
1455 {
1456  Notify(pstrSpace);
1457 
1458  if (usage > 0x00 && usage < 0x07)
1459  Notify((char*)pgm_read_word(&consTitles0[usage - 1]));
1460  else if (usage > 0x1f && usage < 0x23)
1461  Notify((char*)pgm_read_word(&consTitles1[usage - 0x1f]));
1462  else if (usage > 0x2f && usage < 0x37)
1463  Notify((char*)pgm_read_word(&consTitles2[usage - 0x2f]));
1464  else if (usage > 0x3f && usage < 0x49)
1465  Notify((char*)pgm_read_word(&consTitles3[usage - 0x3f]));
1466  else if (usage > 0x5f && usage < 0x67)
1467  Notify((char*)pgm_read_word(&consTitles4[usage - 0x5f]));
1468  else if (usage > 0x7f && usage < 0xa5)
1469  Notify((char*)pgm_read_word(&consTitles5[usage - 0x7f]));
1470  else if (usage > 0xaf && usage < 0xcf)
1471  Notify((char*)pgm_read_word(&consTitles6[usage - 0xaf]));
1472  else if (usage > 0xdf && usage < 0xeb)
1473  Notify((char*)pgm_read_word(&consTitles7[usage - 0xdf]));
1474  else if (usage > 0xef && usage < 0xf6)
1475  Notify((char*)pgm_read_word(&consTitles8[usage - 0xef]));
1476  else if (usage > 0xff && usage < 0x10e)
1477  Notify((char*)pgm_read_word(&consTitles9[usage - 0xff]));
1478  else if (usage > 0x14f && usage < 0x156)
1479  Notify((char*)pgm_read_word(&consTitlesA[usage - 0x14f]));
1480  else if (usage > 0x15f && usage < 0x16b)
1481  Notify((char*)pgm_read_word(&consTitlesB[usage - 0x15f]));
1482  else if (usage > 0x16f && usage < 0x175)
1483  Notify((char*)pgm_read_word(&consTitlesC[usage - 0x16f]));
1484  else if (usage > 0x17f && usage < 0x1c8)
1485  Notify((char*)pgm_read_word(&consTitlesD[usage - 0x17f]));
1486  else if (usage > 0x1ff && usage < 0x29d)
1487  Notify((char*)pgm_read_word(&consTitlesE[usage - 0x1ff]));
1488  else
1489  Notify(pstrUsagePageUndefined);
1490 }
1491 
1493 {
1494  Notify(pstrSpace);
1495 
1496  if (usage > 0x00 && usage < 0x0e)
1497  Notify((char*)pgm_read_word(&digitTitles0[usage - 1]));
1498  else if (usage > 0x1f && usage < 0x23)
1499  Notify((char*)pgm_read_word(&digitTitles1[usage - 0x1f]));
1500  else if (usage > 0x2f && usage < 0x47)
1501  Notify((char*)pgm_read_word(&digitTitles2[usage - 0x2f]));
1502  else
1503  Notify(pstrUsagePageUndefined);
1504 }
1505 
1507 {
1508  Notify(pstrSpace);
1509 
1510  if (usage > 0x00 && usage < 0x03)
1511  Notify((char*)pgm_read_word(&aplphanumTitles0[usage - 1]));
1512  else if (usage > 0x1f && usage < 0x4e)
1513  Notify((char*)pgm_read_word(&aplphanumTitles1[usage - 0x1f]));
1514  else if (usage > 0x7f && usage < 0x96)
1515  Notify((char*)pgm_read_word(&digitTitles2[usage - 0x80]));
1516  else
1517  Notify(pstrUsagePageUndefined);
1518 }
1519 
1521 {
1522  Notify(pstrSpace);
1523 
1524  if (usage == 1)
1525  Notify(pstrUsageMedicalUltrasound);
1526  else if (usage > 0x1f && usage < 0x28)
1527  Notify((char*)pgm_read_word(&medInstrTitles0[usage - 0x1f]));
1528  else if (usage > 0x3f && usage < 0x45)
1529  Notify((char*)pgm_read_word(&medInstrTitles1[usage - 0x40]));
1530  else if (usage > 0x5f && usage < 0x62)
1531  Notify((char*)pgm_read_word(&medInstrTitles2[usage - 0x60]));
1532  else if (usage == 0x70)
1533  Notify(pstrUsageDepthGainCompensation);
1534  else if (usage > 0x7f && usage < 0x8a)
1535  Notify((char*)pgm_read_word(&medInstrTitles3[usage - 0x80]));
1536  else if (usage > 0x9f && usage < 0xa2)
1537  Notify((char*)pgm_read_word(&medInstrTitles4[usage - 0xa0]));
1538  else
1539  Notify(pstrUsagePageUndefined);
1540 }
1541 
1542 
1543 
1544 
1545 
1546 uint8_t ReportDescParser2::ParseItem(uint8_t **pp, uint16_t *pcntdn)
1547 {
1548  uint8_t ret = enErrorSuccess;
1549 
1550  switch (itemParseState)
1551  {
1552  case 0:
1553  if (**pp == HID_LONG_ITEM_PREFIX)
1554  USBTRACE("\r\nLONG\r\n");
1555  else
1556  {
1557  uint8_t size = ((**pp) & DATA_SIZE_MASK);
1558  itemPrefix = (**pp);
1559  itemSize = 1 + ((size == DATA_SIZE_4) ? 4 : size);
1560  }
1561  (*pp) ++;
1562  (*pcntdn) --;
1563  itemSize --;
1564  itemParseState = 1;
1565 
1566  if (!itemSize)
1567  break;
1568 
1569  if (!pcntdn)
1570  return enErrorIncomplete;
1571  case 1:
1574  itemParseState = 2;
1575  case 2:
1576  if (!valParser.Parse(pp, pcntdn))
1577  return enErrorIncomplete;
1578  itemParseState = 3;
1579  case 3:
1580  {
1581  uint8_t data = *((uint8_t*)varBuffer);
1582 
1583  switch (itemPrefix & (TYPE_MASK | TAG_MASK))
1584  {
1585  case (TYPE_LOCAL | TAG_LOCAL_USAGE):
1586  if (pfUsage)
1587  if (theBuffer.valueSize > 1)
1588  pfUsage(*((uint16_t*)varBuffer));
1589  else
1590  pfUsage(data);
1591  break;
1593  rptSize = data;
1594  break;
1596  rptCount = data;
1597  break;
1599  rptId = data;
1600  break;
1601  case (TYPE_LOCAL | TAG_LOCAL_USAGEMIN):
1602  useMin = data;
1603  break;
1604  case (TYPE_LOCAL | TAG_LOCAL_USAGEMAX):
1605  useMax = data;
1606  break;
1608  SetUsagePage(data);
1609  break;
1610  case (TYPE_MAIN | TAG_MAIN_OUTPUT):
1611  case (TYPE_MAIN | TAG_MAIN_FEATURE):
1612  rptSize = 0;
1613  rptCount = 0;
1614  useMin = 0;
1615  useMax = 0;
1616  break;
1617  case (TYPE_MAIN | TAG_MAIN_INPUT):
1618  OnInputItem(data);
1619 
1620  totalSize += (uint16_t)rptSize * (uint16_t)rptCount;
1621 
1622  rptSize = 0;
1623  rptCount = 0;
1624  useMin = 0;
1625  useMax = 0;
1626  break;
1627  } // switch (**pp & (TYPE_MASK | TAG_MASK))
1628  }
1629  } // switch (itemParseState)
1630  itemParseState = 0;
1631  return enErrorSuccess;
1632 }
1633 
1634 void ReportDescParser2::OnInputItem(uint8_t itm)
1635 {
1636  uint8_t byte_offset = (totalSize >> 3); // calculate offset to the next unhandled byte i = (int)(totalCount / 8);
1637  uint32_t tmp = (byte_offset << 3);
1638  uint8_t bit_offset = totalSize - tmp; // number of bits in the current byte already handled
1639  uint8_t *p = pBuf + byte_offset; // current byte pointer
1640 
1641  if (bit_offset)
1642  *p >>= bit_offset;
1643 
1644  uint8_t usage = useMin;
1645 
1646  bool print_usemin_usemax = ( (useMin < useMax) && ((itm & 3) == 2) && pfUsage) ? true : false;
1647 
1648  uint8_t bits_of_byte = 8;
1649 
1650  // for each field in field array defined by rptCount
1651  for (uint8_t field=0; field<rptCount; field++, usage++)
1652  {
1653  union
1654  {
1655  uint8_t bResult[4];
1656  uint16_t wResult[2];
1657  uint32_t dwResult;
1658  } result;
1659 
1660  result.dwResult = 0;
1661  uint8_t mask = 0;
1662 
1663  if (print_usemin_usemax)
1664  pfUsage(usage);
1665 
1666  // bits_left - number of bits in the field(array of fields, depending on Report Count) left to process
1667  // bits_of_byte - number of bits in current byte left to process
1668  // bits_to_copy - number of bits to copy to result buffer
1669 
1670  // for each bit in a field
1671  for (uint8_t bits_left=rptSize, bits_to_copy=0; bits_left;
1672  bits_left -= bits_to_copy)
1673  {
1674  bits_to_copy = (bits_left > bits_of_byte) ? bits_of_byte : bits_left;
1675 
1676  result.dwResult <<= bits_to_copy; // Result buffer is shifted by the number of bits to be copied into it
1677 
1678  uint8_t val = *p;
1679 
1680  val >>= (8 - bits_of_byte); // Shift by the number of bits already processed
1681 
1682  mask = 0;
1683 
1684  for (uint8_t j=bits_to_copy; j; j--)
1685  {
1686  mask <<= 1;
1687  mask |= 1;
1688  }
1689 
1690  result.bResult[0] = (result.bResult[0] | (val & mask));
1691 
1692  bits_of_byte -= bits_to_copy;
1693 
1694  if (bits_of_byte < 1)
1695  {
1696  bits_of_byte = 8;
1697  p ++;
1698  }
1699  }
1700  PrintByteValue(result.dwResult);
1701  }
1702  Serial.println("");
1703 }
1704 
1705 void UniversalReportParser::Parse(HID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf)
1706 {
1707  ReportDescParser2 prs(len, buf);
1708 
1709  uint8_t ret = hid->GetReportDescr(0, &prs);
1710 
1711  if (ret)
1712  ErrorMessage<uint8_t>(PSTR("GetReportDescr-2"), ret);
1713 }