ADAM'S WEB PRESENCE

15 November 2008

Update on TwinHan remote for Mythbuntu 8.10

Filed under: General — adam @ 11:08 pm

twinhan remoteI’ve just upgraded my HTPC to the new Mythbuntu 8.10. I must say that setup is a helluva lot easier than previous versions of Myth although I found my ATI card did not work at all and I had to exhume an ancient nVidia card from my parts box. And I had to hack the xorg.conf file to make the TV output work so the setup is not 100% seamless.

Anyway, onto the odd device, my TwinHan remote control. Setting this up is much easier under Mythbuntu 8.10. Here’s the step-by-step:


Step 1 – Configure LIRC

Plug the IR receiver into a USB port. Wait a moment for it to register and then type the following command:

ls /dev/input/by-id

It should produce output like this. This step is just to verify the correct device name for the remote.

usb-Twinhan_Tech_Remote_Control_1111111-event-kbd
usb-Twinhan_Tech_Remote_Control_1111111-event-mouse
usb-Twinhan_Tech_Remote_Control_1111111-mouse

Now edit the file /etc/lirc/hardware.conf and enter values for REMOTE_DRIVER and REMOTE_DEVICE:

REMOTE_DRIVER="devinput"
REMOTE_DEVICE="/dev/input/by-id/usb-Twinhan_Tech_Remote_Control_1111111-event-kbd"

Due to a bug in this version of Ubuntu, you will also need to run the following command:

lshal | grep input.product

It will spit out a few lines of text. Verify that it produces a line like this:

  input.product = 'Twinhan Tech Remote Control'  (string)

Then edit the file /usr/share/hal/fdi/preprobe/20thirdparty/lirc.fdi and make it read like so:

<?xml version="1.0" encoding="UTF-8"?>

<deviceinfo version="0.2">
  <device>
     <match key="info.product" contains_ncase="Twinhan Tech Remote Control">
        <merge key="info.ignore" type="bool">true</merge>
     </match>
  </device>
</deviceinfo>

Finally, download this file:

lircd.conf

and put it in /etc/lirc/

At this stage, I had to reboot so that everything loaded properly. Once you have rebooted, you can test the remote control by typing:

irw

Now every time you press a key, you should see it printed on the screen. Press Ctrl-C when you are done.

STEP 2 – Configure MythTV commands

We are getting closer now. The next step is to set up a file called ~/.lirc/mythtv which contains the mappings between the keys on the remote and the functions in MythTV. Once again, I have already prepared this file which you can download here:

lircrc-mythtv

Rename this file to mythtv and move it to ~/.lirc/ Once that is done, restart MythTV. Here are the key mappings you will end up with:

Key Function
REC Record
TELETEXT OSD
RECALL MENU
PREVIEW INFO
REW/FFWD Forward/backward in MythMusic
CAPTURE Previous playlist item in MythMusic
RECORDLIST Next playlist item in MythMusic

STEP 3 – Configure MPlayer

The final step is to configure the mapping between the remote and the commands in MPlayer. Since MPlayer is a separate program, it needs to be configured separately to MythTV. To configure it, we need another lircrc file but this time is has to be called ~/.lirc/mplayer. Download it from here:

lircrc-mplayer

Rename it to mplayer and put it in ~/.lirc/ and that should be that! Here are the key mappings for MPlayer:

Key Function
MUTE Mute
VOL+/- Adjust volume
CH+/- Skip fwd/back 60 seconds
REW/FFWD Skip fwd/back 10 seconds
PREVIEW Show/hide subtitles
TELETEXT Show/hide OSD
TAB Cycle through audio tracks

If you do not like the key mappings I have chosen, you may edit the files in ~/.lirc. The format should be fairly easy to follow.


Powered by WordPress