1 /* Copyright (C) 2011 Circuits At Home, LTD. All rights reserved.
3 This software may be distributed and modified under the terms of the GNU
4 General Public License version 2 (GPL2) as published by the Free Software
5 Foundation and appearing in the file GPL2.TXT included in the packaging of
6 this file. Please note that GPL2 Section 2[b] requires that all works based
7 on this software must also be made publicly available under the terms of
14 Web : http://www.circuitsathome.com
15 e-mail : support@circuitsathome.com
18 #include "hidescriptorparser.h"
20 const char * const ReportDescParserBase::usagePageTitles0
[] PROGMEM
= {
21 pstrUsagePageGenericDesktopControls
,
22 pstrUsagePageSimulationControls
,
23 pstrUsagePageVRControls
,
24 pstrUsagePageSportControls
,
25 pstrUsagePageGameControls
,
26 pstrUsagePageGenericDeviceControls
,
27 pstrUsagePageKeyboardKeypad
,
31 pstrUsagePageTelephone
,
32 pstrUsagePageConsumer
,
33 pstrUsagePageDigitizer
,
38 const char * const ReportDescParserBase::usagePageTitles1
[] PROGMEM
= {
39 pstrUsagePageBarCodeScanner
,
41 pstrUsagePageMSRDevices
,
42 pstrUsagePagePointOfSale
,
43 pstrUsagePageCameraControl
,
46 const char * const ReportDescParserBase::genDesktopTitles0
[] PROGMEM
= {
53 pstrUsageMultiAxisController
,
54 pstrUsageTabletPCSystemControls
57 const char * const ReportDescParserBase::genDesktopTitles1
[] PROGMEM
= {
68 pstrUsageCountedBuffer
,
70 pstrUsageMotionWakeup
,
73 pstrUsagePageReserved
,
81 pstrUsageFeatureNotification
,
82 pstrUsageResolutionMultiplier
84 const char * const ReportDescParserBase::genDesktopTitles2
[] PROGMEM
= {
85 pstrUsageSystemControl
,
86 pstrUsageSystemPowerDown
,
88 pstrUsageSystemWakeup
,
89 pstrUsageSystemContextMenu
,
90 pstrUsageSystemMainMenu
,
91 pstrUsageSystemAppMenu
,
92 pstrUsageSystemMenuHelp
,
93 pstrUsageSystemMenuExit
,
94 pstrUsageSystemMenuSelect
,
95 pstrUsageSystemMenuRight
,
96 pstrUsageSystemMenuLeft
,
97 pstrUsageSystemMenuUp
,
98 pstrUsageSystemMenuDown
,
99 pstrUsageSystemColdRestart
,
100 pstrUsageSystemWarmRestart
,
106 const char * const ReportDescParserBase::genDesktopTitles3
[] PROGMEM
= {
108 pstrUsageSystemUndock
,
109 pstrUsageSystemSetup
,
110 pstrUsageSystemBreak
,
111 pstrUsageSystemDebuggerBreak
,
112 pstrUsageApplicationBreak
,
113 pstrUsageApplicationDebuggerBreak
,
114 pstrUsageSystemSpeakerMute
,
115 pstrUsageSystemHibernate
117 const char * const ReportDescParserBase::genDesktopTitles4
[] PROGMEM
= {
118 pstrUsageSystemDisplayInvert
,
119 pstrUsageSystemDisplayInternal
,
120 pstrUsageSystemDisplayExternal
,
121 pstrUsageSystemDisplayBoth
,
122 pstrUsageSystemDisplayDual
,
123 pstrUsageSystemDisplayToggleIntExt
,
124 pstrUsageSystemDisplaySwapPriSec
,
125 pstrUsageSystemDisplayLCDAutoscale
127 const char * const ReportDescParserBase::simuTitles0
[] PROGMEM
= {
128 pstrUsageFlightSimulationDevice
,
129 pstrUsageAutomobileSimulationDevice
,
130 pstrUsageTankSimulationDevice
,
131 pstrUsageSpaceshipSimulationDevice
,
132 pstrUsageSubmarineSimulationDevice
,
133 pstrUsageSailingSimulationDevice
,
134 pstrUsageMotocicleSimulationDevice
,
135 pstrUsageSportsSimulationDevice
,
136 pstrUsageAirplaneSimulationDevice
,
137 pstrUsageHelicopterSimulationDevice
,
138 pstrUsageMagicCarpetSimulationDevice
,
139 pstrUsageBicycleSimulationDevice
141 const char * const ReportDescParserBase::simuTitles1
[] PROGMEM
= {
142 pstrUsageFlightControlStick
,
143 pstrUsageFlightStick
,
144 pstrUsageCyclicControl
,
147 pstrUsageTrackControl
149 const char * const ReportDescParserBase::simuTitles2
[] PROGMEM
= {
151 pstrUsageAileronTrim
,
152 pstrUsageAntiTorqueControl
,
153 pstrUsageAutopilotEnable
,
154 pstrUsageChaffRelease
,
155 pstrUsageCollectiveControl
,
157 pstrUsageElectronicCountermeasures
,
159 pstrUsageElevatorTrim
,
162 pstrUsageFlightCommunications
,
163 pstrUsageFlareRelease
,
164 pstrUsageLandingGear
,
168 pstrUsageWeaponsSelect
,
170 pstrUsageAccelerator
,
175 pstrUsageTurretDirection
,
176 pstrUsageBarrelElevation
,
179 pstrUsageBicycleCrank
,
184 const char * const ReportDescParserBase::vrTitles0
[] PROGMEM
= {
189 pstrUsageHeadTracker
,
190 pstrUsageHeadMountedDisplay
,
191 pstrUsageHandTracker
,
194 pstrUsageAnimatronicDevice
196 const char * const ReportDescParserBase::vrTitles1
[] PROGMEM
= {
197 pstrUsageStereoEnable
,
198 pstrUsageDisplayEnable
200 const char * const ReportDescParserBase::sportsCtrlTitles0
[] PROGMEM
= {
201 pstrUsageBaseballBat
,
203 pstrUsageRowingMachine
,
206 const char * const ReportDescParserBase::sportsCtrlTitles1
[] PROGMEM
= {
211 pstrUsageStickFaceAngle
,
212 pstrUsageStickHeelToe
,
213 pstrUsageStickFollowThough
,
218 const char * const ReportDescParserBase::sportsCtrlTitles2
[] PROGMEM
= {
240 const char * const ReportDescParserBase::gameTitles0
[] PROGMEM
= {
241 pstrUsage3DGameController
,
242 pstrUsagePinballDevice
,
245 const char * const ReportDescParserBase::gameTitles1
[] PROGMEM
= {
246 pstrUsagePointOfView
,
247 pstrUsageTurnRightLeft
,
248 pstrUsagePitchForwardBackward
,
249 pstrUsageRollRightLeft
,
250 pstrUsageMoveRightLeft
,
251 pstrUsageMoveForwardBackward
,
253 pstrUsageLeanRightLeft
,
254 pstrUsageLeanForwardBackward
,
255 pstrUsageHeightOfPOV
,
257 pstrUsageSecondaryFlipper
,
264 pstrUsageGunSelector
,
265 pstrUsageGunSingleShot
,
267 pstrUsageGunAutomatic
,
269 pstrUsageGamepadFireJump
,
270 pstrUsageGamepadTrigger
272 const char * const ReportDescParserBase::genDevCtrlTitles
[] PROGMEM
= {
273 pstrUsageBatteryStrength
,
274 pstrUsageWirelessChannel
,
276 pstrUsageDiscoverWirelessControl
,
277 pstrUsageSecurityCodeCharEntered
,
278 pstrUsageSecurityCodeCharErased
,
279 pstrUsageSecurityCodeCleared
281 const char * const ReportDescParserBase::ledTitles
[] PROGMEM
= {
289 pstrUsageDoNotDisturb
,
292 pstrUsageHighCutFilter
,
293 pstrUsageLowCutFilter
,
294 pstrUsageEqualizerEnable
,
295 pstrUsageSoundFieldOn
,
299 pstrUsageSamplingRateDetect
,
303 pstrUsageRecordingFormatDetect
,
306 pstrUsageMessageWaiting
,
308 pstrUsageBatteryOperation
,
334 pstrUsageFastForward
,
339 pstrUsageSelectedIndicator
,
340 pstrUsageInUseIndicator
,
341 pstrUsageMultiModeIndicator
,
342 pstrUsageIndicatorOn
,
343 pstrUsageIndicatorFlash
,
344 pstrUsageIndicatorSlowBlink
,
345 pstrUsageIndicatorFastBlink
,
346 pstrUsageIndicatorOff
,
347 pstrUsageFlashOnTime
,
348 pstrUsageSlowBlinkOnTime
,
349 pstrUsageSlowBlinkOffTime
,
350 pstrUsageFastBlinkOnTime
,
351 pstrUsageFastBlinkOffTime
,
352 pstrUsageIndicatorColor
,
353 pstrUsageIndicatorRed
,
354 pstrUsageIndicatorGreen
,
355 pstrUsageIndicatorAmber
,
356 pstrUsageGenericIndicator
,
357 pstrUsageSystemSuspend
,
358 pstrUsageExternalPowerConnected
360 const char * const ReportDescParserBase::telTitles0
[] PROGMEM
= {
362 pstrUsageAnsweringMachine
,
363 pstrUsageMessageControls
,
366 pstrUsageTelephonyKeyPad
,
367 pstrUsageProgrammableButton
369 const char * const ReportDescParserBase::telTitles1
[] PROGMEM
= {
378 pstrUsageForwardCalls
,
379 pstrUsageAlternateFunction
,
381 pstrUsageSpeakerPhone
,
389 const char * const ReportDescParserBase::telTitles2
[] PROGMEM
= {
391 pstrUsageStoreNumber
,
392 pstrUsageRecallNumber
,
393 pstrUsagePhoneDirectory
395 const char * const ReportDescParserBase::telTitles3
[] PROGMEM
= {
397 pstrUsageScreenCalls
,
398 pstrUsageDoNotDisturb
,
402 const char * const ReportDescParserBase::telTitles4
[] PROGMEM
= {
403 pstrUsageInsideDialTone
,
404 pstrUsageOutsideDialTone
,
405 pstrUsageInsideRingTone
,
406 pstrUsageOutsideRingTone
,
407 pstrUsagePriorityRingTone
,
408 pstrUsageInsideRingback
,
409 pstrUsagePriorityRingback
,
410 pstrUsageLineBusyTone
,
411 pstrUsageReorderTone
,
412 pstrUsageCallWaitingTone
,
413 pstrUsageConfirmationTone1
,
414 pstrUsageConfirmationTone2
,
416 pstrUsageOutsideRingback
,
419 const char * const ReportDescParserBase::telTitles5
[] PROGMEM
= {
430 pstrUsagePhoneKeyStar
,
431 pstrUsagePhoneKeyPound
,
437 const char * const ReportDescParserBase::consTitles0
[] PROGMEM
= {
438 pstrUsageConsumerControl
,
439 pstrUsageNumericKeyPad
,
440 pstrUsageProgrammableButton
,
443 pstrUsageGraphicEqualizer
445 const char * const ReportDescParserBase::consTitles1
[] PROGMEM
= {
450 const char * const ReportDescParserBase::consTitles2
[] PROGMEM
= {
456 pstrUsageIllumination
,
457 pstrUsageFunctionButtons
460 const char * const ReportDescParserBase::consTitles3
[] PROGMEM
= {
468 pstrUsageMenuValueIncrease
,
469 pstrUsageMenuValueDecrease
471 const char * const ReportDescParserBase::consTitles4
[] PROGMEM
= {
472 pstrUsageDataOnScreen
,
473 pstrUsageClosedCaption
,
474 pstrUsageClosedCaptionSelect
,
476 pstrUsageBroadcastMode
,
480 const char * const ReportDescParserBase::consTitles5
[] PROGMEM
= {
482 pstrUsageAssignSelection
,
485 pstrUsageEnterChannel
,
488 pstrUsageMediaSelection
,
489 pstrUsageMediaSelectComputer
,
490 pstrUsageMediaSelectTV
,
491 pstrUsageMediaSelectWWW
,
492 pstrUsageMediaSelectDVD
,
493 pstrUsageMediaSelectTelephone
,
494 pstrUsageMediaSelectProgramGuide
,
495 pstrUsageMediaSelectVideoPhone
,
496 pstrUsageMediaSelectGames
,
497 pstrUsageMediaSelectMessages
,
498 pstrUsageMediaSelectCD
,
499 pstrUsageMediaSelectVCR
,
500 pstrUsageMediaSelectTuner
,
503 pstrUsageMediaSelectTape
,
504 pstrUsageMediaSelectCable
,
505 pstrUsageMediaSelectSatellite
,
506 pstrUsageMediaSelectSecurity
,
507 pstrUsageMediaSelectHome
,
508 pstrUsageMediaSelectCall
,
509 pstrUsageChannelIncrement
,
510 pstrUsageChannelDecrement
,
511 pstrUsageMediaSelectSAP
,
512 pstrUsagePageReserved
,
519 const char * const ReportDescParserBase::consTitles6
[] PROGMEM
= {
523 pstrUsageFastForward
,
525 pstrUsageScanNextTrack
,
526 pstrUsageScanPreviousTrack
,
534 pstrUsageTrackNormal
,
535 pstrUsageSlowTracking
,
536 pstrUsageFrameForward
,
537 pstrUsageFrameBackwards
,
540 pstrUsageRepeatFromMark
,
541 pstrUsageReturnToMark
,
542 pstrUsageSearchMarkForward
,
543 pstrUsageSearchMarkBackwards
,
544 pstrUsageCounterReset
,
545 pstrUsageShowCounter
,
546 pstrUsageTrackingIncrement
,
547 pstrUsageTrackingDecrement
,
552 const char * const ReportDescParserBase::consTitles7
[] PROGMEM
= {
559 pstrUsageSurroundMode
,
562 pstrUsageVolumeIncrement
,
563 pstrUsageVolumeDecrement
565 const char * const ReportDescParserBase::consTitles8
[] PROGMEM
= {
566 pstrUsageSpeedSelect
,
567 pstrUsagePlaybackSpeed
,
568 pstrUsageStandardPlay
,
570 pstrUsageExtendedPlay
,
573 const char * const ReportDescParserBase::consTitles9
[] PROGMEM
= {
576 pstrUsageLightEnable
,
577 pstrUsageLightIlluminationLevel
,
578 pstrUsageClimateControlEnable
,
579 pstrUsageRoomTemperature
,
580 pstrUsageSecurityEnable
,
582 pstrUsagePoliceAlarm
,
586 pstrUsageHoldupAlarm
,
587 pstrUsageMedicalAlarm
589 const char * const ReportDescParserBase::consTitlesA
[] PROGMEM
= {
590 pstrUsageBalanceRight
,
591 pstrUsageBalanceLeft
,
592 pstrUsageBassIncrement
,
593 pstrUsageBassDecrement
,
594 pstrUsageTrebleIncrement
,
595 pstrUsageTrebleDecrement
597 const char * const ReportDescParserBase::consTitlesB
[] PROGMEM
= {
598 pstrUsageSpeakerSystem
,
599 pstrUsageChannelLeft
,
600 pstrUsageChannelRight
,
601 pstrUsageChannelCenter
,
602 pstrUsageChannelFront
,
603 pstrUsageChannelCenterFront
,
604 pstrUsageChannelSide
,
605 pstrUsageChannelSurround
,
606 pstrUsageChannelLowFreqEnhancement
,
608 pstrUsageChannelUnknown
610 const char * const ReportDescParserBase::consTitlesC
[] PROGMEM
= {
612 pstrUsageSubChannelIncrement
,
613 pstrUsageSubChannelDecrement
,
614 pstrUsageAlternateAudioIncrement
,
615 pstrUsageAlternateAudioDecrement
617 const char * const ReportDescParserBase::consTitlesD
[] PROGMEM
= {
618 pstrUsageApplicationLaunchButtons
,
619 pstrUsageALLaunchButtonConfigTool
,
620 pstrUsageALProgrammableButton
,
621 pstrUsageALConsumerControlConfig
,
622 pstrUsageALWordProcessor
,
623 pstrUsageALTextEditor
,
624 pstrUsageALSpreadsheet
,
625 pstrUsageALGraphicsEditor
,
626 pstrUsageALPresentationApp
,
627 pstrUsageALDatabaseApp
,
628 pstrUsageALEmailReader
,
629 pstrUsageALNewsreader
,
630 pstrUsageALVoicemail
,
631 pstrUsageALContactsAddressBook
,
632 pstrUsageALCalendarSchedule
,
633 pstrUsageALTaskProjectManager
,
634 pstrUsageALLogJournalTimecard
,
635 pstrUsageALCheckbookFinance
,
636 pstrUsageALCalculator
,
637 pstrUsageALAVCapturePlayback
,
638 pstrUsageALLocalMachineBrowser
,
639 pstrUsageALLANWANBrow
,
640 pstrUsageALInternetBrowser
,
641 pstrUsageALRemoteNetISPConnect
,
642 pstrUsageALNetworkConference
,
643 pstrUsageALNetworkChat
,
644 pstrUsageALTelephonyDialer
,
647 pstrUsageALLogonLogoff
,
648 pstrUsageALTermLockScrSav
,
649 pstrUsageALControlPannel
,
650 pstrUsageALCommandLineProcessorRun
,
651 pstrUsageALProcessTaskManager
,
652 pstrUsageALSelectTaskApplication
,
653 pstrUsageALNextTaskApplication
,
654 pstrUsageALPreviousTaskApplication
,
655 pstrUsageALPreemptiveHaltTaskApp
,
656 pstrUsageALIntegratedHelpCenter
,
657 pstrUsageALDocuments
,
658 pstrUsageALThesaurus
,
659 pstrUsageALDictionary
,
661 pstrUsageALSpellCheck
,
662 pstrUsageALGrammarCheck
,
663 pstrUsageALWirelessStatus
,
664 pstrUsageALKeyboardLayout
,
665 pstrUsageALVirusProtection
,
666 pstrUsageALEncryption
,
667 pstrUsageALScreenSaver
,
670 pstrUsageALFileBrowser
,
671 pstrUsageALPowerStatus
,
672 pstrUsageALImageBrowser
,
673 pstrUsageALAudioBrowser
,
674 pstrUsageALMovieBrowser
,
675 pstrUsageALDigitalRightsManager
,
676 pstrUsageALDigitalWallet
,
677 pstrUsagePageReserved
,
678 pstrUsageALInstantMessaging
,
679 pstrUsageALOEMFeaturesBrowser
,
681 pstrUsageALOnlineCommunity
,
682 pstrUsageALEntertainmentContentBrow
,
683 pstrUsageALOnlineShoppingBrowser
,
684 pstrUsageALSmartCardInfoHelp
,
685 pstrUsageALMarketMonitorFinBrowser
,
686 pstrUsageALCustomCorpNewsBrowser
,
687 pstrUsageALOnlineActivityBrowser
,
688 pstrUsageALResearchSearchBrowser
,
689 pstrUsageALAudioPlayer
691 const char * const ReportDescParserBase::consTitlesE
[] PROGMEM
= {
692 pstrUsageGenericGUIAppControls
,
701 pstrUsageACProperties
,
706 pstrUsageACSelectAll
,
708 pstrUsageACFindAndReplace
,
716 pstrUsageACPreviousLink
,
718 pstrUsageACBookmarks
,
720 pstrUsageACSubscriptions
,
724 pstrUsageACFullScreenView
,
725 pstrUsageACNormalView
,
726 pstrUsageACViewToggle
,
728 pstrUsageACScrollDown
,
733 pstrUsageACNewWindow
,
734 pstrUsageACTileHoriz
,
740 pstrUsageACUnderline
,
741 pstrUsageACStrikethrough
,
742 pstrUsageACSubscript
,
743 pstrUsageACSuperscript
,
747 pstrUsageACFlipHorizontal
,
748 pstrUsageACFlipVertical
,
749 pstrUsageACMirrorHorizontal
,
750 pstrUsageACMirrorVertical
,
751 pstrUsageACFontSelect
,
752 pstrUsageACFontColor
,
754 pstrUsageACJustifyLeft
,
755 pstrUsageACJustifyCenterH
,
756 pstrUsageACJustifyRight
,
757 pstrUsageACJustifyBlockH
,
758 pstrUsageACJustifyTop
,
759 pstrUsageACJustifyCenterV
,
760 pstrUsageACJustifyBottom
,
761 pstrUsageACJustifyBlockV
,
762 pstrUsageACIndentDecrease
,
763 pstrUsageACIndentIncrease
,
764 pstrUsageACNumberedList
,
765 pstrUsageACRestartNumbering
,
766 pstrUsageACBulletedList
,
773 pstrUsageACBuyChkout
,
774 pstrUsageACAddToCart
,
776 pstrUsageACExpandAll
,
778 pstrUsageACCollapseAll
,
779 pstrUsageACPrintPreview
,
780 pstrUsageACPasteSpecial
,
781 pstrUsageACInsertMode
,
786 pstrUsageACUnprotect
,
787 pstrUsageACAttachComment
,
788 pstrUsageACDeleteComment
,
789 pstrUsageACViewComment
,
790 pstrUsageACSelectWord
,
791 pstrUsageACSelectSentence
,
792 pstrUsageACSelectParagraph
,
793 pstrUsageACSelectColumn
,
794 pstrUsageACSelectRow
,
795 pstrUsageACSelectTable
,
796 pstrUsageACSelectObject
,
797 pstrUsageACRedoRepeat
,
799 pstrUsageACSortAscending
,
800 pstrUsageACSortDescending
,
803 pstrUsageACViewClock
,
804 pstrUsageACSelectTimeZone
,
805 pstrUsageACEditTimeZone
,
807 pstrUsageACClearAlarm
,
808 pstrUsageACSnoozeAlarm
,
809 pstrUsageACResetAlarm
,
810 pstrUsageACSyncronize
,
811 pstrUsageACSendReceive
,
815 pstrUsageACForwardMessage
,
817 pstrUsageACAttachFile
,
820 pstrUsageACSetBorders
,
821 pstrUsageACInsertRow
,
822 pstrUsageACInsertColumn
,
823 pstrUsageACInsertFile
,
824 pstrUsageACInsertPicture
,
825 pstrUsageACInsertObject
,
826 pstrUsageACInsertSymbol
,
827 pstrUsageACSaveAndClose
,
831 pstrUsageACDistributeHorizontaly
,
832 pstrUsageACDistributeVerticaly
834 const char * const ReportDescParserBase::digitTitles0
[] PROGMEM
= {
838 pstrUsageTouchScreen
,
841 pstrUsageCoordinateMeasuringMachine
,
842 pstrUsage3DDigitizer
,
843 pstrUsageStereoPlotter
,
844 pstrUsageArticulatedArm
,
846 pstrUsageMultiplePointDigitizer
,
847 pstrUsageFreeSpaceWand
849 const char * const ReportDescParserBase::digitTitles1
[] PROGMEM
= {
855 const char * const ReportDescParserBase::digitTitles2
[] PROGMEM
= {
856 pstrUsageTipPressure
,
857 pstrUsageBarrelPressure
,
864 pstrUsageTransducerIndex
,
865 pstrUsageTabletFunctionKeys
,
866 pstrUsageProgramChangeKeys
,
867 pstrUsageBatteryStrength
,
875 pstrUsageSecondaryTipSwitch
,
876 pstrUsageBarrelSwitch
,
880 const char * const ReportDescParserBase::aplphanumTitles0
[] PROGMEM
= {
881 pstrUsageAlphanumericDisplay
,
882 pstrUsageBitmappedDisplay
884 const char * const ReportDescParserBase::aplphanumTitles1
[] PROGMEM
= {
885 pstrUsageDisplayAttributesReport
,
886 pstrUsageASCIICharacterSet
,
887 pstrUsageDataReadBack
,
888 pstrUsageFontReadBack
,
889 pstrUsageDisplayControlReport
,
890 pstrUsageClearDisplay
,
891 pstrUsageDisplayEnable
,
892 pstrUsageScreenSaverDelay
,
893 pstrUsageScreenSaverEnable
,
894 pstrUsageVerticalScroll
,
895 pstrUsageHorizontalScroll
,
896 pstrUsageCharacterReport
,
897 pstrUsageDisplayData
,
898 pstrUsageDisplayStatus
,
899 pstrUsageStatusNotReady
,
900 pstrUsageStatusReady
,
901 pstrUsageErrorNotALoadableCharacter
,
902 pstrUsageErrorFotDataCanNotBeRead
,
903 pstrUsageCursorPositionReport
,
908 pstrUsageCursorPixelPosition
,
910 pstrUsageCursorEnable
,
911 pstrUsageCursorBlink
,
914 pstrUsageCharacterWidth
,
915 pstrUsageCharacterHeight
,
916 pstrUsageCharacterSpacingHorizontal
,
917 pstrUsageCharacterSpacingVertical
,
918 pstrUsageUnicodeCharset
,
919 pstrUsageFont7Segment
,
920 pstrUsage7SegmentDirectMap
,
921 pstrUsageFont14Segment
,
922 pstrUsage14SegmentDirectMap
,
923 pstrUsageDisplayBrightness
,
924 pstrUsageDisplayContrast
,
925 pstrUsageCharacterAttribute
,
926 pstrUsageAttributeReadback
,
927 pstrUsageAttributeData
,
928 pstrUsageCharAttributeEnhance
,
929 pstrUsageCharAttributeUnderline
,
930 pstrUsageCharAttributeBlink
932 const char * const ReportDescParserBase::aplphanumTitles2
[] PROGMEM
= {
933 pstrUsageBitmapSizeX
,
934 pstrUsageBitmapSizeY
,
935 pstrUsagePageReserved
,
936 pstrUsageBitDepthFormat
,
937 pstrUsageDisplayOrientation
,
938 pstrUsagePaletteReport
,
939 pstrUsagePaletteDataSize
,
940 pstrUsagePaletteDataOffset
,
941 pstrUsagePaletteData
,
943 pstrUsageBlitRectangleX1
,
944 pstrUsageBlitRectangleY1
,
945 pstrUsageBlitRectangleX2
,
946 pstrUsageBlitRectangleY2
,
949 pstrUsageSoftButtonID
,
950 pstrUsageSoftButtonSide
,
951 pstrUsageSoftButtonOffset1
,
952 pstrUsageSoftButtonOffset2
,
953 pstrUsageSoftButtonReport
955 const char * const ReportDescParserBase::medInstrTitles0
[] PROGMEM
= {
956 pstrUsageVCRAcquisition
,
963 pstrUsageMicrophoneEnable
965 const char * const ReportDescParserBase::medInstrTitles1
[] PROGMEM
= {
967 pstrUsageTransmitPower
,
972 const char * const ReportDescParserBase::medInstrTitles2
[] PROGMEM
= {
973 pstrUsageSoftStepPrimary
,
974 pstrUsageSoftStepSecondary
976 const char * const ReportDescParserBase::medInstrTitles3
[] PROGMEM
= {
979 pstrUsageSpectralDopplerModeSelect
,
980 pstrUsageSpectralDopplerModeAdjust
,
981 pstrUsageColorDopplerModeSelect
,
982 pstrUsageColorDopplerModeAdjust
,
983 pstrUsageMotionModeSelect
,
984 pstrUsageMotionModeAdjust
,
985 pstrUsage2DModeSelect
,
986 pstrUsage2DModeAdjust
988 const char * const ReportDescParserBase::medInstrTitles4
[] PROGMEM
= {
989 pstrUsageSoftControlSelect
,
990 pstrUsageSoftControlAdjust
993 void ReportDescParserBase::Parse(const uint16_t len
, const uint8_t *pbuf
, const uint16_t &offset
) {
994 uint16_t cntdn
= (uint16_t)len
;
995 uint8_t *p
= (uint8_t*)pbuf
;
1001 //USB_HOST_SERIAL.println("");
1002 //PrintHex<uint16_t>(offset + len - cntdn);
1003 //USB_HOST_SERIAL.print(":");
1005 ParseItem(&p
, &cntdn
);
1007 //if (ParseItem(&p, &cntdn))
1010 //USBTRACE2("Total:", totalSize);
1013 void ReportDescParserBase::PrintValue(uint8_t *p
, uint8_t len
) {
1014 E_Notify(PSTR("("), 0x80);
1015 for(; len
; p
++, len
--)
1016 PrintHex
<uint8_t > (*p
, 0x80);
1017 E_Notify(PSTR(")"), 0x80);
1020 void ReportDescParserBase::PrintByteValue(uint8_t data
) {
1021 E_Notify(PSTR("("), 0x80);
1022 PrintHex
<uint8_t > (data
, 0x80);
1023 E_Notify(PSTR(")"), 0x80);
1026 void ReportDescParserBase::PrintItemTitle(uint8_t prefix
) {
1027 switch(prefix
& (TYPE_MASK
| TAG_MASK
)) {
1028 case (TYPE_GLOBAL
| TAG_GLOBAL_PUSH
):
1029 E_Notify(PSTR("\r\nPush"), 0x80);
1031 case (TYPE_GLOBAL
| TAG_GLOBAL_POP
):
1032 E_Notify(PSTR("\r\nPop"), 0x80);
1034 case (TYPE_GLOBAL
| TAG_GLOBAL_USAGEPAGE
):
1035 E_Notify(PSTR("\r\nUsage Page"), 0x80);
1037 case (TYPE_GLOBAL
| TAG_GLOBAL_LOGICALMIN
):
1038 E_Notify(PSTR("\r\nLogical Min"), 0x80);
1040 case (TYPE_GLOBAL
| TAG_GLOBAL_LOGICALMAX
):
1041 E_Notify(PSTR("\r\nLogical Max"), 0x80);
1043 case (TYPE_GLOBAL
| TAG_GLOBAL_PHYSMIN
):
1044 E_Notify(PSTR("\r\nPhysical Min"), 0x80);
1046 case (TYPE_GLOBAL
| TAG_GLOBAL_PHYSMAX
):
1047 E_Notify(PSTR("\r\nPhysical Max"), 0x80);
1049 case (TYPE_GLOBAL
| TAG_GLOBAL_UNITEXP
):
1050 E_Notify(PSTR("\r\nUnit Exp"), 0x80);
1052 case (TYPE_GLOBAL
| TAG_GLOBAL_UNIT
):
1053 E_Notify(PSTR("\r\nUnit"), 0x80);
1055 case (TYPE_GLOBAL
| TAG_GLOBAL_REPORTSIZE
):
1056 E_Notify(PSTR("\r\nReport Size"), 0x80);
1058 case (TYPE_GLOBAL
| TAG_GLOBAL_REPORTCOUNT
):
1059 E_Notify(PSTR("\r\nReport Count"), 0x80);
1061 case (TYPE_GLOBAL
| TAG_GLOBAL_REPORTID
):
1062 E_Notify(PSTR("\r\nReport Id"), 0x80);
1064 case (TYPE_LOCAL
| TAG_LOCAL_USAGE
):
1065 E_Notify(PSTR("\r\nUsage"), 0x80);
1067 case (TYPE_LOCAL
| TAG_LOCAL_USAGEMIN
):
1068 E_Notify(PSTR("\r\nUsage Min"), 0x80);
1070 case (TYPE_LOCAL
| TAG_LOCAL_USAGEMAX
):
1071 E_Notify(PSTR("\r\nUsage Max"), 0x80);
1073 case (TYPE_MAIN
| TAG_MAIN_COLLECTION
):
1074 E_Notify(PSTR("\r\nCollection"), 0x80);
1076 case (TYPE_MAIN
| TAG_MAIN_ENDCOLLECTION
):
1077 E_Notify(PSTR("\r\nEnd Collection"), 0x80);
1079 case (TYPE_MAIN
| TAG_MAIN_INPUT
):
1080 E_Notify(PSTR("\r\nInput"), 0x80);
1082 case (TYPE_MAIN
| TAG_MAIN_OUTPUT
):
1083 E_Notify(PSTR("\r\nOutput"), 0x80);
1085 case (TYPE_MAIN
| TAG_MAIN_FEATURE
):
1086 E_Notify(PSTR("\r\nFeature"), 0x80);
1088 } // switch (**pp & (TYPE_MASK | TAG_MASK))
1091 uint8_t ReportDescParserBase::ParseItem(uint8_t **pp
, uint16_t *pcntdn
) {
1092 //uint8_t ret = enErrorSuccess;
1093 //reinterpret_cast<>(varBuffer);
1094 switch(itemParseState
) {
1096 if(**pp
== HID_LONG_ITEM_PREFIX
)
1097 USBTRACE("\r\nLONG\r\n");
1099 uint8_t size
= ((**pp
) & DATA_SIZE_MASK
);
1101 itemPrefix
= (**pp
);
1102 itemSize
= 1 + ((size
== DATA_SIZE_4
) ? 4 : size
);
1104 PrintItemTitle(itemPrefix
);
1115 return enErrorIncomplete
;
1117 //USBTRACE2("\r\niSz:",itemSize);
1119 theBuffer
.valueSize
= itemSize
;
1120 valParser
.Initialize(&theBuffer
);
1123 if(!valParser
.Parse(pp
, pcntdn
))
1124 return enErrorIncomplete
;
1128 uint8_t data
= *((uint8_t*)varBuffer
);
1130 switch(itemPrefix
& (TYPE_MASK
| TAG_MASK
)) {
1131 case (TYPE_LOCAL
| TAG_LOCAL_USAGE
):
1133 if(theBuffer
.valueSize
> 1) {
1134 uint16_t* ui16
= reinterpret_cast<uint16_t *>(varBuffer
);
1140 case (TYPE_GLOBAL
| TAG_GLOBAL_REPORTSIZE
):
1142 PrintByteValue(data
);
1144 case (TYPE_GLOBAL
| TAG_GLOBAL_REPORTCOUNT
):
1146 PrintByteValue(data
);
1148 case (TYPE_GLOBAL
| TAG_GLOBAL_LOGICALMIN
):
1149 case (TYPE_GLOBAL
| TAG_GLOBAL_LOGICALMAX
):
1150 case (TYPE_GLOBAL
| TAG_GLOBAL_PHYSMIN
):
1151 case (TYPE_GLOBAL
| TAG_GLOBAL_PHYSMAX
):
1152 case (TYPE_GLOBAL
| TAG_GLOBAL_REPORTID
):
1153 case (TYPE_LOCAL
| TAG_LOCAL_USAGEMIN
):
1154 case (TYPE_LOCAL
| TAG_LOCAL_USAGEMAX
):
1155 case (TYPE_GLOBAL
| TAG_GLOBAL_UNITEXP
):
1156 case (TYPE_GLOBAL
| TAG_GLOBAL_UNIT
):
1157 PrintValue(varBuffer
, theBuffer
.valueSize
);
1159 case (TYPE_GLOBAL
| TAG_GLOBAL_PUSH
):
1160 case (TYPE_GLOBAL
| TAG_GLOBAL_POP
):
1162 case (TYPE_GLOBAL
| TAG_GLOBAL_USAGEPAGE
):
1164 PrintUsagePage(data
);
1165 PrintByteValue(data
);
1167 case (TYPE_MAIN
| TAG_MAIN_COLLECTION
):
1168 case (TYPE_MAIN
| TAG_MAIN_ENDCOLLECTION
):
1171 E_Notify(PSTR(" Physical"), 0x80);
1174 E_Notify(PSTR(" Application"), 0x80);
1177 E_Notify(PSTR(" Logical"), 0x80);
1180 E_Notify(PSTR(" Report"), 0x80);
1183 E_Notify(PSTR(" Named Array"), 0x80);
1186 E_Notify(PSTR(" Usage Switch"), 0x80);
1189 E_Notify(PSTR(" Usage Modifier"), 0x80);
1192 E_Notify(PSTR(" Vendor Defined("), 0x80);
1193 PrintHex
<uint8_t > (data
, 0x80);
1194 E_Notify(PSTR(")"), 0x80);
1197 case (TYPE_MAIN
| TAG_MAIN_INPUT
):
1198 case (TYPE_MAIN
| TAG_MAIN_OUTPUT
):
1199 case (TYPE_MAIN
| TAG_MAIN_FEATURE
):
1200 totalSize
+= (uint16_t)rptSize
* (uint16_t)rptCount
;
1203 E_Notify(PSTR("("), 0x80);
1204 PrintBin
<uint8_t > (data
, 0x80);
1205 E_Notify(PSTR(")"), 0x80);
1207 } // switch (**pp & (TYPE_MASK | TAG_MASK))
1209 } // switch (itemParseState)
1211 return enErrorSuccess
;
1214 ReportDescParserBase::UsagePageFunc
ReportDescParserBase::usagePageFunctions
[] /*PROGMEM*/ = {
1215 &ReportDescParserBase::PrintGenericDesktopPageUsage
,
1216 &ReportDescParserBase::PrintSimulationControlsPageUsage
,
1217 &ReportDescParserBase::PrintVRControlsPageUsage
,
1218 &ReportDescParserBase::PrintSportsControlsPageUsage
,
1219 &ReportDescParserBase::PrintGameControlsPageUsage
,
1220 &ReportDescParserBase::PrintGenericDeviceControlsPageUsage
,
1221 NULL
, // Keyboard/Keypad
1222 &ReportDescParserBase::PrintLEDPageUsage
,
1223 &ReportDescParserBase::PrintButtonPageUsage
,
1224 &ReportDescParserBase::PrintOrdinalPageUsage
,
1225 &ReportDescParserBase::PrintTelephonyPageUsage
,
1226 &ReportDescParserBase::PrintConsumerPageUsage
,
1227 &ReportDescParserBase::PrintDigitizerPageUsage
,
1233 void ReportDescParserBase::SetUsagePage(uint16_t page
) {
1236 if(VALUE_BETWEEN(page
, 0x00, 0x11)) {
1237 pfUsage
= (usagePageFunctions
[page
- 1]);
1242 pfUsage
= &ReportDescParserBase::PrintAlphanumDisplayPageUsage
;
1245 pfUsage
= &ReportDescParserBase::PrintMedicalInstrumentPageUsage
;
1251 void ReportDescParserBase::PrintUsagePage(uint16_t page
) {
1252 const char * const * w
;
1253 E_Notify(pstrSpace
, 0x80);
1255 output_if_between(page
, 0x00, 0x11, w
, E_Notify
, usagePageTitles0
, 0x80)
1256 else output_if_between(page
, 0x8b, 0x92, w
, E_Notify
, usagePageTitles1
, 0x80)
1257 else if(VALUE_BETWEEN(page
, 0x7f, 0x84))
1258 E_Notify(pstrUsagePageMonitor
, 0x80);
1259 else if(VALUE_BETWEEN(page
, 0x83, 0x8c))
1260 E_Notify(pstrUsagePagePower
, 0x80);
1261 else if(page
> 0xfeff /* && page <= 0xffff */)
1262 E_Notify(pstrUsagePageVendorDefined
, 0x80);
1266 E_Notify(pstrUsagePageAlphaNumericDisplay
, 0x80);
1269 E_Notify(pstrUsagePageMedicalInstruments
, 0x80);
1272 E_Notify(pstrUsagePageUndefined
, 0x80);
1276 void ReportDescParserBase::PrintButtonPageUsage(uint16_t usage
) {
1277 E_Notify(pstrSpace
, 0x80);
1278 E_Notify(PSTR("Btn"), 0x80);
1279 PrintHex
<uint16_t > (usage
, 0x80);
1280 E_Notify(PSTR("\r\n"), 0x80);
1281 //USB_HOST_SERIAL.print(usage, HEX);
1284 void ReportDescParserBase::PrintOrdinalPageUsage(uint16_t usage
) {
1285 E_Notify(pstrSpace
, 0x80);
1286 E_Notify(PSTR("Inst"), 0x80);
1287 // Sorry, HEX for now...
1288 PrintHex
<uint16_t > (usage
, 0x80);
1289 E_Notify(PSTR("\r\n"), 0x80);
1290 //USB_HOST_SERIAL.print(usage, DEC);
1293 void ReportDescParserBase::PrintGenericDesktopPageUsage(uint16_t usage
) {
1294 const char * const * w
;
1295 E_Notify(pstrSpace
, 0x80);
1297 output_if_between(usage
, 0x00, 0x0a, w
, E_Notify
, genDesktopTitles0
, 0x80)
1298 else output_if_between(usage
, 0x2f, 0x49, w
, E_Notify
, genDesktopTitles1
, 0x80)
1299 else output_if_between(usage
, 0x7f, 0x94, w
, E_Notify
, genDesktopTitles2
, 0x80)
1300 else output_if_between(usage
, 0x9f, 0xa9, w
, E_Notify
, genDesktopTitles3
, 0x80)
1301 else output_if_between(usage
, 0xaf, 0xb8, w
, E_Notify
, genDesktopTitles4
, 0x80)
1302 else E_Notify(pstrUsagePageUndefined
, 0x80);
1305 void ReportDescParserBase::PrintSimulationControlsPageUsage(uint16_t usage
) {
1306 const char * const * w
;
1307 E_Notify(pstrSpace
, 0x80);
1309 output_if_between(usage
, 0x00, 0x0d, w
, E_Notify
, simuTitles0
, 0x80)
1310 else output_if_between(usage
, 0x1f, 0x26, w
, E_Notify
, simuTitles1
, 0x80)
1311 else output_if_between(usage
, 0xaf, 0xd1, w
, E_Notify
, simuTitles2
, 0x80)
1312 else E_Notify(pstrUsagePageUndefined
, 0x80);
1315 void ReportDescParserBase::PrintVRControlsPageUsage(uint16_t usage
) {
1316 const char * const * w
;
1317 E_Notify(pstrSpace
, 0x80);
1319 output_if_between(usage
, 0x00, 0x0b, w
, E_Notify
, vrTitles0
, 0x80)
1320 else output_if_between(usage
, 0x1f, 0x22, w
, E_Notify
, vrTitles1
, 0x80)
1321 else E_Notify(pstrUsagePageUndefined
, 0x80);
1324 void ReportDescParserBase::PrintSportsControlsPageUsage(uint16_t usage
) {
1325 const char * const * w
;
1326 E_Notify(pstrSpace
, 0x80);
1328 output_if_between(usage
, 0x00, 0x05, w
, E_Notify
, sportsCtrlTitles0
, 0x80)
1329 else output_if_between(usage
, 0x2f, 0x3a, w
, E_Notify
, sportsCtrlTitles1
, 0x80)
1330 else output_if_between(usage
, 0x4f, 0x64, w
, E_Notify
, sportsCtrlTitles2
, 0x80)
1331 else E_Notify(pstrUsagePageUndefined
, 0x80);
1334 void ReportDescParserBase::PrintGameControlsPageUsage(uint16_t usage
) {
1335 const char * const * w
;
1336 E_Notify(pstrSpace
, 0x80);
1338 output_if_between(usage
, 0x00, 0x04, w
, E_Notify
, gameTitles0
, 0x80)
1339 else output_if_between(usage
, 0x1f, 0x3a, w
, E_Notify
, gameTitles1
, 0x80)
1340 else E_Notify(pstrUsagePageUndefined
, 0x80);
1343 void ReportDescParserBase::PrintGenericDeviceControlsPageUsage(uint16_t usage
) {
1344 const char * const * w
;
1345 E_Notify(pstrSpace
, 0x80);
1347 output_if_between(usage
, 0x1f, 0x27, w
, E_Notify
, genDevCtrlTitles
, 0x80)
1348 else E_Notify(pstrUsagePageUndefined
, 0x80);
1351 void ReportDescParserBase::PrintLEDPageUsage(uint16_t usage
) {
1352 const char * const * w
;
1353 E_Notify(pstrSpace
, 0x80);
1355 output_if_between(usage
, 0x00, 0x4e, w
, E_Notify
, ledTitles
, 0x80)
1356 else E_Notify(pstrUsagePageUndefined
, 0x80);
1359 void ReportDescParserBase::PrintTelephonyPageUsage(uint16_t usage
) {
1360 const char * const * w
;
1361 E_Notify(pstrSpace
, 0x80);
1363 output_if_between(usage
, 0x00, 0x08, w
, E_Notify
, telTitles0
, 0x80)
1364 else output_if_between(usage
, 0x1f, 0x32, w
, E_Notify
, telTitles1
, 0x80)
1365 else output_if_between(usage
, 0x4f, 0x54, w
, E_Notify
, telTitles2
, 0x80)
1366 else output_if_between(usage
, 0x6f, 0x75, w
, E_Notify
, telTitles3
, 0x80)
1367 else output_if_between(usage
, 0x8f, 0x9f, w
, E_Notify
, telTitles4
, 0x80)
1368 else output_if_between(usage
, 0xaf, 0xc0, w
, E_Notify
, telTitles5
, 0x80)
1369 else E_Notify(pstrUsagePageUndefined
, 0x80);
1372 void ReportDescParserBase::PrintConsumerPageUsage(uint16_t usage
) {
1373 const char * const * w
;
1374 E_Notify(pstrSpace
, 0x80);
1376 output_if_between(usage
, 0x00, 0x07, w
, E_Notify
, consTitles0
, 0x80)
1377 else output_if_between(usage
, 0x1f, 0x23, w
, E_Notify
, consTitles1
, 0x80)
1378 else output_if_between(usage
, 0x2f, 0x37, w
, E_Notify
, consTitles2
, 0x80)
1379 else output_if_between(usage
, 0x3f, 0x49, w
, E_Notify
, consTitles3
, 0x80)
1380 else output_if_between(usage
, 0x5f, 0x67, w
, E_Notify
, consTitles4
, 0x80)
1381 else output_if_between(usage
, 0x7f, 0xa5, w
, E_Notify
, consTitles5
, 0x80)
1382 else output_if_between(usage
, 0xaf, 0xcf, w
, E_Notify
, consTitles6
, 0x80)
1383 else output_if_between(usage
, 0xdf, 0xeb, w
, E_Notify
, consTitles7
, 0x80)
1384 else output_if_between(usage
, 0xef, 0xf6, w
, E_Notify
, consTitles8
, 0x80)
1385 else output_if_between(usage
, 0xff, 0x10e, w
, E_Notify
, consTitles9
, 0x80)
1386 else output_if_between(usage
, 0x14f, 0x156, w
, E_Notify
, consTitlesA
, 0x80)
1387 else output_if_between(usage
, 0x15f, 0x16b, w
, E_Notify
, consTitlesB
, 0x80)
1388 else output_if_between(usage
, 0x16f, 0x175, w
, E_Notify
, consTitlesC
, 0x80)
1389 else output_if_between(usage
, 0x17f, 0x1c8, w
, E_Notify
, consTitlesD
, 0x80)
1390 else output_if_between(usage
, 0x1ff, 0x29d, w
, E_Notify
, consTitlesE
, 0x80)
1391 else E_Notify(pstrUsagePageUndefined
, 0x80);
1394 void ReportDescParserBase::PrintDigitizerPageUsage(uint16_t usage
) {
1395 const char * const * w
;
1396 E_Notify(pstrSpace
, 0x80);
1398 output_if_between(usage
, 0x00, 0x0e, w
, E_Notify
, digitTitles0
, 0x80)
1399 else output_if_between(usage
, 0x1f, 0x23, w
, E_Notify
, digitTitles1
, 0x80)
1400 else output_if_between(usage
, 0x2f, 0x47, w
, E_Notify
, digitTitles2
, 0x80)
1401 else E_Notify(pstrUsagePageUndefined
, 0x80);
1404 void ReportDescParserBase::PrintAlphanumDisplayPageUsage(uint16_t usage
) {
1405 const char * const * w
;
1406 E_Notify(pstrSpace
, 0x80);
1408 output_if_between(usage
, 0x00, 0x03, w
, E_Notify
, aplphanumTitles0
, 0x80)
1409 else output_if_between(usage
, 0x1f, 0x4e, w
, E_Notify
, aplphanumTitles1
, 0x80)
1410 else output_if_between(usage
, 0x7f, 0x96, w
, E_Notify
, digitTitles2
, 0x80)
1411 else E_Notify(pstrUsagePageUndefined
, 0x80);
1414 void ReportDescParserBase::PrintMedicalInstrumentPageUsage(uint16_t usage
) {
1415 const char * const * w
;
1416 E_Notify(pstrSpace
, 0x80);
1418 if(usage
== 1) E_Notify(pstrUsageMedicalUltrasound
, 0x80);
1419 else if(usage
== 0x70)
1420 E_Notify(pstrUsageDepthGainCompensation
, 0x80);
1421 else output_if_between(usage
, 0x1f, 0x28, w
, E_Notify
, medInstrTitles0
, 0x80)
1422 else output_if_between(usage
, 0x3f, 0x45, w
, E_Notify
, medInstrTitles1
, 0x80)
1423 else output_if_between(usage
, 0x5f, 0x62, w
, E_Notify
, medInstrTitles2
, 0x80)
1424 else output_if_between(usage
, 0x7f, 0x8a, w
, E_Notify
, medInstrTitles3
, 0x80)
1425 else output_if_between(usage
, 0x9f, 0xa2, w
, E_Notify
, medInstrTitles4
, 0x80)
1426 else E_Notify(pstrUsagePageUndefined
, 0x80);
1429 uint8_t ReportDescParser2::ParseItem(uint8_t **pp
, uint16_t *pcntdn
) {
1430 //uint8_t ret = enErrorSuccess;
1432 switch(itemParseState
) {
1434 if(**pp
== HID_LONG_ITEM_PREFIX
)
1435 USBTRACE("\r\nLONG\r\n");
1437 uint8_t size
= ((**pp
) & DATA_SIZE_MASK
);
1438 itemPrefix
= (**pp
);
1439 itemSize
= 1 + ((size
== DATA_SIZE_4
) ? 4 : size
);
1450 return enErrorIncomplete
;
1452 theBuffer
.valueSize
= itemSize
;
1453 valParser
.Initialize(&theBuffer
);
1456 if(!valParser
.Parse(pp
, pcntdn
))
1457 return enErrorIncomplete
;
1461 uint8_t data
= *((uint8_t*)varBuffer
);
1463 switch(itemPrefix
& (TYPE_MASK
| TAG_MASK
)) {
1464 case (TYPE_LOCAL
| TAG_LOCAL_USAGE
):
1466 if(theBuffer
.valueSize
> 1) {
1467 uint16_t* ui16
= reinterpret_cast<uint16_t *>(varBuffer
);
1473 case (TYPE_GLOBAL
| TAG_GLOBAL_REPORTSIZE
):
1476 case (TYPE_GLOBAL
| TAG_GLOBAL_REPORTCOUNT
):
1479 case (TYPE_GLOBAL
| TAG_GLOBAL_REPORTID
):
1482 case (TYPE_LOCAL
| TAG_LOCAL_USAGEMIN
):
1485 case (TYPE_LOCAL
| TAG_LOCAL_USAGEMAX
):
1488 case (TYPE_GLOBAL
| TAG_GLOBAL_USAGEPAGE
):
1491 case (TYPE_MAIN
| TAG_MAIN_OUTPUT
):
1492 case (TYPE_MAIN
| TAG_MAIN_FEATURE
):
1498 case (TYPE_MAIN
| TAG_MAIN_INPUT
):
1501 totalSize
+= (uint16_t)rptSize
* (uint16_t)rptCount
;
1508 } // switch (**pp & (TYPE_MASK | TAG_MASK))
1510 } // switch (itemParseState)
1512 return enErrorSuccess
;
1515 void ReportDescParser2::OnInputItem(uint8_t itm
) {
1516 uint8_t byte_offset
= (totalSize
>> 3); // calculate offset to the next unhandled byte i = (int)(totalCount / 8);
1517 uint32_t tmp
= (byte_offset
<< 3);
1518 uint8_t bit_offset
= totalSize
- tmp
; // number of bits in the current byte already handled
1519 uint8_t *p
= pBuf
+ byte_offset
; // current byte pointer
1524 uint8_t usage
= useMin
;
1526 bool print_usemin_usemax
= ((useMin
< useMax
) && ((itm
& 3) == 2) && pfUsage
) ? true : false;
1528 uint8_t bits_of_byte
= 8;
1530 // for each field in field array defined by rptCount
1531 for(uint8_t field
= 0; field
< rptCount
; field
++, usage
++) {
1535 uint16_t wResult
[2];
1539 result
.dwResult
= 0;
1542 if(print_usemin_usemax
)
1545 // bits_left - number of bits in the field(array of fields, depending on Report Count) left to process
1546 // bits_of_byte - number of bits in current byte left to process
1547 // bits_to_copy - number of bits to copy to result buffer
1549 // for each bit in a field
1550 for(uint8_t bits_left
= rptSize
, bits_to_copy
= 0; bits_left
;
1551 bits_left
-= bits_to_copy
) {
1552 bits_to_copy
= (bits_left
> bits_of_byte
) ? bits_of_byte
: bits_left
;
1554 result
.dwResult
<<= bits_to_copy
; // Result buffer is shifted by the number of bits to be copied into it
1558 val
>>= (8 - bits_of_byte
); // Shift by the number of bits already processed
1562 for(uint8_t j
= bits_to_copy
; j
; j
--) {
1567 result
.bResult
[0] = (result
.bResult
[0] | (val
& mask
));
1569 bits_of_byte
-= bits_to_copy
;
1571 if(bits_of_byte
< 1) {
1576 PrintByteValue(result
.dwResult
);
1578 E_Notify(PSTR("\r\n"), 0x80);
1581 void UniversalReportParser::Parse(HID
*hid
, bool is_rpt_id
, uint8_t len
, uint8_t *buf
) {
1582 ReportDescParser2
prs(len
, buf
);
1584 uint8_t ret
= hid
->GetReportDescr(0, &prs
);
1587 ErrorMessage
<uint8_t > (PSTR("GetReportDescr-2"), ret
);