Monday, July 12, 2010

XBMC with lircd, iguanaworks receiver and XBOX 360 remote

Using the keyboard and XBMC can be a bit irritating, especially for my wife, who has been made bedridden for 6 weeks due to a hip replacement. I decided to finally get remote control working for XBMC instead of relying on keyboard extensions/radio keyboard/IR keyboards.

I looked for THE most lircd compatible IR Receiver and settled on an Iguanaworks item (http://iguanaworks.net/) which is actually an IR Transceiver meaning I can do more with the little device in future. I had a spare XBOX 360 DVD Remote lying around and these have become my tools of choice.

Iguanaworks have an RPM installer on thier website but make sure to install the libusb libraries first (this is for 64-bit fedora).

yum install libusb-devel.x86_64 libusb.x86_64

You can also install with yum - create a file /etc/yum.repos.d/iguanair.repo with the following inside:

[iguanair]
name=IguanaIR
baseurl=http://iguanaworks.net/downloads/$basearch
enabled=0
gpgcheck=0


Then install iguanaIR through yum:

yum install iguanaIR --enablerepo=iguanair

and finally install lirc, which should now include the iguanaIR module in its options:

yum erase lirc-libs-0.8.6-7.fc12.x86_64 lirc-remotes-0.8.6-7.fc12.x86_64 lirc-0.8.6-7.fc12.x86_64 lirc-devel-0.8.6-7.fc12.x86_64

Test that IguanaIR works (It wont first time, you need to issue a device-id):

igdaemon -nvvv --driver-dir=/usr/lib64/iguanaIR

Assign a device-id:

igclient --setid fred

and then startup your daemon:

/etc/init.d/iguanaIR start

Edit the /etc/sysconfig/lirc file and modify the line LIRC_DRIVER to say:

LIRC_DRIVER="iguanaIR"

Then create or overwrite /etc/lirc/lircd.conf with the following:


    begin remote

      name  Microsoft_Xbox360
      bits           13
      flags RC6|CONST_LENGTH
      eps            30
      aeps          100

      header       2682   906
      one           438   451
      zero          438   451
      pre_data_bits   24
      pre_data       0x1BFF80
      gap          107066
      toggle_bit_mask 0x8000
      rc6_mask    0x100000000


          begin codes
              OpenClose                0x0BD7
              XboxFancyButton          0x0B9B
              OnOff                    0x0BF3
              Stop                     0x0BE6
              Pause                    0x0BE7
              Rewind                   0x0BEA
              FastForward              0x0BEB
              Prev                     0x0BE4
              Next                     0x0BE5
              Play                     0x0BE9
              Display                  0x0BB0
              Title                    0x0BAE
              DVD_Menu                 0x0BDB
              Back                     0x0BDC
              Info                     0x0BF0
              UpArrow                  0x0BE1
              LeftArrow                0x0BDF
              RightArrow               0x0BDE
              DownArrow                0x0BE0
              OK                       0x0BDD
              Y                        0x0BD9
              X                        0x0B97
              A                        0x0B99
              B                        0x0BDA
              PgDown                   0x0B92
              PgUp                     0x0B93

              VolDown                  0x0bee
              VolUp                    0x0bef
              Mute                     0x0bf1
              TV                       0x0bb9

              Start                    0x0BF2
              Play                     0x0BE9
              Enter                    0x0BF4
              Record                   0x0BE8
              Clear                    0x0BF5
              1                        0x0BFE
              2                        0x0BFD
              3                        0x0BFC
              4                        0x0BFB
              5                        0x0BFA
              6                        0x0BF9
              7                        0x0BF8
              8                        0x0BF7
              9                        0x0BF6
              100                      0x0BE2
              0                        0x0BFF
              Reload                   0x0BE3
          end codes

    end remote


Then whichever user is your XBMC user, create or overwrite the ~/.xbmc/userdata/Lircmap.xml file with:

                    <lircmap>
                            <remote device="Microsoft_Xbox360">
                                    <left>LeftArrow</left>
                                    <right>RightArrow</right>
                                    <up>UpArrow</up>
                                    <down>DownArrow</down>
                                    <select>OK</select>
                                    <back>Back</back>
                                    <forward>FastForward</forward>
                                    <reverse>Rewind</reverse>
                                    <play>Play</play>
                                    <pause>Pause</pause>
                                    <stop>Stop</stop>
                                    <volumeplus>VolUp</volumeplus>
                                    <volumeminus>VolDown</volumeminus>
                                    <mute>Mute</mute>
                                    <pageminus>PgDown</pageminus>
                                    <pageplus>PgUp</pageplus>
                                    <zero>0</zero>
                                    <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>
                                    <power>OnOff</power>
                                    <skipplus>Next</skipplus>
                                    <skipminus>Prev</skipminus>
                                    <display>Display</display>
                                    <record>Record</record>
                                    <start>Start</start>
                                    <info>Info</info>
                                    <menu>DVD_Menu</menu>
                                    <myvideo>Y</myvideo>
                                    <mymusic>X</mymusic>
                                    <mypictures>A</mypictures>
                                    <hash>B</hash>
                                    <clear>Clear</clear>
                                    <myTV>Enter</myTV>
                            </remote>
    </lircmap>


Start LIRC and see if everything is okay:

/etc/init.d/lirc start

and test that your remote is picked up and sending codes to the system by using "irw":

[root@xbmc ~]# irw
000000037ff00bde 00 RightArrow Microsoft_Xbox360
000000037ff00bde 01 RightArrow Microsoft_Xbox360
000000037ff00bde 00 RightArrow Microsoft_Xbox360
000000037ff00bde 01 RightArrow Microsoft_Xbox360
000000037ff00be1 00 UpArrow Microsoft_Xbox360
000000037ff00be0 00 DownArrow Microsoft_Xbox360
000000037ff00be0 01 DownArrow Microsoft_Xbox360
000000037ff00bdf 00 LeftArrow Microsoft_Xbox360
000000037ff00bdf 01 LeftArrow Microsoft_Xbox360
000000037ff00bdf 00 LeftArrow Microsoft_Xbox360
000000037ff00bdf 01 LeftArrow Microsoft_Xbox360
000000037ff00bdd 00 OK Microsoft_Xbox360

Lirc has changed the way it creates its socket file, meaning that xbmc is going to be looking for /dev/lircd, but in actual fact now resides in /var/run/lirc/lircd. An easy fix for this is to just create a symbolic link:

ln -s /var/run/lirc/lircd /dev/lircd

I prefer doing things properly and recompiling xbmc from your SVN repo. You just need to add the following line when you ./configure:

--with-lirc-device=/var/run/lirc/lircd
Then just restart your system, and enjoy a working remote in XBMC !

No comments:

Post a Comment