[LINUX] HOW-TO get Logitech Harmony Universal Remote + Custom Buttons working in XBMC

  Thread Rating:
  • 1 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
hogfan Offline
Fan
Posts: 384
Joined: Nov 2009
Reputation: 0
Thumbs Up  [LINUX] HOW-TO get Logitech Harmony Universal Remote + Custom Buttons working in XBMC
Post: #1
Goal

I have written this guide due to the recent difficulties I had getting my Harmony 880 remote's custom buttons working on a minimial installation of Ubuntu Jaunty Jackelope w/ XBMC 9.11 Camelot. There is a lot of good, but confusing information on the boards on this topic, so this guide is intended to be a clear, non-confusing step-by-step through the process. You should follow these steps in order to get your Harmony Remote's custom buttons working to perform XBMC functions. We will be doing this for the Harmony 880, but these instructions should apply to almost all Harmony models.

So lets dive in!

Prerequisites

- minimal install of Jaunty or Karmic (or XBMC Live installed to HDD)
- XBMC 9.11 Camelot (or newer SVN build)
- Lirc should already be installed (however, I will show you how)
- an IR receiver (not IRda) connected to to your HTPC
- a Harmony Universal Remote

Overview

In this guide we will be using the Original XBOX DVD Dongle (from the DVD Playback Kit) as our IR receiver. However, most of the following instructions will apply as long as you already have your Harmony working with basic buttons in XBMC with whatever IR receiver you have. For instructions on attaching the XBox DVD dongle to to your HTPC with a USB cable, see
HERE, or if you can't solder or just want to do it the easy way, buy one of THESE.

Make sure Lirc is Installed & Setup your lircd.conf File.

We are assuming that Lirc is already installed on your HTPC, and that you already have your basic buttons working on your Harmony remote. However, if not do the following:

On your HTPC press CTRL+ALT+F2 to bring up the terminal. (alternately you can SSH into your HTPC and perform the steps from a remote terminal session)

Type:
Code:
sudo apt-get install lirc

You will be prompted to install Lirc. Press Y and hit enter.

Ok, so now that Lirc is installed, we need to setup our lircd.conf file so that Lirc knows about our remote.

At the terminal Type:
Code:
sudo nano /etc/lirc/lircd.conf

You can now use the arrow keys to move down and enter the necessary button and remote codes for your device (or past them in).

The lircd.conf file if you are using the Xbox DVD Playback Kit should look something like this:
Code:
begin remote

    name  XboxDVDDongle
    bits           8

    begin codes

        SELECT         0x0b
        UP             0xa6
        DOWN           0xa7
        RIGHT          0xa8
        LEFT           0xa9
        INFO           0xc3
        9              0xc6
        8              0xc7
        7              0xc8
        6              0xc9
        5              0xca
        4              0xcb
        3              0xcc
        2              0xcd
        1              0xce
        0              0xcf
        DISPLAY        0xd5
        BACK           0xd8
        SKIP-          0xdd
        SKIP+          0xdf
        STOP           0xe0
        REVERSE        0xe2
        FORWARD        0xe3
        TITLE          0xe5
        PAUSE          0xe6
        PLAY           0xea
        MENU           0xf7

    end codes
end remote

Once all codes have entered, press CTRL+O and then ENTER to save the file. Then press CTRL+X to return to the terminal.

Now that our lircd.conf has been setup, lets test and see if we have basic commands working on our Harmony remote in XBMC.

Go ahead and type:
Code:
sudo reboot

Your HTPC will reboot and boot back into XBMC.
(This post was last modified: 2010-01-14 22:32 by hogfan.)
find quote
hogfan Offline
Fan
Posts: 384
Joined: Nov 2009
Reputation: 0
Post: #2
Part 2

Getting Basic Harmony Remote Functions working in XBMC

XBMC 9.11 Camelot has support for several remotes out-of-the-box, including the original Xbox DVD Playback Kit & the Microsoft Media Center Remote, so our Harmony remote should just work in XBMC after we have set it up as the Xbox DVD Plackback Kit in the Harmony software.

Set Up your remote in the Harmony Application or Web App

Add XBMC Media Center as a new Device in the Harmony app, by choosing Game Console w/ DVD --> Microsoft -- XBOX. You then may be prompted to Plug your Harmony remote into your computer to have it learn commands from the original remote. (you may or may not have to perform this step). Once this has been completed, create a new Activity for XBMC. I called mine "Launch XBMC", and setup the activity as appropriate for your equipment.

Now test your Harmony remote in XBMC. You should be able to use all of the basic buttons on the remote.

Choosing Custom Buttons/XBMC actions

Ok so now we are successfully using our Harmony remote in XBMC! Woohoo! But wouldn't it be nice to have some buttons for XBMC actions? Well lets get on with it!
We first need to decide what XBMC functions we want our custom buttons to perform. I wanted custom buttons to do the following:

Update Video Library
Update Music Library
Show Weather
Filemanager
Reset XBMC (restarts XBMC application only)
Reboot XBMC (reboots the entire HTPC)
Clean Video Library
Clean Music Library
Take Screenshot

A full list of available functions can be found in the XBMC WIKI HERE. Also, the Harmony 880 remote does not have a TITLE button which is used on the Xbox DVD Playback Kit remote. We need to setup a custom button as well to "Show Context Menu" in XBMC. We will do this when setting up the other custom buttons on our remote.

Add Custom Buttons for XBMC to the Harmony Remote

Ok, now that we know what actions we want our custom buttons to perform, lets create these new buttons on our Harmony 880. Open the Harmony Application and go to the Launch XBMC Activity we created. Click "Customize Buttons". Next, click on the Additional Buttons tab. Now the trick here is to map our custom buttons to available buttons that are NOT used by the XBOX DVD remote. Enter the name for your new button in the Label field, choose XBMC Media Center as the device to control, and then choose an un-used button for each button you add.TIP: Only use one of of the PowerOn, PowerOff, PowerToggle buttons as they use the same code. Also, I encountered weird behavior with the Angle button so I would avoid it too (it returned multiple codes). Now lets go ahead and create a replacement for that missing title button mentioned earlier. Type in: show Context, choose XBMC Media Center as the device and choose, Title as the button. Your custom button configuration should look something like this:

[Image: Picture1.png]

Once you have finished adding you custom buttons, click the Done button, connect your Harmony 880 to your computer and
update it to reflect the changes we just made.
(This post was last modified: 2010-01-15 03:19 by hogfan.)
find quote
hogfan Offline
Fan
Posts: 384
Joined: Nov 2009
Reputation: 0
Post: #3
Part III

Configure Files to get Custom Buttons working in XBMC

Ok, we are now at the part where it gets rather confusing with all of the older guides out there. We will be working with 4 configuration files to get our custom buttons working in XBMC.

The files are:
hardware.conf - hardware config for Lirc (I didnt' have to do much with this file until upgrading to Lucid Lynx)
lircd.conf - our Lirc configuration file
Lircmap.xml - Maps XBMC functions to Lirc commands
remote.xml - tells our remote how to function in XbMC by referencing Lircmap.xml

IMPORTANT: We will NOT be working with the file keymap.xml! This file no longer exists as of XBMC 9.11 Camelot. Basically this file has been split into remote.xml & keyboard.xml. This has been the cause of a lot of confusion when setting up remote configurations lately.

Getting the RAW button codes for the New Custom Buttons

Ok, so we've got basic functionality in XBMC, and we have setup our new custom buttons for our Harmony remote and update the remote. Now it's time to get the RAW button codes for our newly created buttons.

On your HTPC press CTRL+ALT+F2 to bring up the terminal. (alternately you can SSH into your HTPC and perform the steps from a remote terminal session)

We need to stop Lirc so we can run a Lirc utility called Mode2. Mode2 will give us the RAW button codes for our new custom buttons we created. To stop Lirc, type:
Code:
sudo /etc/init.d/lirc stop

Now type:
Code:
sudo mode2 -r -d /dev/lirc0
and press Enter. You will now see the cursor flashing at the terminal. Point your Harmony remote at the IR Unit (Xbox DVD Dongle) and press the first custom button you created. Now look at your terminal window and you should see a hexidecimal code displayed. It will probably display the same code four times for 1 button press. This is normal. Write down the name of your custom button, and then write down the code displayed in the terminal next to it (only write down the code once, not all 4 times). Repeat this process for all of your remaining custom buttons (with the exception of the "Show Context" button we created which is already working and mapped to Title).

Add The Custom Buttons to lircd.conf

Ok, now that we have the raw button codes for all of our custom buttons, it is time to add them to our lircd.conf file.
At the terminal Type:
Code:
sudo nano /etc/lirc/lircd.conf
Now scroll to the bottom of the file and insert your new custom button codes just after the last XboxDVDDongle button line, giving it a descriptive name for the buttons function. Your lircd.conf file should look something like this when you are done:

Code:
begin remote

    name  XboxDVDDongle
    bits           8

    begin codes

        SELECT         0x0b
        UP             0xa6
        DOWN           0xa7
        RIGHT          0xa8
        LEFT           0xa9
        INFO           0xc3
        9              0xc6
        8              0xc7
        7              0xc8
        6              0xc9
        5              0xca
        4              0xcb
        3              0xcc
        2              0xcd
        1              0xce
        0              0xcf
        DISPLAY        0xd5
        BACK           0xd8
        SKIP-          0xdd
        SKIP+          0xdf
        STOP           0xe0
        REVERSE        0xe2
        FORWARD        0xe3
        TITLE          0xe5
        PAUSE          0xe6
        PLAY           0xea
        MENU           0xf7

[b]#My Harmony 880 Custom Button Codes
        UPVID           0xc5
    UPMUS           0xb8
    WEATHER           0x6f
    FILEMAN           0xb3
    RESET           0xfa
    REBOOT           0x6b
    CLEANVID       0xb5
    CLEANMUS       0x4f
    SCREENSHOT     0xa5[/b]
    end codes
end remote

Once all codes have entered, press CTRL+O and then ENTER to save the file. Then press CTRL+X to return to the terminal.
(This post was last modified: 2010-08-21 15:53 by hogfan.)
find quote
hogfan Offline
Fan
Posts: 384
Joined: Nov 2009
Reputation: 0
Post: #4
Part IV

Setting up Lircmap.xml

Now that we have our lircd.conf file all setup, we need to configure Lircmap.XML so that it knows about the new button codes we just added to lircd.conf.
Copy the file /usr/share/xbmc/system/Lircmap.xml to your home folder ~/xbmc/.xbmc/userdata

At this point, you can follow the steps above to edit the Lircmap.xml in your userdata folder from the terminal with nano, or if you have FTP/SSH access to your HTPC, you can simply copy this file down to your computer to edit it and upload it back to the HTPC. The choice is yours. The Lircmap.xml by default contains mappings for several remotes. If you do not plan to use any other remotes, I recommend removing the sections for remotes other than the XboxDVDDongle. This does nothing more than cleanup the file.

Now we need to create <obc##> tags to map our XBMC funtions to our new custom button commands in the lircd.conf file. On the Linux platform, we will simply use any numeric codes that are not already in use by the Xbox DVD remote in place of ## in the <obc##> tags. To see a chart of what codes are in use click HERE. When completed our Lircmap.xml file should look something like the sample below. Notice that within the <obc##> tags, we have entered the name of the XBMC Function we created in our lircd.conf file. (ie.<obc117>UPVID</obc117>)

Code:
<lircmap>
        
    <remote device="XboxDVDDongle">
        <play>PLAY</play>
        <pause>PAUSE</pause>
        <stop>STOP</stop>
        <forward>FORWARD</forward>
        <reverse>REVERSE</reverse>
        <left>LEFT</left>
        <right>RIGHT</right>
        <up>UP</up>
        <down>DOWN</down>
        <select>SELECT</select>
        <back>BACK</back>
        <menu>MENU</menu>
        <title>TITLE</title>
        <info>INFO</info>
        <skipplus>SKIP+</skipplus>
        <skipminus>SKIP-</skipminus>
        <display>DISPLAY</display>
        <one>1</one>
        <two>2</two>
        <three>3</three>
        <four>4</four>
        <five>5</five>
        <six>6</six>
        <seven>7</seven>
        <eight>8</eight>
        <nine>9</nine>
        <zero>0</zero>
[b]<!-- My Custom Buttons -->
        <obc117>UPVID</obc117>
        <obc71>UPMUS</obc71>
        <obc58>WEATHER</obc58>
        <obc76>FILEMAN</obc76>
        <obc90>RESET</obc90>
        <obc80>REBOOT</obc80>
        <obc144>CLEANVID</obc144>
        <obc176>CLEANMUS</obc176>
        <obc132>SCREENSHOT</obc132>[/b]
    </remote>

    </lircmap>


Now save your Lircmap.xml file and exit to the terminal, or FTP your edited file back up to your HTPC in ~/XBMC/.xbmc/userdata.

Setting up remote.xml

The last configuration file we need to edit is remote.xml. All we will be doing in this file is adding a small section to add support for our custom obc##'s we just finished setting up in the Lircmap.xml file. Copy the file /usr/share/xbmc/system/keymaps/remote.xml to your home folder in ~/xbmc/.xbmc/userdata/keymaps/remote.xml Edit this file the same way you edited Lircmap.xml, either with nano from the terminal via your computer if you are using the FTP method.

Add the following section to your remote.xml file immediately after the <global> tag, but before the <remote> tag:

Code:
<universalremote>
          <obc##></obc##>
          <obc##></obc##>
          <obc##></obc##>
    </universalremote>

Replace the ## in the <obc##> tags with the corresponding numeric codes you used in your Lircmap.xml file. With each set of tags, insert the XBMC function that you want to perform. When complete the <universalremote> section of your remote.xml file should look something like this:

Code:
    <universalremote>
          <obc117>XBMC.UpdateLibrary(video)</obc117>
          <obc71>XBMC.UpdateLibrary(music)</obc71>
          <obc58>XBMC.ReplaceWindow(weather)</obc58>
          <obc76>XBMC.ReplaceWindow(filemanager)</obc76>
          <obc90>XBMC.RestartApp</obc90>
        <obc80>XBMC.Reboot</obc80>
        <obc144>XBMC.CleanLibrary(video)</obc144>
        <obc176>XBMC.CleanLibrary(music)</obc176>
        <obc132>XBMC.TakeScreenshot</obc132>
    </universalremote>

Now save your remote.xml file and exit to the terminal, or FTP your edited file back up to your HTPC in ~/XBMC/.xbmc/userdata/keymaps.

Reboot your HTPC and Test your Remote

At the terminal type:

Code:
sudo reboot

When XBMC comes back up, test out the newly configured custom buttons on your Harmony 880. Everything should be working now. If it is still not working, check your Lircmap.xml and remote.xml files to verify you closed all of your <obc##> tags (</obc##>), and then reboot and try again.

IMPORTANT: UPDATED INFO FOR LIRC ON LUCID LYNX

Ok, I'm not sure why I didn't really need to configure this file in Lirc back on Jaunty or Karmic, but editing etc/lirc/hardware.conf as follows got my remote working again on Lucid Lynx:

Code:
# /etc/lirc/hardware.conf
#
#Chosen Remote Control
REMOTE="[b]XBOX DVD Playback Kit[/b]"
REMOTE_MODULES="[b]lirc_dev lirc_atiusb[/b]"
REMOTE_DRIVER=""
REMOTE_DEVICE="[b]/dev/lirc0[/b]"
REMOTE_LIRCD_CONF="[b]atiusb/lircd.conf.atiusb[/b]"
REMOTE_LIRCD_ARGS=""

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

#Enable lircd
START_LIRCD="[b]true[/b]"

#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=""
REMOTE_SOCKET=""
TRANSMITTER_SOCKET=""


I hope those of you out there who are new to Linux or are struggling with getting your Harmony remote working find this guide helpful. I will try to answer any questions. Thanks and enjoy!

-hogfan
(This post was last modified: 2010-08-21 15:59 by hogfan.)
find quote
Blue_Calx Online
Junior Member
Posts: 5
Joined: Jan 2010
Reputation: 0
Post: #5
This is awesome information. Thank you!
find quote
ohoffm Offline
Junior Member
Posts: 8
Joined: Jan 2010
Reputation: 0
Post: #6
This is exactly what I have been looking for to get my Revo going with xbmc live install
find quote
hogfan Offline
Fan
Posts: 384
Joined: Nov 2009
Reputation: 0
Post: #7
Glad you find it helpful. Hopefully a mod will see it and move it to the Tutorials section.
find quote
myrison Offline
Donor
Posts: 301
Joined: Nov 2009
Reputation: 3
Location: Austin, TX
Post: #8
Good stuff, thanks for posting. It is a great reference for a non Harmony remote as well. Smile
find quote
Evin Offline
Senior Member
Posts: 145
Joined: Feb 2008
Reputation: 0
Location: Vienna
Post: #9
I'm using a mceusb-receiver.

When I stop lirc and use Mode2 I get this after pressing a button:

Code:
space 101600
pulse 2650
space 850
pulse 550
space 350
pulse 500
space 400
pulse 500
space 800
pulse 500
space 850
pulse 1400
space 800
pulse 550
space 350
pulse 500
space 350
pulse 550
space 350
pulse 500
space 400
pulse 500
space 400
pulse 500
space 350
pulse 550
space 400
pulse 450
space 400
pulse 550
space 350
pulse 500
space 400
pulse 950
space 350
pulse 550
space 350
pulse 500
space 400
pulse 500
space 400
pulse 450
space 850
pulse 500
space 400
pulse 500
space 400
pulse 500
space 350
pulse 950
space 850
pulse 550
space 350
pulse 550
space 350
pulse 600
space 300
pulse 950
space 800
pulse 550
space 350
pulse 950
space 800
pulse 950
space 69050
pulse 2700
space 800
pulse 550
space 350
pulse 550
space 350
pulse 550
space 750
pulse 550
space 800
pulse 1350
space 850
pulse 500
space 400
pulse 500
space 400
pulse 550
space 350
pulse 500
space 350
pulse 550
space 350
pulse 500
space 400
pulse 500
space 400
pulse 500
space 350
pulse 550
space 350
pulse 500
space 400
pulse 950
space 350
pulse 500
space 400
pulse 500
space 400
pulse 500
space 400
pulse 550
space 800
pulse 500
space 350
pulse 550
space 350
pulse 550
space 350
pulse 1000
space 750
pulse 500
space 400
pulse 500
space 400
pulse 500
space 400
pulse 950
space 800
pulse 600
space 300
pulse 950
space 850
pulse 1000

Any ideas? Sad
find quote
GhostDog Offline
Member
Posts: 57
Joined: Sep 2006
Reputation: 0
Location: Toronto, ON
Thumbs Up   
Post: #10
Nice work. You may want to mention that you renamed "Game Console w/ DVD --> Microsoft -- XBOX" (MS Xbox) Device to "XBMC Media Center". I just left mine as "MS Xbox". Wink

I actually mapped the "TITLE" function to the Menu button on my harmony.
find quote
ohoffm Offline
Junior Member
Posts: 8
Joined: Jan 2010
Reputation: 0
Post: #11
when attempting to run:
sudo mode2 -r -d /dev/lirc0

I am getting the following error:

mode2: error opening /dev/lirc0
mode2: No such file or directory

and that device does not exist.
find quote
Evin Offline
Senior Member
Posts: 145
Joined: Feb 2008
Reputation: 0
Location: Vienna
Post: #12
ohoffm Wrote:when attempting to run:
sudo mode2 -r -d /dev/lirc0

I am getting the following error:

mode2: error opening /dev/lirc0
mode2: No such file or directory

and that device does not exist.

Try

Code:
sudo su
irw
find quote
ohoffm Offline
Junior Member
Posts: 8
Joined: Jan 2010
Reputation: 0
Post: #13
Thanx for the quick reply and help.
irw is giving me connection refused
I have this generic remote and I appears that either HAL gets a hold of it or it is showing up as a mouse or keyboard.
When I do a isusb it reminds me how generic this remote is:
Bus 002 Device 005: ID 06b4:1c70
It seems that it is in Harmony as Chinavision CVSB-983 but not all of the buttons work and I would like to have title and info at least.
Anyone that has this remote working on Harmony with more then just the default keys let me know.
find quote
Evin Offline
Senior Member
Posts: 145
Joined: Feb 2008
Reputation: 0
Location: Vienna
Post: #14
Strange.

As I said, the instruction in the thread didn't work for me.
I open a terminal on my mac an connect via ssh to XBMC.

Then "sudo su" for root-privileges and than "irw". Now the pressing a button on my remote shows my the "codes".

At first I tried a Hama-Remote, but afair "irw" also ended in "connection refused"... Sad
find quote
pashdown Offline
Donor
Posts: 117
Joined: Dec 2009
Reputation: 0
Location: Salt Lake City, UT
Post: #15
Code:
3d                       0xa5
          advance                  0xac
          angle                    0x8a
          audio                    0x4f
          chptr+                   0xdf
          chptr-                   0xdd
          clear                    0xf9
          discskip                 0xb3
          eject                    0xaf
          hdmi                     0xfa
          inputnext                0xb8
          mode                     0x89
          opendv                   0xbf
          pwroff                   0xc5
          pwron                    0xd5
          random                   0xb5
          repeat                   0x6b
          replay                   0x45
          return                   0xd8
          skipback                 0xdd
          subtitle                 0x7f
          zoom                     0x6f
find quote
Post Reply