MCE Remote

From MythTV Official Wiki
Revision as of 06:11, 3 October 2006 by Indulis (talk | contribs) (Programmable Buttons)

Jump to: navigation, search

Media Center Remotes

MCEremote.jpg Media Centre Remote 2
Version 1
Version 2
Model: ????
Model: 1039

Windows Media Center Remotes (USB)

Vendors Website: http://www.microsoft.com/hardware/mouseandkeyboard/productdetails.aspx?pid=065

Support Status: IR Receiver Supported. IR Transmitter not supported (yet).

There are two version of the MCE remote, typically referred to as the 'older' and 'newer' models. Both of these are now supported in the latest lirc, currently 0.8.0. The newer remotes come in different shapes and are manufactured by Philips and half a dozen other manufacturers.

Description

USB Remote intended for Media Center PCs

Issues and Problems

As of lirc-0.8, both the older and newer remotes are supported, although the IR blaster is not supported. However you can souce a supported IR Blaster here.

Those using the mceusb2 module (for the newer MCE remote) may want to implement Maciek Klimkowski's patch to make the remote feel a little more responsive and detect repeat keys properly. Bascially, you just need to edit the lirc_mceusb2.c file in the downloaded lirc code (/lirc-0.8.0/drivers/lirc_mceusb2/lirc_mceusb2.c) to remove lines 354 to 357 and insert send_packet_to_lirc(ir); just after the resulting line 380. You can then go ahead and configure / make / install lirc.

Associated Software

Lirc: http://www.lirc.org/

Installation guides

Older remote

I would think it's the same as the newer remote instructions below, but I can't verify. Only difference is the module name - it will be lirc_mceusb instead of lirc_mceusb2.

Newer remote

You must be using a 2.6 kernel for the newer remote. The kernel module that lirc creates does not have 2.4 support.

Be sure your kernel has support for USB. Most default kernels will. You will only need the USB 1.1 driver (OHCI or UHCI) and USB 2.0 (EHCI) is not required. There is no kernel module specific for this device. Before continuing, be sure your device is recognized by your USB host controller:

NOTE: The lirc_mceusb2 module must load before any USB ehci modules!

# lsusb
Bus 002 Device 001: ID 0000:0000
Bus 001 Device 002: ID 0471:0815 Philips
Bus 001 Device 001: ID 0000:0000

Download and extract at least lirc-0.8.0 from lirc.org.

cd /usr/src
wget http://prdownloads.sourceforge.net/lirc/lirc-0.8.0.tar.bz2
bunzip lirc-0.8.0.tar.bz2
tar -xvf lirc-0.8.0.tar
cd lirc-0.8.0

You now have two choices, you can either run the Lirc Setup script and accept it installing itself where it wants to, or you can carry out a manual configure. Using the setup script is easier, but it means that the various binararies and configuration files aren't placed in the normal Gentoo locations.

To use the automated setup process:

./setup.sh
Menu Option # (1) - Driver Configuration (enter)
Menu Option # (8) - USB Devices (enter)
Menu Option # (h) - Windows Media Center Remotes (new version, Philips et al.) (enter)
Menu Option # (3) - Save your configuration and run configure (enter)
make
make install

This will also create a /etc/lircd.conf file which should work. If it complains about missing fedora source files use "yum install kernel-devel" and rerun ./setup.sh.

To perform the manual configuration:

./configure --prefix=/usr --sysconfdir=/etc/conf.d --with-x --with-driver=all
make
make install
cp remotes/mceusb/lircd.conf.mceusb /etc/conf.d/lircd.conf

If you get errors during the compile, try to use the .configure step with --with-driver=mceusb2 instead of all. You should change mceusb2 to mceusb if you are using the old version of the remote.

If you get an error message that the "kernel source is required", it actually means the kernel headers. On my system this Ubuntu package was linux-kernel-headers-2.9.12-9-386 to match the version returned by the uname -a command. Installing the right version of the headers to match your kernel version is esssential. You may also need to install the gcc compiler.

Load the module

# modprobe lirc_mceusb2

Start lircd

# lircd

Test it with irw. irw will output the commands received by the IR receiver that match your lircd.conf file. So start irw, point your remote and start pressing buttons.

# irw
000000037ff07bfe 00 One mceusb
000000037ff07bfd 00 Two mceusb
000000037ff07bfd 01 Two mceusb
000000037ff07bf2 00 Home mceusb
000000037ff07bf2 01 Home mceusb

If everything works, then autoload lirc_mceusb2 when your computer loads (how to depends on your distro) and start lircd as well (also depends on your distro).

One note, I'm running a late-model Gentoo and I have to load lircd with this option:

# lircd -d /dev/lirc/0

Otherwise it fails, as it defaults to /dev/lircd.

You will also need to install an lircrc file (note no dot at the front of the filename in the ~/.mythtv directory so that when the frontend starts up it can see the mythtv configuration settings for your remote control buttons.

To Autoload LIRC + MCE Module At Boot On Suse

Note: On Suse 10.1 you don't need to install lirc as above, just install the lirc and lirc-kmp-<your kernel type> rpms (to find kernel type, type "rpm -qf /boot/vmlinuz" at a command prompt). You still need to do the following though.

On Suse you can start the lirc daemon at boot by using the run level editor (yast > system > system services) and enabling lirc. After this you need to edit /etc/sysconfig/lirc to load the lirc_mceusb2 module at boot. Look for the following lines and make any additions as needed (ie. they should look like this when you're finished):

LIRCD_DRIVER=""

LIRCD_DEVICE="/dev/lirc"

LIRC_MODULE="lirc_mceusb2"

You can leave the rest as it is. Other distros should be pretty similar.

FAQs

Phillips eHome: These are now supported in latest lirc. For those that must run a pre 0.8 version, follow the INSTALL guide at http://www.blatter.com/mceusb/old/INSTALL. Be sure that the source you are compiling against is the recomended 0.7.0 branch. Note that this patch is no longer updated or supported since it is now part of the lirc distribution. The IR Transmitter is NOT supported by this project.

For my Gentoo (2.6.10) installation I had to do a few extra things. Before following any install documentation, remove all lirc_mceusb.ko and lirc_dev.ko modules. Mine were in /lib/modules/2.6.10/misc/ . I also had to remove /lib/dev-state/lirc* because devfs was apparently trying to restore some older (non working) lirc states.

Now follow the instructions in the INSTALL to verify proper installation (it may be helpful to load the module with "modprobe -v lirc_mceusb" to ensure you are loading the proper modules from the proper places).

I will add more to this as I understand it better, but for right now I finally have this working. Any help on Wiki Formatting would also be appreciated.

KnoppMyth R5B7

With a clean install from R5B7 I had to edit one file to get my remote working:
/etc/init.d/lirc

Orig:
start-stop-daemon --start --quiet --exec /usr/sbin/lircd -- $LIRCD_ARGS \
Changed to:
start-stop-daemon --start --quiet --exec /usr/sbin/lircd \

Stole this from the forums - figured it should be in the wiki:
http://mysettopbox.tv/phpBB2/viewtopic.php?t=5620

Configuring the Buttons

Programmable Buttons

The MCE Remote Control is able to learn codes from other remote controls. This was designed to allow you to turn on and off your television and control the TV volume. Only the following MCE buttons are able to be programmed:

  • TV Power
  • Volume +
  • Volume -

To program these buttons, do the following steps for each button:

  1. Hold the "DVD MENU" and "OK" buttons at the same time for 2 seconds until the backlight turns off.
  2. Press the MCE button that you want to program. The backlight will blink once to confirm.
  3. Point the original TV remote control at the top of the MCE remote and press the button that you want teach. The MCE remote backlight will blink twice to confirm. If the learning phase fails the MCE remote will blink 4 times (error).

Suggested changes to Button Functions

You can customise LIRC to do different functions for each button (and for each application). Please add your suggestions as a subsection below.

Configuring the power button to do DPMS sleep/unsleep

One feature that I used when I used LIRC was configuring my power button (Button PC) to wake up my Plasma screen from DPMS slumber using a script via irexec. The same button will let the Plasma screen go to to sleep. DPMS is useful for avoiding burned-in screen. Most people do not want to use DPMS or screensavers because you need to press a key on the keyboard or move the mouse for getting rid of it when it activates. But if you configure the power button on the remote to activate on or off the DPMS you can avoid burned-in plasma screen.

First off, I edited my ~/.lircrc file to include the following stanza. A good Howto and MCE .lircrc file for Fedora Core 4 or 5 you can find here [1]:

begin
    prog = irexec
    button = Power
    repeat = 3
    config = /usr/local/bin/mythpowerbutton.sh
    #config = Key Alt-Escape CurrentWindow
end
 

Note that we need irexec running to make this all work. For me this was done via the myth-load.sh script, detailed in the main HOWTO Jarod Wilson has written [2]. And finally, I created a trivial little shell script in /usr/local/bin/, called mythpowerbutton.sh. Thanks to Yeechang Lee for this script [3]:

#!/bin/sh 

if [ `cat /tmp/mythsleeptogglestatus` == "off" ] 
then 
xset dpms force on; 
echo "on" > /tmp/mythsleeptogglestatus 
else 
sleep 1; 
xset dpms force off; 
echo "off" > /tmp/mythsleeptogglestatus 
fi 

Remember to make that executable (# chmod +x /usr/local/bin/mythpowerbutton.sh), and either log out and back in or start up irexec manually to see it function. I'd also remove any other .lircrc sections pertaining to the POWER button, or you may see multiple things happen at once.

Now when I press the Power button on the remote, the screen blanks (DPMS on) and with one more press open up the Mythtv GUI (DPMS off).

Troubleshooting the MCE Remote

The MCE firmware can sometimes get into an inconsistent state and needs to be reset.

There must be a large capacitor in the unit because you have to remove the batteries for 1/2 hour or more to discharge it , or try pressing lots of buttons to discharge it quicker. This should reset the firmware.