Ubuntu Serial Lirc Install

From MythTV Official Wiki
Revision as of 15:28, 15 September 2007 by Tagra123 (talk | contribs) (About)

Jump to: navigation, search

About

This Guide is the 'official' way to install Lirc remote control drivers in Ubuntu Linux

This guide is for a serial device

There are similar instructions at the Ubuntu Community site https://help.ubuntu.com/community/Install_Lirc_Feisty

An alternate method using ledxmit (lirc) is located here: http://ubuntuforums.org/showthread.php?t=550068 (This method works well with homebrew serial irblasters)

Install

  • Install Lirc
sudo apt-get install lirc lirc-modules-source module-assistant
  • Configure lirc-modules-source
sudo dpkg-reconfigure lirc-modules-source 
A Configuration should appear
Choose the OK button and press enter (tab key to move across)
Make sure only the serial module is selected, use the space bar to select, and then press enter on OK
You will be given an option to build the modules. Be sure not to build the modules here
You may be given an option to replace with a new version. Be sure to choose to Install the package maintainer's version
  • Modify /etc/lirc/lirc-modules-source.conf
sudo nano /etc/lirc/lirc-modules-source.conf
LIRC_MODULES="serial"
LIRC_SERIAL_PORT="0x03f8"
LIRC_SERIAL_IRQ="4"
LIRC_SERIAL_CFLAGS=" -DLIRC_SERIAL_TRANSMITTER -DLIRC_SERIAL_SOFTCARRIER"
LIRC_SERIAL_PORT needs the address of your serial port, this is usually shown in the bios, 0x03f8 is usually serial port 1
LIRC_SERIAL_IRQ is also shown in the bios, 4 is usually serial port 1
  • Modify /etc/lirc/hardware.conf
sudo nano /etc/lirc/hardware.conf
Make sure LOAD_MODULES is =true. Also, edit your modules to MODULES="lirc_dev lirc_serial"
  • Remove Old Drivers and Build Lirc Modules (Don't worry about file not found errors).
sudo m-a update,prepare
sudo rm /usr/src/lirc*deb
sudo m-a clean lirc
sudo m-a a-i -f lirc
sudo depmod -a
  • Install setserial to allow lirc to take control of your serial device
sudo apt-get install setserial
  • Disable ubuntu's control of your serial port
sudo setserial /dev/ttyS0 uart none
sudo setserial /dev/ttyS1 uart none
  • Load Module
sudo modprobe lirc_serial

This should now complete without an error

  • Restart Lirc
sudo /etc/init.d/lirc restart

Remote Configuration

You can get a remote configuration file at sourceforge http://lirc.sourceforge.net/remotes/

If your remote is not listed there, or their remote codes dont work for you, you will have to reccord your own For this you will need a IR Reciever, a serial one will work with the above guide I managed to record using the mceusb2 reciever, however you will need to recompile lirc to use it

Lets assume you have a 3M MP8640 remote

mkdir ~/lirc
cd ~/lirc
wget http://lirc.sourceforge.net/remotes/3m/MP8640
sudo cp MP8640 /etc/lirc/lircd.conf

Testing Your IRBlaster

Assuming you managed to get a lircd.conf that worked

sudo nano /etc/lirc/lircd.conf
At the top there will be somthing written next to name

lets assume it says

name  MP8640

now to test a code

irsend send_once MP8640 1

You should now see a 1 appear on your set top box (or if you have an LED irblaster it should blink)

Testing your IR Reciever

Open a terminal and type

irw

now start pressing buttons on your remote, you should see lines appear in your window If its working ok, press Ctrl+C to quit irw

Recording your Remote

Firstly you need to stop lirc

sudo /etc/init.d/lirc stop

Then run irrecord

irrecord -d /dev/lirc lircd.conf
/dev/lirc is your lirc device, for me this was lirc0

irrecord will ask you to press buttons, this is to determine how your remote works If it is picking up your remote, full stops will scroll accross the screen It will then ask you to enter a name for each button, and then to press it, this will record your remote When you are done, press enter without putting anything in the name field This will write your remote control codes to lircd.conf in the directory your in

  • Move lircd.conf to the correct dirrectory
sudo cp lircd.conf /etc/lirc

Troubleshooting

If you are having problems, like IRW dropping back to the console a good way to diagnose is to launch lircd in the foreground

sudo lircd -n

now if you do IRW you will see why lircd is dieing, or any other errors