HID Remotes

From MythTV Official Wiki
Revision as of 20:44, 11 January 2008 by Psiuyo (talk | contribs)

Jump to: navigation, search

Generic HID "MCE" Remotes

An example of one of many of these remotes.

This is for any generic remote that uses the USB HID keyboard drivers. These remotes tend to be very popular on eBay, advertising themselves as MCE Remotes and originating from Asia. One popular model at the moment is the YAOCOO MCEY06

Description

These remotes and and look just like a USB keyboard (and sometime a mouse as well) to the system. There is no need for any LIRC drivers for this to work, provided a sufficiently recent kernel.

When plugging in one of these, dmesg should show something similar to the following:

usb 1-2: new low speed USB device using ohci_hcd and address 3
usb 1-2: configuration #1 chosen from 1 choice
input: USB HID v1.10 Keyboard [HOLTEK USB To PS2 Devic] on usb-0000:00:0b.0-2
input,hiddev96: USB HID v1.10 Mouse [HOLTEK USB To PS2 Devic] on usb-0000:00:0b.0-2

Unfortunately the keypresses simulated by these remotes may not all work with MythTV. For example, the remote linked above uses Ctrl+b, Ctrl+p, Ctrl+f for reverse skip, pause, and forward skip, while using Ctrl+B, Ctrl+P, Ctrl+f for rewind, play and ffwd. I don't believe MythTV keybindings are case sensitive so the Ctrl+b and Ctrl+Shift+b are indistinguishable from each other. In addition to this, there are a number of keys that generate unmapped keycodes which don't work in MythTV.

Solution

Ctrl+Shift keys
In order to make those Ctrl+Shift keys work we need to remap the shifted keys to a different character. First, using xev, run through all the buttons on your remote making a note of which buttons generate which keys. Second, choose some unused shifted characters for use in the remap. For example, if not used we can make Shift+b = '<', Shift+p = '?' and Shift+f = '>' using xmodmap.

In your .xinitrc place the following:

xmodmap -e "keycode 56 = b less"
xmodmap -e "keycode 33 = p question"
xmodmap -e "keycode 41 = f greater" 

Now in your MythTV keybinds, you can use Ctrl+< for the skip back button, Ctrl+? for the play button, and Ctrl+> for the skip forward button.

Restart X and mythfrontend then verify that the keys work as expected. You can go ahead and add more lines into your .xinitrc for the remaining double keys

Unknown keys
If you have buttons on your remote that generate no valid keys but valid keycodes, you can assign some keys to those buttons and set them in your mythtv keybindings.

xmodmap -e "keycode 167 = F1"
xmodmap -e "keycode 223 = F2"
...


Other buttons
If you still have buttons on your remote that do nothing in xev and are NOT for the mouse component (if exists), then you may have a remote that created two /dev/input/ entries, one for the USB HID Keyboard and another for a USB HID Consumer device. The consumer device can likely be used with LIRC to get the remaining keys functions. Please have a look at the Snapstream firefly mini article for more information on this configuration.