# HG changeset patch
# User sl
# Date 1415307473 -3600
# Node ID 0d0c62b1df48f3e6bfb057ccc35f7e3c4eb00f60
# Parent 5ecebf1bd3972595190cb7a4b995f3eea36070c4
Getting our HID consts organized. Adding some consumer controls.
diff -r 5ecebf1bd397 -r 0d0c62b1df48 Form1.cs
--- a/Form1.cs Wed Nov 05 20:58:15 2014 +0100
+++ b/Form1.cs Thu Nov 06 21:57:53 2014 +0100
@@ -127,15 +127,15 @@
{
label1.Text = e.Button.ToString();
}
- else if (e.MceButton != MceButton.Null)
+ else if (e.MceButton != Hid.UsageTables.MceButton.Null)
{
//Display MCE button name
label1.Text = e.MceButton.ToString();
//Check if this is an HP extension
- if (Enum.IsDefined(typeof(HpMceButton), (int)e.MceButton))
+ if (Enum.IsDefined(typeof(Hid.UsageTables.HpMceButton), (int)e.MceButton))
{
//Also display HP button name
- label1.Text += " / HP:" + ((HpMceButton)e.MceButton).ToString();
+ label1.Text += " / HP:" + ((Hid.UsageTables.HpMceButton)e.MceButton).ToString();
}
}
else
diff -r 5ecebf1bd397 -r 0d0c62b1df48 HumanInterfaceDevice.cs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/HumanInterfaceDevice.cs Thu Nov 06 21:57:53 2014 +0100
@@ -0,0 +1,260 @@
+//
+//
+//
+
+namespace Hid
+{
+ ///
+ /// From USB HID usage tables.
+ /// http://www.usb.org/developers/hidpage#HID_Usage
+ /// http://www.usb.org/developers/devclass_docs/Hut1_12v2.pdf
+ ///
+ public enum UsagePage : ushort
+ {
+ Undefined = 0,
+ GenericDesktopControl,
+ SimulationControl,
+ VirtualRealityControl,
+ SportControl,
+ GameControl,
+ GenericDeviceControl,
+ Keyboard,
+ LightEmittingDiode,
+ Button,
+ Ordinal,
+ Telephony,
+ Consumer,
+ Digitiser,
+ PhysicalInterfaceDevice = 0x0f,
+ Unicode = 0x10,
+ AlphaNumericDisplay = 0x14,
+ MedicalInstruments = 0x40,
+ MonitorPage0 = 0x80,
+ MonitorPage1,
+ MonitorPage2,
+ MonitorPage3,
+ PowerPage0,
+ PowerPage1,
+ PowerPage2,
+ PowerPage3,
+ BarCodeScanner = 0x8c,
+ Scale,
+ MagneticStripeReader,
+ ReservedPointOfSale,
+ CameraControl,
+ Arcade,
+ // http://msdn.microsoft.com/en-us/library/windows/desktop/bb417079.aspx
+ MceRemote = 0xffbc,
+ TerraTecRemote = 0xffcc
+ }
+
+ ///
+///
+///
+ public enum UsageId: ushort
+ {
+ MceRemoteUsage = 0x88,
+ ConsumerControl = 0x01
+ }
+
+
+
+ namespace UsageTables
+ {
+ ///
+ ///
+ ///
+ public enum MceButton
+ {
+ ///
+ /// Not defined by the Microsoft specs.
+ ///
+ Null = 0x00,
+ GreenStart = 0x0D,
+ ClosedCaptioning = 0x2B,
+ Teletext = 0x5A,
+ TeletextRed = 0x5B,
+ TeletextGreen = 0x5C,
+ TeletextYellow = 0x5D,
+ TeletextBlue = 0x5E,
+ LiveTv = 0x25,
+ Music = 0x47,
+ RecordedTv = 0x48,
+ Pictures = 0x49,
+ Videos = 0x4A,
+ FmRadio = 0x50,
+ Extras = 0x3C,
+ ExtrasApp = 0x3D,
+ DvdMenu = 0x24,
+ DvdAngle = 0x4B,
+ DvdAudio = 0x4C,
+ DvdSubtitle = 0x4D,
+ ///
+ /// First press action: Ejects a DVD drive.
+ ///
+ /// Second press action: Repeats first press action.
+ ///
+ /// Notably issued by XBOX360 remote as defined in irplus - Remote Control - Android application.
+ ///
+ Eject = 0x28,
+ DvdTopMenu = 0x43,
+ ///
+ /// First press action: Generates EXTn HID message in the Media Center Vendor Specific
+ /// Collection (page 0xFFBC, usage 0x88).
+ ///
+ /// Second press action: Repeats message.
+ ///
+ /// Auto-repeat: No
+ ///
+ /// Notably sent by the 'Visualization' button of HP Windows Media Center Remote (TSGH-IR08).
+ ///
+ /// According to HP specs it displays visual imagery that is synchronized to the sound of your music tracks.
+ ///
+ Ext0 = 0x32,
+ ///
+ /// First press action: Generates EXTn HID message in the Media Center Vendor Specific
+ /// Collection (page 0xFFBC, usage 0x88).
+ ///
+ /// Second press action: Repeats message.
+ ///
+ /// Auto-repeat: No
+ ///
+ /// Notably sent by the 'Slide Show' button of HP Windows Media Center Remote (TSGH-IR08).
+ ///
+ /// According to HP specs it plays a slide show of all the pictures on your hard disk drive.
+ ///
+ Ext1 = 0x33,
+ ///
+ /// First press action: Generates EXTn HID message in the Media Center Vendor Specific
+ /// Collection (page 0xFFBC, usage 0x88).
+ ///
+ /// Second press action: Repeats message.
+ ///
+ /// Auto-repeat: No
+ ///
+ /// Notably sent by the 'Eject' button of HP Windows Media Center Remote (TSGH-IR08).
+ /// Also interpreted as 'Eject' action by SoundGraph iMON Manager in MCE mode (OrigenAE VF310).
+ ///
+ Ext2 = 0x34,
+ ///
+ /// First press action: Generates EXTn HID message in the Media Center Vendor Specific
+ /// Collection (page 0xFFBC, usage 0x88).
+ ///
+ /// Second press action: Repeats message.
+ ///
+ /// Auto-repeat: No
+ ///
+ /// Notably sent by the 'Input selection' button of HP Windows Media Center Remote (TSGH-IR08).
+ ///
+ Ext3 = 0x35,
+ Ext4 = 0x36,
+ Ext5 = 0x37,
+ Ext6 = 0x38,
+ Ext7 = 0x39,
+ Ext8 = 0x3A,
+ Ext9 = 0x80,
+ Ext10 = 0x81,
+ Ext11 = 0x6F,
+ Zoom = 0x27,
+ ChannelInput = 0x42,
+ SubAudio = 0x2D,
+ Channel10 = 0x3E,
+ Channel11 = 0x3F,
+ Channel12 = 0x40,
+ ///
+ /// First press action: Generates OEM2 HID message in the Media Center Vendor Specific
+ /// Collection. This button is intended to control the front panel display of home entertainment
+ /// computers. When this button is pressed, the display could be turned on or off, or the display
+ /// mode could change.
+ ///
+ /// Second press action: Repeats message.
+ ///
+ /// Auto-repeat: No
+ ///
+ /// Notably issued by XBOX360 remote as defined in irplus - Remote Control - Android application.
+ ///
+ Display = 0x4F,
+ ///
+ /// First press action: To be determined.
+ ///
+ /// Second press action: Repeats message.
+ ///
+ /// Auto-repeat: No
+ ///
+ Kiosk = 0x6A,
+ NetworkSelection = 0x2C,
+ BlueRayTool = 0x78,
+ ChannelInfo = 0x41,
+ VideoSelection = 0x61
+ }
+
+ public enum HpMceButton: ushort
+ {
+ ///
+ /// Displays visual imagery that is synchronized to the sound of your music tracks.
+ ///
+ /// Second press action: Repeats message.
+ ///
+ /// Auto-repeat: No
+ ///
+ /// Notably sent by the 'Visualization' button of HP Windows Media Center Remote (TSGH-IR08).
+ ///
+ /// According to HP specs it displays visual imagery that is synchronized to the sound of your music tracks.
+ ///
+ Visualization = MceButton.Ext0,
+ ///
+ /// Plays a slide show of all the pictures on your hard disk drive.
+ ///
+ /// Second press action: Repeats message.
+ ///
+ /// Auto-repeat: No
+ ///
+ /// Notably sent by the 'Slide Show' button of HP Windows Media Center Remote (TSGH-IR08).
+ ///
+ /// According to HP specs it plays a slide show of all the pictures on your hard disk drive.
+ ///
+ SlideShow = MceButton.Ext1,
+ ///
+ /// Eject optical drive.
+ ///
+ /// Second press action: Repeats message.
+ ///
+ /// Auto-repeat: No
+ ///
+ /// Notably sent by the 'Eject' button of HP Windows Media Center Remote (TSGH-IR08).
+ /// Also interpreted as 'Eject' action by SoundGraph iMON Manager in MCE mode (OrigenAE VF310).
+ ///
+ Eject = MceButton.Ext2,
+ ///
+ /// Not sure what this should do.
+ ///
+ /// Second press action: Repeats message.
+ ///
+ /// Auto-repeat: No
+ ///
+ /// Notably sent by the 'Input selection' button of HP Windows Media Center Remote (TSGH-IR08).
+ ///
+ InputSelection = MceButton.Ext3,
+ }
+
+ ///
+ /// Usage Table for Consumer Controls
+ /// 0x0C 0X01
+ ///
+ public enum ConsumerControl: ushort
+ {
+ ///
+ /// Sent by MCE remotes.
+ ///
+ MediaSelectProgramGuide = 0x008D,
+ ///
+ /// Sent by MCE remotes.
+ ///
+ AppCtrlPrint = 0x0208,
+ ///
+ /// Sent by MCE remotes from the 'I' Informations or More Info buttons.
+ ///
+ AppCtrlProperties = 0x0209
+ }
+ }
+}
\ No newline at end of file
diff -r 5ecebf1bd397 -r 0d0c62b1df48 RemoteControlDevice.cs
--- a/RemoteControlDevice.cs Wed Nov 05 20:58:15 2014 +0100
+++ b/RemoteControlDevice.cs Thu Nov 06 21:57:53 2014 +0100
@@ -2,59 +2,12 @@
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Diagnostics;
-
+using Hid.UsageTables;
namespace Devices.RemoteControl
{
- public static class Hid
- {
- ///
- /// From USB HID usage tables.
- /// http://www.usb.org/developers/hidpage#HID_Usage
- /// http://www.usb.org/developers/devclass_docs/Hut1_12v2.pdf
- ///
- public enum UsagePage : ushort
- {
- Undefined = 0,
- GenericDesktopControl,
- SimulationControl,
- VirtualRealityControl,
- SportControl,
- GameControl,
- GenericDeviceControl,
- Keyboard,
- LightEmittingDiode,
- Button,
- Ordinal,
- Telephony,
- Consumer,
- Digitiser,
- PhysicalInterfaceDevice = 0x0f,
- Unicode = 0x10,
- AlphaNumericDisplay = 0x14,
- MedicalInstruments = 0x40,
- MonitorPage0 = 0x80,
- MonitorPage1,
- MonitorPage2,
- MonitorPage3,
- PowerPage0,
- PowerPage1,
- PowerPage2,
- PowerPage3,
- BarCodeScanner = 0x8c,
- Scale,
- MagneticStripeReader,
- ReservedPointOfSale,
- CameraControl,
- Arcade,
- // http://msdn.microsoft.com/en-us/library/windows/desktop/bb417079.aspx
- MceRemote = 0xffbc,
- TerraTecRemote = 0xffcc
- }
-
- public const ushort MceRemoteUsage = 0x88;
- }
+
public enum InputDevice
@@ -120,183 +73,6 @@
Unknown
}
- ///
- ///
- ///
- public enum MceButton
- {
- ///
- /// Not defined by the Microsoft specs.
- ///
- Null = 0x00,
- GreenStart = 0x0D,
- ClosedCaptioning = 0x2B,
- Teletext = 0x5A,
- TeletextRed = 0x5B,
- TeletextGreen = 0x5C,
- TeletextYellow = 0x5D,
- TeletextBlue = 0x5E,
- LiveTv = 0x25,
- Music = 0x47,
- RecordedTv = 0x48,
- Pictures = 0x49,
- Videos = 0x4A,
- FmRadio = 0x50,
- Extras = 0x3C,
- ExtrasApp = 0x3D,
- DvdMenu = 0x24,
- DvdAngle = 0x4B,
- DvdAudio = 0x4C,
- DvdSubtitle = 0x4D,
- ///
- /// First press action: Ejects a DVD drive.
- ///
- /// Second press action: Repeats first press action.
- ///
- /// Notably issued by XBOX360 remote as defined in irplus - Remote Control - Android application.
- ///
- Eject = 0x28,
- DvdTopMenu = 0x43,
- ///
- /// First press action: Generates EXTn HID message in the Media Center Vendor Specific
- /// Collection (page 0xFFBC, usage 0x88).
- ///
- /// Second press action: Repeats message.
- ///
- /// Auto-repeat: No
- ///
- /// Notably sent by the 'Visualization' button of HP Windows Media Center Remote (TSGH-IR08).
- ///
- /// According to HP specs it displays visual imagery that is synchronized to the sound of your music tracks.
- ///
- Ext0 = 0x32,
- ///
- /// First press action: Generates EXTn HID message in the Media Center Vendor Specific
- /// Collection (page 0xFFBC, usage 0x88).
- ///
- /// Second press action: Repeats message.
- ///
- /// Auto-repeat: No
- ///
- /// Notably sent by the 'Slide Show' button of HP Windows Media Center Remote (TSGH-IR08).
- ///
- /// According to HP specs it plays a slide show of all the pictures on your hard disk drive.
- ///
- Ext1 = 0x33,
- ///
- /// First press action: Generates EXTn HID message in the Media Center Vendor Specific
- /// Collection (page 0xFFBC, usage 0x88).
- ///
- /// Second press action: Repeats message.
- ///
- /// Auto-repeat: No
- ///
- /// Notably sent by the 'Eject' button of HP Windows Media Center Remote (TSGH-IR08).
- /// Also interpreted as 'Eject' action by SoundGraph iMON Manager in MCE mode (OrigenAE VF310).
- ///
- Ext2 = 0x34,
- ///
- /// First press action: Generates EXTn HID message in the Media Center Vendor Specific
- /// Collection (page 0xFFBC, usage 0x88).
- ///
- /// Second press action: Repeats message.
- ///
- /// Auto-repeat: No
- ///
- /// Notably sent by the 'Input selection' button of HP Windows Media Center Remote (TSGH-IR08).
- ///
- Ext3 = 0x35,
- Ext4 = 0x36,
- Ext5 = 0x37,
- Ext6 = 0x38,
- Ext7 = 0x39,
- Ext8 = 0x3A,
- Ext9 = 0x80,
- Ext10 = 0x81,
- Ext11 = 0x6F,
- Zoom = 0x27,
- ChannelInput = 0x42,
- SubAudio = 0x2D,
- Channel10 = 0x3E,
- Channel11 = 0x3F,
- Channel12 = 0x40,
- ///
- /// First press action: Generates OEM2 HID message in the Media Center Vendor Specific
- /// Collection. This button is intended to control the front panel display of home entertainment
- /// computers. When this button is pressed, the display could be turned on or off, or the display
- /// mode could change.
- ///
- /// Second press action: Repeats message.
- ///
- /// Auto-repeat: No
- ///
- /// Notably issued by XBOX360 remote as defined in irplus - Remote Control - Android application.
- ///
- Display = 0x4F,
- ///
- /// First press action: To be determined.
- ///
- /// Second press action: Repeats message.
- ///
- /// Auto-repeat: No
- ///
- Kiosk = 0x6A,
- NetworkSelection = 0x2C,
- BlueRayTool = 0x78,
- ChannelInfo = 0x41,
- VideoSelection = 0x61
- }
-
- public enum HpMceButton
- {
- ///
- /// Displays visual imagery that is synchronized to the sound of your music tracks.
- ///
- /// Second press action: Repeats message.
- ///
- /// Auto-repeat: No
- ///
- /// Notably sent by the 'Visualization' button of HP Windows Media Center Remote (TSGH-IR08).
- ///
- /// According to HP specs it displays visual imagery that is synchronized to the sound of your music tracks.
- ///
- Visualization = MceButton.Ext0,
- ///
- /// Plays a slide show of all the pictures on your hard disk drive.
- ///
- /// Second press action: Repeats message.
- ///
- /// Auto-repeat: No
- ///
- /// Notably sent by the 'Slide Show' button of HP Windows Media Center Remote (TSGH-IR08).
- ///
- /// According to HP specs it plays a slide show of all the pictures on your hard disk drive.
- ///
- SlideShow = MceButton.Ext1,
- ///
- /// Eject optical drive.
- ///
- /// Second press action: Repeats message.
- ///
- /// Auto-repeat: No
- ///
- /// Notably sent by the 'Eject' button of HP Windows Media Center Remote (TSGH-IR08).
- /// Also interpreted as 'Eject' action by SoundGraph iMON Manager in MCE mode (OrigenAE VF310).
- ///
- Eject = MceButton.Ext2,
- ///
- /// Not sure what this should do.
- ///
- /// Second press action: Repeats message.
- ///
- /// Auto-repeat: No
- ///
- /// Notably sent by the 'Input selection' button of HP Windows Media Center Remote (TSGH-IR08).
- ///
- InputSelection = MceButton.Ext3,
- }
-
-
#region RemoteControlEventArgs
@@ -843,7 +619,7 @@
Debug.WriteLine(hidDump);
//Make sure both usage page and usage are matching MCE remote
- if (deviceInfo.hid.usUsagePage != (ushort)Hid.UsagePage.MceRemote || deviceInfo.hid.usUsage != (ushort)Hid.MceRemoteUsage)
+ if (deviceInfo.hid.usUsagePage != (ushort)Hid.UsagePage.MceRemote || deviceInfo.hid.usUsage != (ushort)Hid.UsageId.MceRemoteUsage)
{
Debug.WriteLine("Not MCE remote page and usage.");
return;
diff -r 5ecebf1bd397 -r 0d0c62b1df48 RemoteControlSample.csproj
--- a/RemoteControlSample.csproj Wed Nov 05 20:58:15 2014 +0100
+++ b/RemoteControlSample.csproj Thu Nov 06 21:57:53 2014 +0100
@@ -127,6 +127,7 @@
Form
+
Code