Jeff Griffin

Update: HTPC IR…

Posted on October 14, 2011

In my last post I talked about some of the remaining issues to solve in my attempt to migrate to a new, inexpensive remote for my HTPC.  I tend to err on the side of over-engineering solutions to problems like these and well...this time is no exception.  My solution consists of a virtual HID shim/miniport driver with an interface to user mode software.  I wrapped this in a managed "VirtualKeyboard" class so I can call it from a service which listens for my remote commands to come in on the eHome Remote Receiver.

The benefits of this approach are twofold over sending out any kind of windows message, which is what every boxed solution I found does.  First, I can code the entire solution into the service layer.  Placing this functionality in a service run automatically as LocalSystem allows it to behave like a first-class input device.  Always available and decoupled from UI.  Yes you can inherit NativeWindow, pump and send Windows messages in a service, but I couldn't figure out any way to send a key-press there.  Even if I could do it that way I don't think I'd want to.

The second benefit is proper integration with Media Center, and anything else that may require a true device identity.  In order to support Media Center's 10-key SMS style text entry feature, it needs to be able to distinguish buttons pressed by a remote, which is modeled as a keyboard device in Windows, and a true keyboard.  Key-presses originating from Windows messages are always handled as keyboard input.  The distinction between keyboard and remote is made in the registry ("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Media Center\Remote Controls"). The names of the values defined in this key map to hardware ID's to be handled as remotes.

I can see this component being useful with a number of software suites and other automation scenarios.  IR Server Suite, EventGhost and AutoHotkey come to mind.  As it is, the service I wrote is special-cased for my remote, but if you have need for such a beast, drop me a line.  I can likely adapt it to other needs.

Comments (0) Trackbacks (0)

No comments yet.


Leave a comment

No trackbacks yet.