Update: HTPC IR…
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.
HTPC IR solutions and remaining issues
I knew this was coming. My HTPC gets a much needed upgrade and now I can't help but be plagued by every remaining problem with my setup. This week's PITA is our weathered, overused eHome remote. It has been with us since 2005, allowing us a one remote experience, with its programmable TV power, receiver volume and mute buttons and tight Media Center integration. I extended its life a few times, when a few oft-used buttons have stopped responding, by taking it apart and giving it the cotton swab and rubbing alcohol treatment. Look at this thing though. It's starting to affect my credibility as an HTPC enthusiast. Time to put it out to pasture.
So just run to Microcenter and pick up a Logitech Harmony right? Well...I have reservations, not the least of which is the perfectly functional eHome Remote Receiver already in my possession. The greatest problem I see is the expense, coupled with the already tech-fixated 18 month old boy hobbling around my living room. No, I think what I'd rather do is use the PC itself to convert signals from the non-universal remote that came with one of my Hauppauge tuners, and has since been collecting dust in the closet. It has plenty of the right buttons I need, and will be no significant loss should I find it's trampled-lifeless husk in the middle of the living room floor some evening. I may use an IR blaster to control my receiver, but I think I won't need to with the sound codec on this new motherboard.
So far I have done some research into the software that's out there to capture the signals from the new remote and send out the right commands. There are some good libraries out there, and with the eHome Receiver being an HID device, I should have an easy time of writing a little special-cased code if I need to in order to get the job done. I settled on IR Server Suite, which is actually part of the Media Portal project. IRSS has a translator app that can capture incoming IR messages and respond in different ways (Windows messages, key-presses, blasting another IR message, etc). This got me the majority of the functionality I needed, but I have two remaining gotchas:
1. I can't find a key code for the alphanumeric keys on the eHome remote. Sending a keypad number will not suffice for Media Center's text input functionality. I think these keys may map to HID's Phone Key usages, but I still need to test that theory.
2. Since, the translator application's functional paths inside a GUI application, rather than the IR service, I don't have any IR functionality on the welcome screen.
See Followup