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.

31 Comments »

  1. Comment by neztiti — 17 November 2008 @ 9:57 pm

    thank u man , see the config of lircrc-mythtv ,its like this
    begin
    button = VOL+
    prog = mplayer
    config = volume 1
    end

    begin
    button = VOL-
    prog = mplayer
    config = volume -1

    is it normal??
    end

  2. Comment by adam — 18 November 2008 @ 7:24 am

    Yes, it means that when the user presses the “VOL+” button, it adds 1 to the volume and when the user presses the “VOL-” button, it adds -1 to the volume. These files are copied off my own mythtv box and they work for this type of remote control.

  3. Comment by neztiti — 19 November 2008 @ 3:24 am

    ok thank you man for every update , you are NO.1 m8

  4. Comment by stf — 22 November 2008 @ 11:40 am

    I followed your docs. All seems right, but when I fire up irw I’ve got this message:
    Lirc: command not found

  5. Comment by adam — 27 November 2008 @ 3:39 pm

    Sounds like lirc is not installed on your box. Try sudo apt-get install lirc.

  6. Comment by Glyn — 22 December 2008 @ 5:33 am

    Useful page, thanks. You have a typo though, your lircrc-mythtv link above points to lircrc-mplayer as well.

  7. Comment by adam — 22 December 2008 @ 3:36 pm

    Thanks for spotting that Glyn, I’ve fixed it now.

  8. Comment by hosam — 3 January 2009 @ 6:04 am

    hi adam

    first i want to thank you for this blog

    secondly :

    i have usb twinhan starbox 702x and i have same remote control that u write about it but the irc is not usb like pci it is inside the device

    is that setting same because when I followed your docs. All seems right

    but when i try type remote inside editor test no input view and no response

    is there slove for this

    yhank u soo match

    http://www.twinhan.com/product_AD-SB200.asp

    and sorry about my language

  9. Comment by adam — 3 January 2009 @ 12:59 pm

    If I understand you correctly, the USB device nodes appear but when you run irw, there is no response from the remote control.

    If this is the case, I would double-check the device class name in /dev/input/by-id and make sure it matches the name you set up in /etc/lirc/hardware.conf.

  10. Comment by hosam — 4 January 2009 @ 1:31 am

    mr. adam see my output

    command:
    ls /dev/input/by-path

    pci-0000:00:1d.0-usb-0:1:1.0-event-kbd
    pci-5-4–event-ir
    pci-0000:00:1d.0-usb-0:1:1.1-
    platform-pcspkr-event-spkr
    pci-0000:00:1d.0-usb-0:1:1.1-event-

    you can see pci-5-4–event-ir

    this is my ir for my dvb-s

    after that i make my hardware.conf:

    # /etc/lirc/hardware.conf
    #
    #Chosen Remote Control
    REMOTE=”None”
    REMOTE_MODULES=”"
    REMOTE_DRIVER=”devinput”
    REMOTE_DEVICE=”/dev/input/by-path/pci-5-4–event-ir”
    REMOTE_LIRCD_CONF=”"
    REMOTE_LIRCD_ARGS=”"

    #Chosen IR Transmitter
    TRANSMITTER=”None”
    TRANSMITTER_MODULES=”"
    TRANSMITTER_DRIVER=”"
    TRANSMITTER_DEVICE=”"
    TRANSMITTER_LIRCD_CONF=”"
    TRANSMITTER_LIRCD_ARGS=”"

    #Enable lircd
    START_LIRCD=”false”

    #Don’t start lircmd even if there seems to be a good config file
    #START_LIRCMD=”false”

    #Try to load appropriate kernel modules
    LOAD_MODULES=”true”

    # Default configuration files for your hardware if any
    LIRCMD_CONF=”"

    #Forcing noninteractive reconfiguration
    #If lirc is to be reconfigured by an external application
    #that doesn’t have a debconf frontend available, the noninteractive
    #frontend can be invoked and set to parse REMOTE and TRANSMITTER
    #It will then populate all other variables without any user input
    #If you would like to configure lirc via standard methods, be sure
    #to leave this set to “false”
    FORCE_NONINTERACTIVE_RECONFIGURATION=”false”
    START_LIRCMD=”"

    ___________________________–

    now command

    lshal | grep input.product

    output:

    input.product = ‘IR-receiver inside an USB DVB receiver’ (string)

    after that i edit file /usr/share/hal/fdi/preprobe/20thirdparty/lirc.fdi :

    true

    after that i download file http://www.doctort.org/adam/files/twinhan/lircd.conf

    inside /etc/lirc/

    when i type irw now thing happing or no error

    after that i reboot but no thing happing

    thank u mate for listen

  11. Comment by hosam — 4 January 2009 @ 1:36 am

    hos@ubuntu:~$ sudo /etc/init.d/lirc restart
    * Stopping remote control daemon(s): LIRC [ OK ]
    * Loading LIRC modules [ OK ]
    * Starting remote control daemon(s) : LIRC [ OK ]

  12. Comment by hosam — 7 January 2009 @ 5:43 am

    adam please try to fix my problem

  13. Comment by adam — 24 January 2009 @ 9:09 pm

    Can you show me the contents of your file /usr/share/hal/fdi/preprobe/20thirdparty/lirc.fdi – it will help work out the problem.

  14. Comment by Gregg — 28 January 2009 @ 8:52 pm

    Dear Adam, Thanks for your post. I’ve got two Twinhan remotes identical to yours in appearance, but they give off different codes on some keys (the two I have aren’t interchangeable). A potential ‘gotcha’, but not related to my problem. My problem is that lirc just doesn’t seem to do anything no matter what I do. The remote behaves (and keeps behaving) as if it is a keyboard (even after following your instructions) in Mythtv and in other apps (running ubuntu 8.10 with mythtv added – working fine except for the remote). I’ve been using xmodmap which sort of did what I wanted by re-mapping the keys, but it is a pain to swap when you want to use the computer (the keyboard must be re-re-mapped). Specifically, how do we stop the Twinhan remote from behaving like a keyboard, and to start behaving like an IR remote? Is there something in mythtv to say we want to use lirc as a higher priority? I can’t find that. Also, do we run lircd or not? I ask because it makes no difference on my machine – I’m wondering if mythtv has its own interpreter – particularly since there’s a file called ~/.lirc/mythtv – how does mythtv know to use that? Ok, I’ve used up my 20 questions. Any advice you can offer will save what is left of my hair.

  15. Comment by Hector — 19 February 2009 @ 10:23 am

    THANKS—THANKS—THANKS–..¡¡¡¡¡¡¡¡¡
    You are my idol, whit the old guide nothing of nothing, but this guide all ok.
    Thanks again.
    (sorry for my english)

  16. Comment by flo — 19 February 2009 @ 8:23 pm

    Great guide. Helped me get my remote working.

    Just 1 strange thing, all buttons but the vol +/- are working.

    Do you have any suggestions what could cause this problem?

    Thx for your nice guide.

  17. Comment by dishbert — 1 March 2009 @ 7:02 am

    Thanks so much for this, for the first time ever I have a remote that works with Myth! This actually makes my month long Myth project worthwhile.

  18. Comment by slickvguy — 27 March 2009 @ 7:10 pm

    Ubuntu 8.10. I followed your instructions and everything matched up until running irw – it gives me an error message “connect: no such file or directory”. The remote is being picked up as a keyboard (i.e. if I press on a number it’s as if I pressed it on my keyboard). Also, I have no .lirc directory nor a /dev/lirc. Don’t we need to install a driver/kernel module? Another thing…when I start or restart lirc (sudo /etc/init.d/lirc start) I do not get any messages. Any help would be appreciated. I don’t plan on using myth, but I do want to use this remote for mplayer as I have my pc connected to my hdtv and use it to watch movies. Thank you.

  19. Comment by slickvguy — 27 March 2009 @ 8:23 pm

    Progress. After reading many more posts, I added lirc_dev and lirc_imo to /etc/modules. I edited /etc/lirc/hardware.conf (REMOTE_MODULES=”lirc_dev lirc_imon” and START_LIRCD=”true”). Now irw works (and the keys on the remote are generating the matching line int eh conf file). I also have a /dev/lircd (but not a /dev/lirc). And when I run the lirc script, e.g. restart, it displays the status messages. But I still didn’t have the .lirc directory to put mplayer in, so I created one and copied it there. The mapping is not working properly though. I run mplayer and the rc keys are doing something, but not the right thing. Not sure what it’s doing, I think it’s still acting like a keyboard. Hmmm…

  20. Comment by slickvguy — 28 March 2009 @ 12:03 am

    Yes! Finally got it to work! :) Needed to use the “old” filename of .lircrc for the mplayer config. Doh. Glad I found an example on an mplayer site. Not sure why you said to call it mplayer and place it in the ~/.lirc directory. Maybe it works that way if Myth is installed?

  21. Comment by G2 — 29 March 2009 @ 12:42 pm

    Thanks for your howto.
    I have everything working up to and including the irw (displays sensible things on the screen).

    I’m getting a Segmentation Fault when I press a key on the remote with the mythfrontend open.

    $ mythfrontend -v all

    shows nothing but “Segmentation Fault”. Any ideas what to check?

    By the way, if someone has problems with getting irw working, I had to do:
    $ sudo modprobe lirc_serial
    to load the lirc module.

  22. Comment by Jared — 5 May 2009 @ 3:47 pm

    Works perfectly for Mythbuntu 9.10. Thanks!

  23. Comment by Jared — 7 May 2009 @ 4:19 pm

    …and by Mythbuntu 9.10, I really mean 9.04

  24. Comment by doep — 15 May 2009 @ 1:26 am

    hi, my power button works with:

    POWER 0×10040

    gz doep

  25. Comment by File — 6 June 2009 @ 5:41 am

    any idea why the play button won’t act like my enter button on my keyboard? not sure it is working but in irw i can see the output

  26. Comment by File — 6 June 2009 @ 5:48 am

    i want to use the remote to navagate the interface but i can’t get it to use enter to get to the next menu

  27. Comment by File — 6 June 2009 @ 5:53 am

    how can i figure this remote out i want to use it like this

    CH+ up
    CH- down
    VOL+ right arrow
    VOL- left arrow
    play as enter
    stop as stop i guess
    cancel as esc button

    that is basically all i can seee me using as my tv will control the volume im just not sure how to get it to do it

  28. Comment by dean — 27 July 2009 @ 10:26 am

    Thanks great web site, is there away to use this reomte to shutdown mythtv pc and/or awake pc

  29. Comment by adam — 27 July 2009 @ 10:48 am

    There is no way to use it to start up the PC as far as I know but you should be able to use it to shut down the PC by setting up and enabling the SHUTDOWN item in your MythTV menu. This is done using mythtv-setup if I recall correctly.

  30. Comment by Lasse — 3 September 2009 @ 12:09 am

    Thank you! Works splendidly with 9.04.

  31. Comment by Matt — 1 January 2010 @ 2:59 pm

    Thanks so much for this information, worked perfectly!

RSS feed for comments on this post. TrackBack URI

Leave a comment


Powered by WordPress