The Restored Long and Hopefully Definitive IR BLASTER HOWTO for LIRC / MYTHTV This version restored from google cache and given a home. andy@benow.ca Original follows: The Long and Hopefully Definitive IR BLASTER HOWTO for LIRC / MYTHTV By Robert Wamble (rwraithr@cox.net) 0411.03 11:00 v2.1 Download link: http://members.cox.net/rwraithr The mission was to get MythTV to use my Actisys IR-200L blaster to change channels on my Scientific Atlanta Explorer 2000. Since MythTV uses lirc for its remote control, and lirc hasn't (for me) easily handled two devices simultaneously, I had to get an independent lirc running to drive the blaster. To do this, I followed the recommendations found in mythtv-users postings by Sriram Balakrishnan, Gary Te Young, and Mike Smith. This HOWTO and accompanying scripts comprise my attempt to steamline the process for others. While I can only say that this works for my setup, hopefully it will be helpful with other hardware combinations. I have MythTV installed on a Fedora Core 2 box, using Jarod C. Wilson's HOWTO at http://wilsonet.com/mythtv/index.php", with a Hauppauge PVR 350. As stated, my IR Blaster is the Actisys IR-200L, which I got from http://store.snapstream.com/index.html under Accessories. I've added notes throughout for the 2.6.x kernel changes. Summary of sections: 1. Get lirc-0.7.0pre8.tar.bz2 * 2. Use lirc2remote.sh to convert to remote-0.7.0pre8 * 3. Configure and build remote-0.7.0pre8 (2.4 and 2.6 kernels) 4. Edit /etc/modules.conf (2.4 kernel) or /etc/modprobe.conf (2.6 kernel) 5. Edit /etc/rc.d/rc.local 6. Install /etc/remoted.conf for your tuner box 7. Check BIOS settings for serial port 8. Boot and test 9. Related Scripts (change_channel.csh, channel.pl, lirc2remote.sh) ** * An already converted remote-0.7.0pre8.tar.bz2 may be available for download at the website mentioned above. ** A channel.pl that handles 4 digit channels is attached below, and may be available from the website mentioned above. Installation: * If you use the remote-0.7.0pre8.tar.bz2 download, extract it with tar xfj remote-0.7.0pre8.tar.bz2, then skip steps 1 and 2, proceeding to step 3. 1. Get lirc-0.7.0pre8.tar.bz2. Follow the Download instructions in Section 22.2 "Hauppauge PVR-250 remote and MythTV's native LIRC support" in the MythTV Documentation. In essence, do: wget http://lirc.sourceforge.net/software/snapshots/lirc-0.7.0pre8.tar.bz2 Extract it with: tar xjf lirc-0.7.0pre8.tar.bz2 2. Note that the lirc package has configure options that allow you to set the alternate device major and port. But, if you specify those options, you also need to specify the options that setup.sh would normally construct for you. I've found it easier to just convert the package and let setup.sh do its job. Use lirc2remote.sh to convert lirc-0.7.0pre8 to remote-0.7.0pre8. This step renames the directories, files, and variables in the files that have "lirc" to "remote", changes the device major number from 61 to 72, and changes the port from 8765 to 8768. It's still lirc, it'll just be able to run along side the standard lirc. Put lirc2remote.sh in the current directory. The lirc-0.7.0pre8 directory should be in the current directory, too. The script will move the lirc-0.7.0pre8 dir to remote-0.7.0pre8, rename the lirc* dirs to remote*, rename the lirc* files to remote*, then change all occurrences of "lirc" and "LIRC" to "remote" and "REMOTE". The script will then open vi on each file, one at a time, that you need to MANUALLY check for and change each occurrence of the device major number from 61 to 72. Use /61 to search for 61, change it to 72, hit n to go to the next occurrence of 61, etc. When done, use :wq to write and quit that file to go to the next. Note that you're only changing the 61 for the device major number, ie. char-major 61. Some of them don't refer to the device major number, so leave those at 61. You can :q past the remote control configuration scripts toward the end. Don't change lines that have hex, ie. 0x61 doesn't refer to the device major number. Then you'll do the same thing to change port 8765 to 8768. After than, it'll fix some permissions and run mknod for the /dev/remote device. As root, run the script: ./lirc2remote.sh 3. Setup, configure, and build remote-0.7.0pre8: The build requirements are the same as the normal lirc package. Do the following: cd remote-0.7.0pre8 ./setup.sh Select 1 Driver configuration Select 6 IrDA hardware Select 4 Actisys Act200L SIR driver support (in my case) Select 2 COM2 (0x2f8, 3) (in my case) Select 3 Save configuration & run configure After configure finishes, run make, but not make install yet. Make appears to run through configure again to find aclocal, autoconf, etc. Just let it run, and it'll do the build. If it fails, perform the steps in the segment below to configure your kernel source. ======== skip the below section if make succeeds If you get an error to the effect that TOPDIR parameter is null or not set, or myriad other errors, you probably need to get your kernel dependencies in order. Try this: cd /usr/src/linux (linux linked to your kernel) make mrproper cp /boot/config-`uname -r` .config On 2.4 kernels, do: Check /usr/src/linux/include/linux/version.h and /usr/src/linux/Makefile and remote the word "custom" from UTS_RELEASE and EXTRAVERSION, and/or change ".atc" into ".at". make oldconfig ; make dep On 2.6 kernels, do: Check /usr/src/linux/Makefile and remove the word "custom" from EXTRAVERSION. make oldconfig make prepare The make prepare will generate the required "version.h" file. Then go back to remote-0.7.0pre8 and, as root, do the setup.sh/configure, and run make again. It should work this time. ======== skip the above section if make succeeds Before you make install, note that the tools will overwrite the normal lirc tools, only if they are installed in /usr/local/bin. If you used apt-get to install lirc, then you don't have to back up the lirc tools. So, if you need to backup and restore the lirc tools, perform all steps, A, B, and C. If you don't need to back up the lirc tools, just perform step B. A. Back up the lirc tools: cd /usr/local/bin mkdir orig cp ircat irexec irpty irrecord irsend irw irxevent mode2 xmode2 orig cd - (back to the remote-0.7.0pre8 directory) B. Install the blaster tools: make install cd /usr/local/bin mv ircat remote_ircat mv irexec remote_irexec mv irpty remote_irpty mv irrecord remote_irrecord mv irsend remote_irsend mv irw remote_irw mv irxevent remote_irxevent mv mode2 remote_mode2 mv xmode2 remote_xmode2 C. Restore the lirc tools: mv orig/* . rmdir orig 4. Module configuration For 2.4 kernels, edit /etc/modules.conf. Add the following: alias char-major-72 remote_sir below remote_sir remote_dev options remote_sir irq=3 io=0x2f8 At the top of the file, add: path[toplevel]=/lib/modules/`uname -r`/misc For 2.6 kernels, edit /etc/modprobe.conf. Add the following: alias char-major-72 remote_sir options remote_sir irq=3 io=0x2f8 Your options may be different. My blaster is on COM2, irq=3, io=0x2f8 5. Edit /etc/rc.d/rc.local for auto-starting the daemon: Add to rc.local: echo "Starting remoted..." setserial /dev/ttyS1 uart none /sbin/modprobe remote_sir /usr/local/sbin/remoted 6. Put in the receiving device's config file. Check http://www.lirc.org/ for remotes.tar.bz2. I found my Cox box in remotes/scientific_atlanta, the Explorer_2000 file. I just copied that file to /etc/remoted.conf. 7. Check BIOS setting for your serial port. On my box, I had to use COM2, and I had to have it set to NORMAL, *not* IrDA or ASKIR. 8. Boot and test. The change_channel.csh and channel.pl scripts are below. Put them in /usr/local/bin, and don't forget to chmod +x both of them. Note that the command to change the channel in channel.pl is remote_irsend. You can use remote_irrecord --device=/dev/remote filename just to see if the blaster is receiving signals from the remote it's supposed to know how to act like. I saw dots while hitting buttons, but it didn't detect something it needed, so it didn't actually create a file. I didn't need a file, since my Explorer 2000 is in the remotes database. If it's working, you should be able to aim the blaster at the tuner and type change_channel.csh 13 and it'll send 1 and 3 to your tuner. Then you can set up MythTV to use change_channel.csh as the external channel changing command. It was quite a joy when I finally saw it happen for the first time. Mine works from five feet away, though I won't need it that far back. Well, hopefully this Howto and script come in handy to users of IR Blasters and MythTV. Feel free to email me questions, corrections, or comments at rwraithr@cox.net. 9. Related Scripts: The change_channel.csh script (set MythTV to use this script): ----cut below this line for change_channel.csh, don't include this line---- #!/bin/csh echo "changing to $1" /usr/local/bin/channel.pl $1 & ----cut above this line for change_channel.csh, don't include this line---- The channel.pl script (edit your $remote_name): ----cut below this line for channel.pl, don't include this line---- #!/usr/bin/perl # rwraithr added segment for 4 digit channels # make sure to set this string to # the corresponding remote in /etc/remoted.conf $remote_name = "SA2000"; sub change_channel { my($channel_digit) = @_; system ("/usr/local/bin/remote_irsend SEND_ONCE $remote_name $channel_digit"); sleep 1; } $channel=$ARGV[0]; sleep 1; if (length($channel) > 3) { change_channel(substr($channel,0,1)); change_channel(substr($channel,1,1)); change_channel(substr($channel,2,1)); change_channel(substr($channel,3,1)); } elsif (length($channel) > 2) { change_channel(substr($channel,0,1)); change_channel(substr($channel,1,1)); change_channel(substr($channel,2,1)); } elsif (length($channel) > 1) { change_channel(substr($channel,0,1)); change_channel(substr($channel,1,1)); } else { change_channel(substr($channel,0,1)); } system ("/usr/local/bin/remote_irsend SEND_ONCE $remote_name SELECT"); ----cut above this line for channel.pl, don't include this line---- The Main Script: lirc2remote.sh ----cut below this line for lirc2remote.sh, don't include this line---- #!/bin/bash # # lirc2remote.sh -- Convert lirc dirs/files/vars to remote for IR Blaster. # Version 1.3 # Updated for lirc-0.7.0pre8 # 0410.15 No rights reserved. Deploy and use as desired. YMMV. # # Download link: http://members.cox.net/rwraithr # # The idea is to run an independent version of lirc to handle the IR # Blaster, so that conflicts with the lirc running for MythTV are avoided. # # This script and Howto created by Robert Wamble (rwraithr@cox.net) because # I just had to get my Actisys IR Blaster working with MythTV and # my Cox Cable issued Scientific Atlanta Explorer 2000 digital tuner. # # Special thanks to Sriram Balakrishnan, Gary Te Young, and Mike Smith # whose mythtv-users list inputs on the subject pointed me in the right # direction and provided valuable information. # Rename main lirc dir echo "" echo "Moving main dir" if [ ! -d lirc-0.7.0pre8 ] ; then echo "" echo "lirc-0.7.0pre8 not found" exit fi if [ -d lirc-0.7.0pre8 ] ; then mv lirc-0.7.0pre8 remote-0.7.0pre8 fi # Rename the lirc directories echo "" echo "Moving lirc directories" mv remote-0.7.0pre8/drivers/lirc_atiusb remote-0.7.0pre8/drivers/remote_atiusb mv remote-0.7.0pre8/drivers/lirc_bt829 remote-0.7.0pre8/drivers/remote_bt829 mv remote-0.7.0pre8/drivers/lirc_dev remote-0.7.0pre8/drivers/remote_dev mv remote-0.7.0pre8/drivers/lirc_gpio remote-0.7.0pre8/drivers/remote_gpio mv remote-0.7.0pre8/drivers/lirc_i2c remote-0.7.0pre8/drivers/remote_i2c mv remote-0.7.0pre8/drivers/lirc_igorplugusb remote-0.7.0pre8/drivers/remote_igorplugusb mv remote-0.7.0pre8/drivers/lirc_it87 remote-0.7.0pre8/drivers/remote_it87 mv remote-0.7.0pre8/drivers/lirc_mceusb remote-0.7.0pre8/drivers/remote_mceusb mv remote-0.7.0pre8/drivers/lirc_parallel remote-0.7.0pre8/drivers/remote_parallel mv remote-0.7.0pre8/drivers/lirc_sasem remote-0.7.0pre8/drivers/remote_sasem mv remote-0.7.0pre8/drivers/lirc_serial remote-0.7.0pre8/drivers/remote_serial mv remote-0.7.0pre8/drivers/lirc_sir remote-0.7.0pre8/drivers/remote_sir # Rename the lirc files echo "" echo "Moving lirc files" find remote-0.7.0pre8 -name '*lirc*' -print > lircfiles.txt for i in `cat lircfiles.txt` do if [ -f $i ] ; then NewFileName=`echo $i | sed 's/lirc/remote/'` mv $i $NewFileName fi done # Rename lirc occurrences in the files echo "" echo "Renaming lirc vars in files" find remote-0.7.0pre8 | xargs grep -l lirc > lircvars.txt for i in `cat lircvars.txt` do if [ -f $i ] ; then cat $i | sed 's/lirc/remote/g' > $i.newfile mv $i.newfile $i fi done # Rename LIRC occurrences in the files echo "" echo "Renaming LIRC vars in files" find remote-0.7.0pre8 | xargs grep -l LIRC > LIRCvars.txt for i in `cat LIRCvars.txt` do if [ -f $i ] ; then cat $i | sed 's/LIRC/REMOTE/g' > $i.newfile mv $i.newfile $i fi done # Check for device number 61, manually change to 72. Then :wq the file to # check the following file. echo "" echo "Manually change device number 61 to 72, then :wq for next file." echo "Note that not every 61 refers to the device number." echo "You can :q to skip the remote control config files." echo "Use /61 to search for 61, and hit n for next occurrence." echo "(15 second pause)" sleep 15 find remote-0.7.0pre8 | xargs grep -l 61 > device61.txt for i in `cat device61.txt` do vi $i done # Check for port number 8765, manually change to 8768. Then :wq the file to # check the following file. echo "" echo "Manually change port number 8765 to 8768, then :wq for next file." echo "Use /8765 to search for 8765, and hit n for next occurrence." echo "(15 second pause)" sleep 15 find remote-0.7.0pre8 | xargs grep -l 8765 > port8765.txt for i in `cat port8765.txt` do vi $i done # Restore exec permissions echo "" echo "Restoring exec permissions" chmod +x remote-0.7.0pre8/configure remote-0.7.0pre8/*.sh # Make the remote device echo "" echo "Mknod remote device /dev/remote" /bin/mknod /dev/remote c 72 0 echo "" echo "Conversion done. Refer to the Howto for build, install, and" echo "configuration." echo "" ----cut above this line for lirc2remote.sh, don't include this line----