Getting our HID consts organized. Adding some consumer controls.
1.1 --- a/Form1.cs Wed Nov 05 20:58:15 2014 +0100
1.2 +++ b/Form1.cs Thu Nov 06 21:57:53 2014 +0100
1.3 @@ -127,15 +127,15 @@
1.4 {
1.5 label1.Text = e.Button.ToString();
1.6 }
1.7 - else if (e.MceButton != MceButton.Null)
1.8 + else if (e.MceButton != Hid.UsageTables.MceButton.Null)
1.9 {
1.10 //Display MCE button name
1.11 label1.Text = e.MceButton.ToString();
1.12 //Check if this is an HP extension
1.13 - if (Enum.IsDefined(typeof(HpMceButton), (int)e.MceButton))
1.14 + if (Enum.IsDefined(typeof(Hid.UsageTables.HpMceButton), (int)e.MceButton))
1.15 {
1.16 //Also display HP button name
1.17 - label1.Text += " / HP:" + ((HpMceButton)e.MceButton).ToString();
1.18 + label1.Text += " / HP:" + ((Hid.UsageTables.HpMceButton)e.MceButton).ToString();
1.19 }
1.20 }
1.21 else
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/HumanInterfaceDevice.cs Thu Nov 06 21:57:53 2014 +0100
2.3 @@ -0,0 +1,260 @@
2.4 +//
2.5 +//
2.6 +//
2.7 +
2.8 +namespace Hid
2.9 +{
2.10 + /// <summary>
2.11 + /// From USB HID usage tables.
2.12 + /// http://www.usb.org/developers/hidpage#HID_Usage
2.13 + /// http://www.usb.org/developers/devclass_docs/Hut1_12v2.pdf
2.14 + /// </summary>
2.15 + public enum UsagePage : ushort
2.16 + {
2.17 + Undefined = 0,
2.18 + GenericDesktopControl,
2.19 + SimulationControl,
2.20 + VirtualRealityControl,
2.21 + SportControl,
2.22 + GameControl,
2.23 + GenericDeviceControl,
2.24 + Keyboard,
2.25 + LightEmittingDiode,
2.26 + Button,
2.27 + Ordinal,
2.28 + Telephony,
2.29 + Consumer,
2.30 + Digitiser,
2.31 + PhysicalInterfaceDevice = 0x0f,
2.32 + Unicode = 0x10,
2.33 + AlphaNumericDisplay = 0x14,
2.34 + MedicalInstruments = 0x40,
2.35 + MonitorPage0 = 0x80,
2.36 + MonitorPage1,
2.37 + MonitorPage2,
2.38 + MonitorPage3,
2.39 + PowerPage0,
2.40 + PowerPage1,
2.41 + PowerPage2,
2.42 + PowerPage3,
2.43 + BarCodeScanner = 0x8c,
2.44 + Scale,
2.45 + MagneticStripeReader,
2.46 + ReservedPointOfSale,
2.47 + CameraControl,
2.48 + Arcade,
2.49 + // http://msdn.microsoft.com/en-us/library/windows/desktop/bb417079.aspx
2.50 + MceRemote = 0xffbc,
2.51 + TerraTecRemote = 0xffcc
2.52 + }
2.53 +
2.54 + /// <summary>
2.55 +///
2.56 +/// </summary>
2.57 + public enum UsageId: ushort
2.58 + {
2.59 + MceRemoteUsage = 0x88,
2.60 + ConsumerControl = 0x01
2.61 + }
2.62 +
2.63 +
2.64 +
2.65 + namespace UsageTables
2.66 + {
2.67 + /// <summary>
2.68 + ///
2.69 + /// </summary>
2.70 + public enum MceButton
2.71 + {
2.72 + /// <summary>
2.73 + /// Not defined by the Microsoft specs.
2.74 + /// </summary>
2.75 + Null = 0x00,
2.76 + GreenStart = 0x0D,
2.77 + ClosedCaptioning = 0x2B,
2.78 + Teletext = 0x5A,
2.79 + TeletextRed = 0x5B,
2.80 + TeletextGreen = 0x5C,
2.81 + TeletextYellow = 0x5D,
2.82 + TeletextBlue = 0x5E,
2.83 + LiveTv = 0x25,
2.84 + Music = 0x47,
2.85 + RecordedTv = 0x48,
2.86 + Pictures = 0x49,
2.87 + Videos = 0x4A,
2.88 + FmRadio = 0x50,
2.89 + Extras = 0x3C,
2.90 + ExtrasApp = 0x3D,
2.91 + DvdMenu = 0x24,
2.92 + DvdAngle = 0x4B,
2.93 + DvdAudio = 0x4C,
2.94 + DvdSubtitle = 0x4D,
2.95 + /// <summary>
2.96 + /// First press action: Ejects a DVD drive.
2.97 + /// <para />
2.98 + /// Second press action: Repeats first press action.
2.99 + /// <para />
2.100 + /// Notably issued by XBOX360 remote as defined in irplus - Remote Control - Android application.
2.101 + /// </summary>
2.102 + Eject = 0x28,
2.103 + DvdTopMenu = 0x43,
2.104 + /// <summary>
2.105 + /// First press action: Generates EXTn HID message in the Media Center Vendor Specific
2.106 + /// Collection (page 0xFFBC, usage 0x88).
2.107 + /// <para />
2.108 + /// Second press action: Repeats message.
2.109 + /// <para />
2.110 + /// Auto-repeat: No
2.111 + /// <para />
2.112 + /// Notably sent by the 'Visualization' button of HP Windows Media Center Remote (TSGH-IR08).
2.113 + /// <para />
2.114 + /// According to HP specs it displays visual imagery that is synchronized to the sound of your music tracks.
2.115 + /// </summary>
2.116 + Ext0 = 0x32,
2.117 + /// <summary>
2.118 + /// First press action: Generates EXTn HID message in the Media Center Vendor Specific
2.119 + /// Collection (page 0xFFBC, usage 0x88).
2.120 + /// <para />
2.121 + /// Second press action: Repeats message.
2.122 + /// <para />
2.123 + /// Auto-repeat: No
2.124 + /// <para />
2.125 + /// Notably sent by the 'Slide Show' button of HP Windows Media Center Remote (TSGH-IR08).
2.126 + /// <para />
2.127 + /// According to HP specs it plays a slide show of all the pictures on your hard disk drive.
2.128 + /// </summary>
2.129 + Ext1 = 0x33,
2.130 + /// <summary>
2.131 + /// First press action: Generates EXTn HID message in the Media Center Vendor Specific
2.132 + /// Collection (page 0xFFBC, usage 0x88).
2.133 + /// <para />
2.134 + /// Second press action: Repeats message.
2.135 + /// <para />
2.136 + /// Auto-repeat: No
2.137 + /// <para />
2.138 + /// Notably sent by the 'Eject' button of HP Windows Media Center Remote (TSGH-IR08).
2.139 + /// Also interpreted as 'Eject' action by SoundGraph iMON Manager in MCE mode (OrigenAE VF310).
2.140 + /// </summary>
2.141 + Ext2 = 0x34,
2.142 + /// <summary>
2.143 + /// First press action: Generates EXTn HID message in the Media Center Vendor Specific
2.144 + /// Collection (page 0xFFBC, usage 0x88).
2.145 + /// <para />
2.146 + /// Second press action: Repeats message.
2.147 + /// <para />
2.148 + /// Auto-repeat: No
2.149 + /// <para />
2.150 + /// Notably sent by the 'Input selection' button of HP Windows Media Center Remote (TSGH-IR08).
2.151 + /// </summary>
2.152 + Ext3 = 0x35,
2.153 + Ext4 = 0x36,
2.154 + Ext5 = 0x37,
2.155 + Ext6 = 0x38,
2.156 + Ext7 = 0x39,
2.157 + Ext8 = 0x3A,
2.158 + Ext9 = 0x80,
2.159 + Ext10 = 0x81,
2.160 + Ext11 = 0x6F,
2.161 + Zoom = 0x27,
2.162 + ChannelInput = 0x42,
2.163 + SubAudio = 0x2D,
2.164 + Channel10 = 0x3E,
2.165 + Channel11 = 0x3F,
2.166 + Channel12 = 0x40,
2.167 + /// <summary>
2.168 + /// First press action: Generates OEM2 HID message in the Media Center Vendor Specific
2.169 + /// Collection. This button is intended to control the front panel display of home entertainment
2.170 + /// computers. When this button is pressed, the display could be turned on or off, or the display
2.171 + /// mode could change.
2.172 + /// <para />
2.173 + /// Second press action: Repeats message.
2.174 + /// <para />
2.175 + /// Auto-repeat: No
2.176 + /// <para />
2.177 + /// Notably issued by XBOX360 remote as defined in irplus - Remote Control - Android application.
2.178 + /// </summary>
2.179 + Display = 0x4F,
2.180 + /// <summary>
2.181 + /// First press action: To be determined.
2.182 + /// <para />
2.183 + /// Second press action: Repeats message.
2.184 + /// <para />
2.185 + /// Auto-repeat: No
2.186 + /// </summary>
2.187 + Kiosk = 0x6A,
2.188 + NetworkSelection = 0x2C,
2.189 + BlueRayTool = 0x78,
2.190 + ChannelInfo = 0x41,
2.191 + VideoSelection = 0x61
2.192 + }
2.193 +
2.194 + public enum HpMceButton: ushort
2.195 + {
2.196 + /// <summary>
2.197 + /// Displays visual imagery that is synchronized to the sound of your music tracks.
2.198 + /// <para />
2.199 + /// Second press action: Repeats message.
2.200 + /// <para />
2.201 + /// Auto-repeat: No
2.202 + /// <para />
2.203 + /// Notably sent by the 'Visualization' button of HP Windows Media Center Remote (TSGH-IR08).
2.204 + /// <para />
2.205 + /// According to HP specs it displays visual imagery that is synchronized to the sound of your music tracks.
2.206 + /// </summary>
2.207 + Visualization = MceButton.Ext0,
2.208 + /// <summary>
2.209 + /// Plays a slide show of all the pictures on your hard disk drive.
2.210 + /// <para />
2.211 + /// Second press action: Repeats message.
2.212 + /// <para />
2.213 + /// Auto-repeat: No
2.214 + /// <para />
2.215 + /// Notably sent by the 'Slide Show' button of HP Windows Media Center Remote (TSGH-IR08).
2.216 + /// <para />
2.217 + /// According to HP specs it plays a slide show of all the pictures on your hard disk drive.
2.218 + /// </summary>
2.219 + SlideShow = MceButton.Ext1,
2.220 + /// <summary>
2.221 + /// Eject optical drive.
2.222 + /// <para />
2.223 + /// Second press action: Repeats message.
2.224 + /// <para />
2.225 + /// Auto-repeat: No
2.226 + /// <para />
2.227 + /// Notably sent by the 'Eject' button of HP Windows Media Center Remote (TSGH-IR08).
2.228 + /// Also interpreted as 'Eject' action by SoundGraph iMON Manager in MCE mode (OrigenAE VF310).
2.229 + /// </summary>
2.230 + Eject = MceButton.Ext2,
2.231 + /// <summary>
2.232 + /// Not sure what this should do.
2.233 + /// <para />
2.234 + /// Second press action: Repeats message.
2.235 + /// <para />
2.236 + /// Auto-repeat: No
2.237 + /// <para />
2.238 + /// Notably sent by the 'Input selection' button of HP Windows Media Center Remote (TSGH-IR08).
2.239 + /// </summary>
2.240 + InputSelection = MceButton.Ext3,
2.241 + }
2.242 +
2.243 + /// <summary>
2.244 + /// Usage Table for Consumer Controls
2.245 + /// 0x0C 0X01
2.246 + /// </summary>
2.247 + public enum ConsumerControl: ushort
2.248 + {
2.249 + /// <summary>
2.250 + /// Sent by MCE remotes.
2.251 + /// </summary>
2.252 + MediaSelectProgramGuide = 0x008D,
2.253 + /// <summary>
2.254 + /// Sent by MCE remotes.
2.255 + /// </summary>
2.256 + AppCtrlPrint = 0x0208,
2.257 + /// <summary>
2.258 + /// Sent by MCE remotes from the 'I' Informations or More Info buttons.
2.259 + /// </summary>
2.260 + AppCtrlProperties = 0x0209
2.261 + }
2.262 + }
2.263 +}
2.264 \ No newline at end of file
3.1 --- a/RemoteControlDevice.cs Wed Nov 05 20:58:15 2014 +0100
3.2 +++ b/RemoteControlDevice.cs Thu Nov 06 21:57:53 2014 +0100
3.3 @@ -2,59 +2,12 @@
3.4 using System.Windows.Forms;
3.5 using System.Runtime.InteropServices;
3.6 using System.Diagnostics;
3.7 -
3.8 +using Hid.UsageTables;
3.9
3.10 namespace Devices.RemoteControl
3.11 {
3.12
3.13 - public static class Hid
3.14 - {
3.15 - /// <summary>
3.16 - /// From USB HID usage tables.
3.17 - /// http://www.usb.org/developers/hidpage#HID_Usage
3.18 - /// http://www.usb.org/developers/devclass_docs/Hut1_12v2.pdf
3.19 - /// </summary>
3.20 - public enum UsagePage : ushort
3.21 - {
3.22 - Undefined = 0,
3.23 - GenericDesktopControl,
3.24 - SimulationControl,
3.25 - VirtualRealityControl,
3.26 - SportControl,
3.27 - GameControl,
3.28 - GenericDeviceControl,
3.29 - Keyboard,
3.30 - LightEmittingDiode,
3.31 - Button,
3.32 - Ordinal,
3.33 - Telephony,
3.34 - Consumer,
3.35 - Digitiser,
3.36 - PhysicalInterfaceDevice = 0x0f,
3.37 - Unicode = 0x10,
3.38 - AlphaNumericDisplay = 0x14,
3.39 - MedicalInstruments = 0x40,
3.40 - MonitorPage0 = 0x80,
3.41 - MonitorPage1,
3.42 - MonitorPage2,
3.43 - MonitorPage3,
3.44 - PowerPage0,
3.45 - PowerPage1,
3.46 - PowerPage2,
3.47 - PowerPage3,
3.48 - BarCodeScanner = 0x8c,
3.49 - Scale,
3.50 - MagneticStripeReader,
3.51 - ReservedPointOfSale,
3.52 - CameraControl,
3.53 - Arcade,
3.54 - // http://msdn.microsoft.com/en-us/library/windows/desktop/bb417079.aspx
3.55 - MceRemote = 0xffbc,
3.56 - TerraTecRemote = 0xffcc
3.57 - }
3.58 -
3.59 - public const ushort MceRemoteUsage = 0x88;
3.60 - }
3.61 +
3.62
3.63
3.64 public enum InputDevice
3.65 @@ -120,183 +73,6 @@
3.66 Unknown
3.67 }
3.68
3.69 - /// <summary>
3.70 - ///
3.71 - /// </summary>
3.72 - public enum MceButton
3.73 - {
3.74 - /// <summary>
3.75 - /// Not defined by the Microsoft specs.
3.76 - /// </summary>
3.77 - Null = 0x00,
3.78 - GreenStart = 0x0D,
3.79 - ClosedCaptioning = 0x2B,
3.80 - Teletext = 0x5A,
3.81 - TeletextRed = 0x5B,
3.82 - TeletextGreen = 0x5C,
3.83 - TeletextYellow = 0x5D,
3.84 - TeletextBlue = 0x5E,
3.85 - LiveTv = 0x25,
3.86 - Music = 0x47,
3.87 - RecordedTv = 0x48,
3.88 - Pictures = 0x49,
3.89 - Videos = 0x4A,
3.90 - FmRadio = 0x50,
3.91 - Extras = 0x3C,
3.92 - ExtrasApp = 0x3D,
3.93 - DvdMenu = 0x24,
3.94 - DvdAngle = 0x4B,
3.95 - DvdAudio = 0x4C,
3.96 - DvdSubtitle = 0x4D,
3.97 - /// <summary>
3.98 - /// First press action: Ejects a DVD drive.
3.99 - /// <para />
3.100 - /// Second press action: Repeats first press action.
3.101 - /// <para />
3.102 - /// Notably issued by XBOX360 remote as defined in irplus - Remote Control - Android application.
3.103 - /// </summary>
3.104 - Eject = 0x28,
3.105 - DvdTopMenu = 0x43,
3.106 - /// <summary>
3.107 - /// First press action: Generates EXTn HID message in the Media Center Vendor Specific
3.108 - /// Collection (page 0xFFBC, usage 0x88).
3.109 - /// <para />
3.110 - /// Second press action: Repeats message.
3.111 - /// <para />
3.112 - /// Auto-repeat: No
3.113 - /// <para />
3.114 - /// Notably sent by the 'Visualization' button of HP Windows Media Center Remote (TSGH-IR08).
3.115 - /// <para />
3.116 - /// According to HP specs it displays visual imagery that is synchronized to the sound of your music tracks.
3.117 - /// </summary>
3.118 - Ext0 = 0x32,
3.119 - /// <summary>
3.120 - /// First press action: Generates EXTn HID message in the Media Center Vendor Specific
3.121 - /// Collection (page 0xFFBC, usage 0x88).
3.122 - /// <para />
3.123 - /// Second press action: Repeats message.
3.124 - /// <para />
3.125 - /// Auto-repeat: No
3.126 - /// <para />
3.127 - /// Notably sent by the 'Slide Show' button of HP Windows Media Center Remote (TSGH-IR08).
3.128 - /// <para />
3.129 - /// According to HP specs it plays a slide show of all the pictures on your hard disk drive.
3.130 - /// </summary>
3.131 - Ext1 = 0x33,
3.132 - /// <summary>
3.133 - /// First press action: Generates EXTn HID message in the Media Center Vendor Specific
3.134 - /// Collection (page 0xFFBC, usage 0x88).
3.135 - /// <para />
3.136 - /// Second press action: Repeats message.
3.137 - /// <para />
3.138 - /// Auto-repeat: No
3.139 - /// <para />
3.140 - /// Notably sent by the 'Eject' button of HP Windows Media Center Remote (TSGH-IR08).
3.141 - /// Also interpreted as 'Eject' action by SoundGraph iMON Manager in MCE mode (OrigenAE VF310).
3.142 - /// </summary>
3.143 - Ext2 = 0x34,
3.144 - /// <summary>
3.145 - /// First press action: Generates EXTn HID message in the Media Center Vendor Specific
3.146 - /// Collection (page 0xFFBC, usage 0x88).
3.147 - /// <para />
3.148 - /// Second press action: Repeats message.
3.149 - /// <para />
3.150 - /// Auto-repeat: No
3.151 - /// <para />
3.152 - /// Notably sent by the 'Input selection' button of HP Windows Media Center Remote (TSGH-IR08).
3.153 - /// </summary>
3.154 - Ext3 = 0x35,
3.155 - Ext4 = 0x36,
3.156 - Ext5 = 0x37,
3.157 - Ext6 = 0x38,
3.158 - Ext7 = 0x39,
3.159 - Ext8 = 0x3A,
3.160 - Ext9 = 0x80,
3.161 - Ext10 = 0x81,
3.162 - Ext11 = 0x6F,
3.163 - Zoom = 0x27,
3.164 - ChannelInput = 0x42,
3.165 - SubAudio = 0x2D,
3.166 - Channel10 = 0x3E,
3.167 - Channel11 = 0x3F,
3.168 - Channel12 = 0x40,
3.169 - /// <summary>
3.170 - /// First press action: Generates OEM2 HID message in the Media Center Vendor Specific
3.171 - /// Collection. This button is intended to control the front panel display of home entertainment
3.172 - /// computers. When this button is pressed, the display could be turned on or off, or the display
3.173 - /// mode could change.
3.174 - /// <para />
3.175 - /// Second press action: Repeats message.
3.176 - /// <para />
3.177 - /// Auto-repeat: No
3.178 - /// <para />
3.179 - /// Notably issued by XBOX360 remote as defined in irplus - Remote Control - Android application.
3.180 - /// </summary>
3.181 - Display = 0x4F,
3.182 - /// <summary>
3.183 - /// First press action: To be determined.
3.184 - /// <para />
3.185 - /// Second press action: Repeats message.
3.186 - /// <para />
3.187 - /// Auto-repeat: No
3.188 - /// </summary>
3.189 - Kiosk = 0x6A,
3.190 - NetworkSelection = 0x2C,
3.191 - BlueRayTool = 0x78,
3.192 - ChannelInfo = 0x41,
3.193 - VideoSelection = 0x61
3.194 - }
3.195 -
3.196 - public enum HpMceButton
3.197 - {
3.198 - /// <summary>
3.199 - /// Displays visual imagery that is synchronized to the sound of your music tracks.
3.200 - /// <para />
3.201 - /// Second press action: Repeats message.
3.202 - /// <para />
3.203 - /// Auto-repeat: No
3.204 - /// <para />
3.205 - /// Notably sent by the 'Visualization' button of HP Windows Media Center Remote (TSGH-IR08).
3.206 - /// <para />
3.207 - /// According to HP specs it displays visual imagery that is synchronized to the sound of your music tracks.
3.208 - /// </summary>
3.209 - Visualization = MceButton.Ext0,
3.210 - /// <summary>
3.211 - /// Plays a slide show of all the pictures on your hard disk drive.
3.212 - /// <para />
3.213 - /// Second press action: Repeats message.
3.214 - /// <para />
3.215 - /// Auto-repeat: No
3.216 - /// <para />
3.217 - /// Notably sent by the 'Slide Show' button of HP Windows Media Center Remote (TSGH-IR08).
3.218 - /// <para />
3.219 - /// According to HP specs it plays a slide show of all the pictures on your hard disk drive.
3.220 - /// </summary>
3.221 - SlideShow = MceButton.Ext1,
3.222 - /// <summary>
3.223 - /// Eject optical drive.
3.224 - /// <para />
3.225 - /// Second press action: Repeats message.
3.226 - /// <para />
3.227 - /// Auto-repeat: No
3.228 - /// <para />
3.229 - /// Notably sent by the 'Eject' button of HP Windows Media Center Remote (TSGH-IR08).
3.230 - /// Also interpreted as 'Eject' action by SoundGraph iMON Manager in MCE mode (OrigenAE VF310).
3.231 - /// </summary>
3.232 - Eject = MceButton.Ext2,
3.233 - /// <summary>
3.234 - /// Not sure what this should do.
3.235 - /// <para />
3.236 - /// Second press action: Repeats message.
3.237 - /// <para />
3.238 - /// Auto-repeat: No
3.239 - /// <para />
3.240 - /// Notably sent by the 'Input selection' button of HP Windows Media Center Remote (TSGH-IR08).
3.241 - /// </summary>
3.242 - InputSelection = MceButton.Ext3,
3.243 - }
3.244 -
3.245 -
3.246
3.247 #region RemoteControlEventArgs
3.248
3.249 @@ -843,7 +619,7 @@
3.250 Debug.WriteLine(hidDump);
3.251
3.252 //Make sure both usage page and usage are matching MCE remote
3.253 - if (deviceInfo.hid.usUsagePage != (ushort)Hid.UsagePage.MceRemote || deviceInfo.hid.usUsage != (ushort)Hid.MceRemoteUsage)
3.254 + if (deviceInfo.hid.usUsagePage != (ushort)Hid.UsagePage.MceRemote || deviceInfo.hid.usUsage != (ushort)Hid.UsageId.MceRemoteUsage)
3.255 {
3.256 Debug.WriteLine("Not MCE remote page and usage.");
3.257 return;
4.1 --- a/RemoteControlSample.csproj Wed Nov 05 20:58:15 2014 +0100
4.2 +++ b/RemoteControlSample.csproj Thu Nov 06 21:57:53 2014 +0100
4.3 @@ -127,6 +127,7 @@
4.4 <Compile Include="Form1.cs">
4.5 <SubType>Form</SubType>
4.6 </Compile>
4.7 + <Compile Include="HumanInterfaceDevice.cs" />
4.8 <Compile Include="RemoteControlDevice.cs">
4.9 <SubType>Code</SubType>
4.10 </Compile>