XBOX DVD IR Receiver

From MythTV Official Wiki
Jump to: navigation, search

The Xbox DVD IR receiver (both Microsoft original and generic) can be used as an USB IR receiver with LIRC and MythTV. LIRC support is included in the lirc_atiusb module.

Hardware Modifications

The IR Receiver obviously does not plug directly into a standard USB port without some modifications being made. Fortunately, the ports on an Xbox are only modified USB ports, so all Xbox hardware is basically USB compatible hardware.

There are several guides online that discuss how to physically modify the receiver so that it can be plugged into a standard USB port. [1] [2]

You can also buy an extension cable on ebay that plugs into the controller ports on the front of the Xbox and has a socket for the receiver to plug into on the other end. By cutting the male end of the cord off and connecting the loose wires to a cable with a male USB plug at the end, you have a nice long USB to Xbox input extension cable. For people that decide to go this route, the pictures below may be helpful since the Xbox extension cables don't seem to use standard USB colored wiring.

Xbox extension wiring.jpg

Software =

Blacklist the xpad Module

Xpad is a driver included in Linux that allows the use of Xbox gamepads. For LIRC to work correctly with the Xbox IR receiver, this driver cannot be loaded. In order to prevent this from happening, add the following line to /etc/modprobe.d/blacklist:

blacklist xpad

Building kernel module for lirc 0.9.0

In version 0.9.0, most of kernel module have been merged in the kernel tree. However, the module for the Xbox is missing and the lirc_atiusb doesn't work out of the box. Here is how to have a working lirc :

git clone git://lirc.git.sourceforge.net/gitroot/lirc/lirc
wget https://raw.github.com/fabricega/OSELAS.BSP-RaspberryPi/master/patches/lirc-0.9.0/lirc-0.9.0-021-lirc_xbox.patch
cd lirc/
patch -p1 <../lirc-0.9.0-021-lirc_xbox.patch

edit the file drivers/lirc_xbox/lirc_xbox.c and comment out #include <linux/smp_lock.h>

Next, build lirc :

./autogen.sh
./configure --with-driver=xbox
make

Now install the kernel modules :

sudo cp drivers/lirc_dev/lirc_dev.ko /lib/modules/3.10-3-686-pae/kernel/drivers/misc
sudo cp drivers/lirc_xbox/lirc_xbox.ko /lib/modules/3.10-3-686-pae/kernel/drivers/misc
sudo depmod -a

Ensure that the file /etc/lircd/hardware.conf has the following line:

REMOTE_MODULES="lirc_dev lirc_xbox"

and restart lirc

Configure LIRC

Copy the following file to /etc/lircd.conf:

# this config file was automatically generated
# using lirc-0.8.3-CVS(default) on Fri Feb  8 09:34:50 2008
#
# brand: Microsoft Xbox DVD Receiver (also works with generic)
# remote control: Xbox remote or any remote using RCA DVD player codes

begin remote

  name  Xbox_Remote
  bits            8
  eps            30
  aeps          100

  one             0     0
  zero            0     0
  gap          163983
  toggle_bit_mask 0x0

      begin codes
          left                     0xA9
          up                       0xA6
          right                    0xA8
          down                     0xA7
          enter                    0x0B
          1                        0xCE
          2                        0xCD
          3                        0xCC
          4                        0xCB
          5                        0xCA
          6                        0xC9
          7                        0xC8
          8                        0xC7
          9                        0xC6
          0                        0xCF
          menu                     0xF7
          display                  0xD5
          rewind                   0xE2
          ffwd                     0xE3
          play                     0xEA
          pause                    0xE6
          stop                     0xE0
          skip-                    0xDD
          skip+                    0xDF
          title                    0xE5
          info                     0xC3
          back                     0xD8
      end codes

end remote

Add the following file to ~/.mythtv/lircrc:

# ~/.mythtv/lircrc
#
# MythTV native LIRC config file for
# the Xbox remote control and USB receiver.
# The Xbox remote uses RCA dvd player commands.
# Any universal remote should be able to control
# this device.

begin
prog = mythtv
button = up
repeat = 4
config = Up
end

begin
prog = mythtv
button = down
repeat = 4
config = Down
end

begin
prog = mythtv
button = left
repeat = 4
config = Left
end

begin
prog = mythtv
button = right
repeat = 4
config = Right
end

# Select
begin
prog = mythtv
button = enter
repeat = 4
config = Space
end

# Menu
begin
prog = mythtv
button = menu
repeat = 4
config = M
end

# Info
begin
prog = mythtv
button = info
repeat = 4
config = i
end

# Play
begin
prog = mythtv
button = play
repeat = 4
config = Return
end

# Stop
begin
prog = mythtv
button = stop
repeat = 4
config = Esc
end

# Pause
begin
prog = mythtv
button = pause
repeat = 4
config = P
end

# skip forward (short)
begin
prog = mythtv
button = ffwd
repeat = 4
config = Right
end

# skip back (short)
begin
prog = mythtv
button = rewind
repeat = 4
config = Left
end

# jump forward (long)
begin
prog = mythtv
button = skip+
repeat = 4
config = down
end

# jump back (long)
begin
prog = mythtv
button = skip-
repeat = 4
config = up
end


# Numbers 0-9

begin
prog = mythtv
button = 0
repeat = 4
config = 0
end

begin
prog = mythtv
button = 1
repeat = 4
config = 1
end

begin
prog = mythtv
button = 2
repeat = 4
config = 2
end

begin
prog = mythtv
button = 3
repeat = 4
config = 3
end

begin
prog = mythtv
button = 4
repeat = 4
config = 4
end

begin
prog = mythtv
button = 5
repeat = 4
config = 5
end

begin
prog = mythtv
button = 6
repeat = 4
config = 6
end

begin
prog = mythtv
button = 7
repeat = 4
config = 7
end

begin
prog = mythtv
button = 8
repeat = 4
config = 8
end

begin
prog = mythtv
button = 9
repeat = 4
config = 9
end



# The following buttons can be configured as desired.  The configuration below repeats
# commands available from other buttons.

# Title Button
begin
prog = mythtv
button = title
repeat = 4
config = i
end

# Display Button
begin
prog = mythtv
button = display
repeat = 4
config = i
end

# Back Button
begin
prog = mythtv
button = back
repeat = 4
config = esc
end

Set LIRC to start at boot:

[root@LivingRoom ~]# /sbin/chkconfig lircd on

Load the lirc_atiusb Module

Support for the Xbox IR receiver is built into the driver for the ATI Remote Wonder USB receiver. Load this module at boot by adding the following line to /etc/rc.local:

/sbin/modprobe lirc_atiusb

Reboot

[root@LivingRoom ~]# reboot

Your remote should now work in MythTV.


Universal Remote Support

The standard codes used by the Xbox IR receiver are RCA DVD player codes. You should be able to program any universal remote to use these codes.

Alternate Installation with Mythbuntu Control Center

Using the lircd.conf file from above Create a directory using

sudo mkdir /usr/share/lirc/remotes/xbox

copy the lircd.conf from above, make the lircd.conf.xbox file and paste the contents into the new file.

sudo nano /usr/share/lirc/remotes/xbox/lircd.conf.xbox

Run Mythbuntu control centre (found in Applications->System) to set the infrared device with the following options:

   * Remote: Custom
   * Driver: (Leave Blank)
   * Module(s): lirc_atiusb lirc_dev
   * Configuration: lircd.conf.xbox
   * Device: /dev/lirc0


Once this is applied, it will generate all your lirc stuff from it. This is very good for mythbuntu because it helps with propagating the remote mapping to all of the remote enabled apps (mplayer, totem, etc).

The not all buttons are mapped and you can add them by editing the file "~/.lirc/mythtv"

nano ~/.lirc/mythtv 

Using this example format

begin
    remote = Xbox_Remote
    prog = mythtv
    button = back
    config = ]
    repeat = 0
    delay = 0
end

begin
    remote = Xbox_Remote
    prog = irexec
    button = title
    config = xset -display :0 dpms force off
    repeat = 0
    delay = 0
end

Credit goes to drockhead in the Mythbuntu forum [3]

  • Note, I followed the above Mythbuntu steps and had issues with lirc. The problem was that LIRCD was not enabled.

Check that lircd is running

ps ax | grep lirc

If you don't see /usr/sbin/lircd --device=/dev/lirc0 or something similar you'll need to enable LIRCD.

sudo nano /etc/lirc/hardware.conf

Find START_LIRCD and set it to "true"