# HG changeset patch # User sl # Date 1419008753 -3600 # Node ID ddfd2ddf10e1d8d0df0264990de1804fa089a6d0 # Parent 634ac38db22570cfbf214a0931ea8f583366b659 Generated full list of consumer controls. Add Perl script we used for parsing. diff -r 634ac38db225 -r ddfd2ddf10e1 HidUsageTableConsumer.txt --- a/HidUsageTableConsumer.txt Fri Dec 19 16:54:32 2014 +0100 +++ b/HidUsageTableConsumer.txt Fri Dec 19 18:05:53 2014 +0100 @@ -139,7 +139,8 @@ 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 +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 diff -r 634ac38db225 -r ddfd2ddf10e1 HidUsageTables.cs --- a/HidUsageTables.cs Fri Dec 19 16:54:32 2014 +0100 +++ b/HidUsageTables.cs Fri Dec 19 18:05:53 2014 +0100 @@ -49,7 +49,7 @@ } public enum UsageCollectionGenericDesktop : ushort - { + { Pointer = 0x01, Mouse = 0x02, Joystick = 0x04, @@ -90,10 +90,10 @@ GenericGuiApplicationControls = 0x0200, } - + public enum UsageCollectionWindowsMediaCenter: ushort { - WindowsMediaCenterRemoteControl = 0x88 + WindowsMediaCenterRemoteControl = 0x88 } @@ -283,128 +283,334 @@ /// Usage Table for Consumer Controls /// 0x0C 0X01 /// - public enum ConsumerControl: ushort + public enum ConsumerControl : ushort { - Null = 0x0000, - // - Channel = 0x0086, - MediaSelectComputer = 0x0088, - MediaSelectTV = 0x0089, - MediaSelectWWW = 0x008A, - MediaSelectDVD = 0x008B, - MediaSelectTelephone = 0x008C, - MediaSelectProgramGuide = 0x008D, - MediaSelectVideoPhone = 0x008E, - MediaSelectGames = 0x008F, - MediaSelectMessages = 0x0090, - MediaSelectCD = 0x0091, - MediaSelectVCR = 0x0092, - MediaSelectTuner = 0x0093, - Quit = 0x0094, - Help = 0x0095, - MediaSelectTape = 0x0096, - MediaSelectCable = 0x0097, - MediaSelectSatellite = 0x0098, - MediaSelectSecurity = 0x0099, - MediaSelectHome = 0x009A, - MediaSelectCall = 0x009B, - ChannelIncrement = 0x009C, - ChannelDecrement = 0x009D, - MediaSelectSAP = 0x009E, + Null = 0x0000, // - Play = 0x00B0, - Pause = 0x00B1, - Record = 0x00B2, - FastForward = 0x00B3, - Rewind = 0x00B4, - ScanNextTrack = 0x00B5, - ScanPreviousTrack = 0x00B6, - Stop = 0x00B7, - Eject = 0x00B8, - RandomPlay = 0x00B9, - EnterDisc = 0x00BB, - Repeat = 0x00BC, - Tracking = 0x00BD, - TrackNormal = 0x00BE, - SlowTracking = 0x00BF, - FrameForward = 0x00C0, - FrameBack = 0x00C1, - Mark = 0x00C2, - ClearMark = 0x00C3, - RepeatFromMark = 0x00C4, - ReturnToMark = 0x00C5, - SearchMarkForward = 0x00C6, - SearchMarkBackwards = 0x00C7, - CounterReset = 0x00C8, - ShowCounter = 0x00C9, - TrackingIncrement = 0x00CA, - TrackingDecrement = 0x00CB, - StopEject = 0x00CC, - PlayPause = 0x00CD, - PlaySkip = 0x00CE, - - /// - /// Audio controls - /// - Volume = 0x00E0, - Balance = 0x00E1, - Mute = 0x00E2, - Bass = 0x00E3, - Treble = 0x00E4, - BassBoost = 0x00E5, - SurroundMode = 0x00E6, - Loudness = 0x00E7, - MPX = 0x00E8, - VolumeIncrement = 0x00E9, - VolumeDecrement = 0x00EA, - - //Generic GUI Application Controls - //GenericGUIApplicationControls = 0x0200, - AppCtrlNew = 0x0201, - AppCtrlOpen = 0x0202, - AppCtrlClose = 0x0203, - AppCtrlExit = 0x0204, - AppCtrlMaximize = 0x0205, - AppCtrlMinimize = 0x0206, - AppCtrlSave = 0x0207, - AppCtrlPrint = 0x0208, - AppCtrlProperties = 0x0209, - AppCtrlUndo = 0x021A, - AppCtrlCopy = 0x021B, - AppCtrlCut = 0x021C, - AppCtrlPaste = 0x021D, - AppCtrlSelectAll = 0x021E, - AppCtrlFind = 0x021F, - AppCtrlFindAndReplace = 0x0220, - AppCtrlSearch = 0x0221, - AppCtrlGoTo = 0x0222, - AppCtrlHome = 0x0223, - AppCtrlBack = 0x0224, - AppCtrlForward = 0x0225, - AppCtrlStop = 0x0226, - AppCtrlRefresh = 0x0227, - AppCtrlPreviousLink = 0x0228, - AppCtrlNextLink = 0x0229, - AppCtrlBookmarks = 0x022A, - AppCtrlHistory = 0x022B, - AppCtrlSubscriptions = 0x022C, - AppCtrlZoomIn = 0x022D, - AppCtrlZoomOut = 0x022E, - AppCtrlZoom = 0x022F, - AppCtrlFullScreenView = 0x0230, - AppCtrlNormalView = 0x0231, - AppCtrlViewToggle = 0x0232, - AppCtrlScrollUp = 0x0233, - AppCtrlScrollDown = 0x0234, - AppCtrlScroll = 0x0235, - AppCtrlPanLeft = 0x0236, - AppCtrlPanRight = 0x0237, - AppCtrlPan = 0x0238, - AppCtrlNewWindow = 0x0239, - AppCtrlTileHorizontally = 0x023A, - AppCtrlTileVertically = 0x023B, - AppCtrlFormat = 0x023C, - AppCtrlEdit = 0x023D, + ConsumerControl = 0x01, + NumericKeyPad = 0x02, + ProgrammableButtons = 0x03, + Microphone = 0x04, + Headphone = 0x05, + GraphicEqualizer = 0x06, + Plus10 = 0x20, + Plus100 = 0x21, + AmPm = 0x22, + Power = 0x30, + Reset = 0x31, + Sleep = 0x32, + SleepAfter = 0x33, + SleepMode = 0x34, + Illumination = 0x35, + FunctionButtons = 0x36, + Menu = 0x40, + MenuPick = 0x41, + MenuUp = 0x42, + MenuDown = 0x43, + MenuLeft = 0x44, + MenuRight = 0x45, + MenuEscape = 0x46, + MenuValueIncrease = 0x47, + MenuValueDecrease = 0x48, + DataOnScreen = 0x60, + ClosedCaption = 0x61, + ClosedCaptionSelect = 0x62, + VcrTv = 0x63, + BroadcastMode = 0x64, + Snapshot = 0x65, + Still = 0x66, + Selection = 0x80, + AssignSelection = 0x81, + ModeStep = 0x82, + RecallLast = 0x83, + EnterChannel = 0x84, + OrderMovie = 0x85, + Channel = 0x86, + MediaSelection = 0x87, + MediaSelectComputer = 0x88, + MediaSelectTv = 0x89, + MediaSelectWww = 0x8A, + MediaSelectDvd = 0x8B, + MediaSelectTelephone = 0x8C, + MediaSelectProgramGuide = 0x8D, + MediaSelectVideoPhone = 0x8E, + MediaSelectGames = 0x8F, + MediaSelectMessages = 0x90, + MediaSelectCd = 0x91, + MediaSelectVcr = 0x92, + MediaSelectTuner = 0x93, + Quit = 0x94, + Help = 0x95, + MediaSelectTape = 0x96, + MediaSelectCable = 0x97, + MediaSelectSatellite = 0x98, + MediaSelectSecurity = 0x99, + MediaSelectHome = 0x9A, + MediaSelectCall = 0x9B, + ChannelIncrement = 0x9C, + ChannelDecrement = 0x9D, + MediaSelectSap = 0x9E, + VcrPlus = 0xA0, + Once = 0xA1, + Daily = 0xA2, + Weekly = 0xA3, + Monthly = 0xA4, + Play = 0xB0, + Pause = 0xB1, + Record = 0xB2, + FastForward = 0xB3, + Rewind = 0xB4, + ScanNextTrack = 0xB5, + ScanPreviousTrack = 0xB6, + Stop = 0xB7, + Eject = 0xB8, + RandomPlay = 0xB9, + SelectDisc = 0xBA, + EnterDisc = 0xBB, + Repeat = 0xBC, + Tracking = 0xBD, + TrackNormal = 0xBE, + SlowTracking = 0xBF, + FrameForward = 0xC0, + FrameBack = 0xC1, + Mark = 0xC2, + ClearMark = 0xC3, + RepeatFromMark = 0xC4, + ReturnToMark = 0xC5, + SearchMarkForward = 0xC6, + SearchMarkBackwards = 0xC7, + CounterReset = 0xC8, + ShowCounter = 0xC9, + TrackingIncrement = 0xCA, + TrackingDecrement = 0xCB, + StopEject = 0xCC, + PlayPause = 0xCD, + PlaySkip = 0xCE, + Volume = 0xE0, + Balance = 0xE1, + Mute = 0xE2, + Bass = 0xE3, + Treble = 0xE4, + BassBoost = 0xE5, + SurroundMode = 0xE6, + Loudness = 0xE7, + Mpx = 0xE8, + VolumeIncrement = 0xE9, + VolumeDecrement = 0xEA, + SpeedSelect = 0xF0, + PlaybackSpeed = 0xF1, + StandardPlay = 0xF2, + LongPlay = 0xF3, + ExtendedPlay = 0xF4, + Slow = 0xF5, + FanEnable = 0x100, + FanSpeed = 0x101, + LightEnable = 0x102, + LightIlluminationLevel = 0x103, + ClimateControlEnable = 0x104, + RoomTemperature = 0x105, + SecurityEnable = 0x106, + FireAlarm = 0x107, + PoliceAlarm = 0x108, + Proximity = 0x109, + Motion = 0x10A, + DuressAlarm = 0x10B, + HoldupAlarm = 0x10C, + MedicalAlarm = 0x10D, + BalanceRight = 0x150, + BalanceLeft = 0x151, + BassIncrement = 0x152, + BassDecrement = 0x153, + TrebleIncrement = 0x154, + TrebleDecrement = 0x155, + SpeakerSystem = 0x160, + ChannelLeft = 0x161, + ChannelRight = 0x162, + ChannelCenter = 0x163, + ChannelFront = 0x164, + ChannelCenterFront = 0x165, + ChannelSide = 0x166, + ChannelSurround = 0x167, + ChannelLowFrequencyEnhancement = 0x168, + ChannelTop = 0x169, + ChannelUnknown = 0x16A, + SubChannel = 0x170, + SubChannelIncrement = 0x171, + SubChannelDecrement = 0x172, + AlternateAudioIncrement = 0x173, + AlternateAudioDecrement = 0x174, + ApplicationLaunchButtons = 0x180, + AppLaunchLaunchButtonConfigurationTool = 0x181, + AppLaunchProgrammableButtonConfiguration = 0x182, + AppLaunchConsumerControlConfiguration = 0x183, + AppLaunchWordProcessor = 0x184, + AppLaunchTextEditor = 0x185, + AppLaunchSpreadsheet = 0x186, + AppLaunchGraphicsEditor = 0x187, + AppLaunchPresentationApp = 0x188, + AppLaunchDatabaseApp = 0x189, + AppLaunchEmailReader = 0x18A, + AppLaunchNewsreader = 0x18B, + AppLaunchVoicemail = 0x18C, + AppLaunchContactsAddressBook = 0x18D, + AppLaunchCalendarSchedule = 0x18E, + AppLaunchTaskProjectManager = 0x18F, + AppLaunchLogJournalTimecard = 0x190, + AppLaunchCheckbookFinance = 0x191, + AppLaunchCalculator = 0x192, + AppLaunchAVCapturePlayback = 0x193, + AppLaunchLocalMachineBrowser = 0x194, + AppLaunchLanWanBrowser = 0x195, + AppLaunchInternetBrowser = 0x196, + AppLaunchRemoteNetworkingIspConnect = 0x197, + AppLaunchNetworkConference = 0x198, + AppLaunchNetworkChat = 0x199, + AppLaunchTelephonyDialer = 0x19A, + AppLaunchLogon = 0x19B, + AppLaunchLogoff = 0x19C, + AppLaunchLogonLogoff = 0x19D, + AppLaunchTerminalLockScreensaver = 0x19E, + AppLaunchControlPanel = 0x19F, + AppLaunchCommandLineProcessorRun = 0x1A0, + AppLaunchProcessTaskManager = 0x1A1, + AppLaunchSelectTaskApplication = 0x1A2, + AppLaunchNextTaskApplication = 0x1A3, + AppLaunchPreviousTaskApplication = 0x1A4, + AppLaunchPreemptiveHaltTaskApplication = 0x1A5, + AppLaunchIntegratedHelpCenter = 0x1A6, + AppLaunchDocuments = 0x1A7, + AppLaunchThesaurus = 0x1A8, + AppLaunchDictionary = 0x1A9, + AppLaunchDesktop = 0x1AA, + AppLaunchSpellCheck = 0x1AB, + AppLaunchGrammarCheck = 0x1AC, + AppLaunchWirelessStatus = 0x1AD, + AppLaunchKeyboardLayout = 0x1AE, + AppLaunchVirusProtection = 0x1AF, + AppLaunchEncryption = 0x1B0, + AppLaunchScreenSaver = 0x1B1, + AppLaunchAlarms = 0x1B2, + AppLaunchClock = 0x1B3, + AppLaunchFileBrowser = 0x1B4, + AppLaunchPowerStatus = 0x1B5, + AppLaunchImageBrowser = 0x1B6, + AppLaunchAudioBrowser = 0x1B7, + AppLaunchMovieBrowser = 0x1B8, + AppLaunchDigitalRightsManager = 0x1B9, + AppLaunchDigitalWallet = 0x1BA, + AppLaunchInstantMessaging = 0x1BC, + AppLaunchOemFeaturesTipsTutorialBrowser = 0x1BD, + AppLaunchOemHelp = 0x1BE, + AppLaunchOnlineCommunity = 0x1BF, + AppLaunchEntertainmentContentBrowser = 0x1C0, + AppLaunchOnlineShoppingBrowser = 0x1C1, + AppLaunchSmartcardInformationHelp = 0x1C2, + AppLaunchMarketMonitorFinanceBrowser = 0x1C3, + AppLaunchCustomizedCorporateNewsBrowser = 0x1C4, + AppLaunchOnlineActivityBrowser = 0x1C5, + AppLaunchResearchSearchBrowser = 0x1C6, + AppLaunchAudioPlayer = 0x1C7, + GenericGuiApplicationControls = 0x200, + AppCtrlNew = 0x201, + AppCtrlOpen = 0x202, + AppCtrlClose = 0x203, + AppCtrlExit = 0x204, + AppCtrlMaximize = 0x205, + AppCtrlMinimize = 0x206, + AppCtrlSave = 0x207, + AppCtrlPrint = 0x208, + AppCtrlProperties = 0x209, + AppCtrlUndo = 0x21A, + AppCtrlCopy = 0x21B, + AppCtrlCut = 0x21C, + AppCtrlPaste = 0x21D, + AppCtrlSelectAll = 0x21E, + AppCtrlFind = 0x21F, + AppCtrlFindAndReplace = 0x220, + AppCtrlSearch = 0x221, + AppCtrlGoTo = 0x222, + AppCtrlHome = 0x223, + AppCtrlBack = 0x224, + AppCtrlForward = 0x225, + AppCtrlStop = 0x226, + AppCtrlRefresh = 0x227, + AppCtrlPreviousLink = 0x228, + AppCtrlNextLink = 0x229, + AppCtrlBookmarks = 0x22A, + AppCtrlHistory = 0x22B, + AppCtrlSubscriptions = 0x22C, + AppCtrlZoomIn = 0x22D, + AppCtrlZoomOut = 0x22E, + AppCtrlZoom = 0x22F, + AppCtrlFullScreenView = 0x230, + AppCtrlNormalView = 0x231, + AppCtrlViewToggle = 0x232, + AppCtrlScrollUp = 0x233, + AppCtrlScrollDown = 0x234, + AppCtrlScroll = 0x235, + AppCtrlPanLeft = 0x236, + AppCtrlPanRight = 0x237, + AppCtrlPan = 0x238, + AppCtrlNewWindow = 0x239, + AppCtrlTileHorizontally = 0x23A, + AppCtrlTileVertically = 0x23B, + AppCtrlFormat = 0x23C, + AppCtrlEdit = 0x23D, + AppCtrlBold = 0x23E, + AppCtrlItalics = 0x23F, + AppCtrlUnderline = 0x240, + AppCtrlStrikethrough = 0x241, + AppCtrlSubscript = 0x242, + AppCtrlSuperscript = 0x243, + AppCtrlAllCaps = 0x244, + AppCtrlRotate = 0x245, + AppCtrlResize = 0x246, + AppCtrlFlipHorizontal = 0x247, + AppCtrlFlipVertical = 0x248, + AppCtrlMirrorHorizontal = 0x249, + AppCtrlMirrorVertical = 0x24A, + AppCtrlFontSelect = 0x24B, + AppCtrlFontColor = 0x24C, + AppCtrlFontSize = 0x24D, + AppCtrlJustifyLeft = 0x24E, + AppCtrlJustifyCenterH = 0x24F, + AppCtrlJustifyRight = 0x250, + AppCtrlJustifyBlockH = 0x251, + AppCtrlJustifyTop = 0x252, + AppCtrlJustifyCenterV = 0x253, + AppCtrlJustifyBottom = 0x254, + AppCtrlJustifyBlockV = 0x255, + AppCtrlIndentDecrease = 0x256, + AppCtrlIndentIncrease = 0x257, + AppCtrlNumberedList = 0x258, + AppCtrlRestartNumbering = 0x259, + AppCtrlBulletedList = 0x25A, + AppCtrlPromote = 0x25B, + AppCtrlDemote = 0x25C, + AppCtrlYes = 0x25D, + AppCtrlNo = 0x25E, + AppCtrlCancel = 0x25F, + AppCtrlCatalog = 0x260, + AppCtrlBuyCheckout = 0x261, + AppCtrlAddToCart = 0x262, + AppCtrlExpand = 0x263, + AppCtrlExpandAll = 0x264, + AppCtrlCollapse = 0x265, + AppCtrlCollapseAll = 0x266, + AppCtrlPrintPreview = 0x267, + AppCtrlPasteSpecial = 0x268, + AppCtrlInsertMode = 0x269, + AppCtrlDelete = 0x26A, + AppCtrlLock = 0x26B, + AppCtrlUnlock = 0x26C, + AppCtrlProtect = 0x26D, + AppCtrlUnprotect = 0x26E, + AppCtrlAttachComment = 0x26F, + AppCtrlDeleteComment = 0x270, + AppCtrlViewComment = 0x271, + AppCtrlSelectWord = 0x272, + AppCtrlSelectSentence = 0x273, + AppCtrlDistributeVertically = 0x29C } } } \ No newline at end of file diff -r 634ac38db225 -r ddfd2ddf10e1 genUsageTableEnum.pl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/genUsageTableEnum.pl Fri Dec 19 18:05:53 2014 +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=~ /^\#\s*define\s+(.+?)\s+([a-fA-FxX\d]+?)\s*$/) + if ($line=~ /^([a-fA-FxX\d]+)(.+)\s+\w+\s+15\..*$/) + { + 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 + } +