HOWTO LIRC
From Gentoo Linux Wiki
Linux Infrared Remote Control -- Driver Installation and Use
| Installation • Kernel & Hardware • Networks • Portage • Software • System • X Server • Gaming • Non-x86 • Emulators • Misc |
[edit] Kernel Configuration
| Linux Kernel Configuration: 2.6 |
Loadable module support ---> [*] Module unloading |
On my system the deprecated sysfs was needed:
| Linux Kernel Configuration: 2.6 |
General setup ---> [*] Create deprecated sysfs files |
| Linux Kernel Configuration: 2.6 |
Device Drivers --->
Input device support --->
[*] Event interface
|
[edit] Configuration basics
First things first: You should decide what type of receiver you are using. If not, only support for the homebrew serial receiver will be compiled.
Homebrew receiver drivers:
Other possible options (from the lirc-0.7.0-r1 ebuild) are as follows:
all, none, userspace, act200l, act220l, adaptec, alsa_usb, animax, atilibusb, atiusb, audio, avermedia, avermedia_vdomate, avermedia98, bestbuy, bestbuy2, breakoutbox, bte, bw6130, caraca, chronos, cmdir, comX, cph06x, creative, creative_infracd, devinput, digimatrix, dsp, dvico, ea65, exaudio, flyvideo, gvbctv5pci, hauppauge, hauppauge_dvb, hercules_smarttv_stereo, igorplugusb, imon, imon_pad, imon_rsc, irdeo, irdeo_remote, irman, irreal, it87, knc_one, kworld, leadtek_0007, leadtek_0010, leadtek_pvr2000, livedrive_midi, livedrive_seq, logitech, lptX, mceusb, mceusb2, mediafocusI, mouseremote, mouseremote_ps2, mp3anywhere, nslu2, packard_bell, parallel, pcmak, pcmak_usb, pctv, pixelview_bt878, pixelview_pak, pixelview_pro, provideo, realmagic, remotemaster, sa1100, sasem, serial, silitek, sir, slinke, streamzap, tekram, tekram_bt829, tira, tvbox, udp, uirt2, uirt2_raw.
That's a lot of options. For those of you with a homebrew serial receiver, your option will be "serial". If you received a remote with your video card or TV tuner, you will need to choose the most appropriate driver from the list above. You can get some idea of whether your hardware is supported or not by checking the sidebar of the official LIRC website. For using the tvcard integrated controllers like hauppauge, don't forget to compile your kernel with i2c support!
Once you have chosen your driver, add it to your make.conf file.
[edit] Update /etc/make.conf
| File: /etc/make.conf |
LIRC_DEVICES="serial sir" |
If your device is supported by the kernel, (uses /dev/input/eventX) you will need to use the dev/input driver instead. This works particually well for the Hauppage NOVA-T.
| File: /etc/make.conf |
LIRC_DEVICES="devinput" |
[edit] Installing
If you have any issue please look further down for a more detailed description.
Ideally you would go through:
- emerge lirc
- modprobe lirc_<LIRCDRIVER>
- /etc/init.d/lircd start
- Make sure /etc/conf.d/lircd is right
- Test the remote:
- irw
- echo lirc_<LIRCDRIVER> >> /etc/modules.autoload.d/kernel-2.6
- rc-update add lircd default
[edit] Emerge
Emerge LIRC: emerge -av lirc
Older versions of Lirc apply their sources to the kernel sources. By default configuration, it is not possible for an ebuild to overwrite kernel source files. In case that you are using such an ebuild, you can fix the issue with the following command: config-kernel --allow-writable=yes
Depending on your mix of kernel and lirc versions, you can run into incompatibility issues. Especially the warning "Unknown symbol class_simple_device_add" indicates that you might have to switch versions. Try to get a more recent lirc ebuild by doing: echo "app-misc/lirc ~x86" >> /etc/portage/package.keywords. If that doesn't help, you probably have to downgrade your kernel.
[edit] Loading the module
If you had to build a kernel module, activate it now, using modprobe lirc_driver. (Make sure to substitute "driver" for an appropriate value).
You may need to use an appropriate kernel module for your hardware to work properly. If so, you will have to add "lirc_driver" to your /etc/modules.autoload.d/kernel-2.x file so the module can load during boot. Substitute "driver" in "lirc_driver" to the actual driver you are using, which was defined in the LIRC_DEVICES variable in your make.conf above. To enable serial support for instance, you would add "lirc_serial".
[edit] Setserial
If you are using the serial driver and run into problems on module load, sys-apps/setserial will probably help you. Install the program if you don't have it already and run setserial /dev/ttySX uart none to enable the serial port.
If you needed setserial to load the module you will probably need to add it to your startup scripts. First, configure setserial by editing /etc/serial.conf, add /dev/ttyS0 uart none
After that, run rc-update add serial boot.
| FIXME: Move these instructions to instructions below, merge with hardware specific drivers and Troubleshooting |
Update:
You can simply edit /etc/modules.d/lirc and add the following line to lirc-enable the port(s) before loading the lirc_serial module:
pre-install lirc_serial setserial /dev/ttyS0 uart none code>
You can also set options for the lirc_serial module there like this:
options lirc_serial irq=4 io=0x3f8 type=0 sense=1 code>
You do, of course still need to emerge setserial for this to work.
[edit] lirc configuration file
You need to have a config file for your remote control that tells lirc how to interpret the IR codes transmitted by your remote. The easiest way is to use an existing config file, try finding your remote in this listing. If your remote isn't listed you can try using irrecord to create the file. Or, if you are using a universal remote you can just program it to control for example a Sony TV set and then try any of the files listed under Sony.
When you have found a config file save it to /etc/lircd.conf.
[edit] Starting lircd
/etc/init.d/lircd start
Check that the LIRC device has been created at /dev/lircd:
[edit] Verify /etc/conf.d/lircd
ls -l /dev/lirc*
Please make sure that /etc/conf.d/lircd has the correct device as above otherwise you may experience "Connect: Connection refused" errors when trying to access the lirc device. For example:
LIRCD_OPTS="-d /dev/lirc0" rather than LIRCD_OPTS="-d /dev/lirc/0"
[edit] Testing the receiver
You should then test that the receiver works with the irw utility. Try running irw and pressing some buttons on your remote to see what the output is. If everything is correct irw will connect to the lircd device and echo the keys you've pressed.
[edit] Setup .lircrc
Now setup your ~/.lircrc file and you should be able to use lirc with every applications that supports it!
If so, congratulations! Your receiver is working, and you can now start adding support for you remote control.
[edit] Using Multiple Devices Simultaneously
The only hardware to natively support multiple blasters on Linux is the CommandIR Mini multi-transceiver. Many other LIRC devices will have both an IR blaster and receiver unified into one - but LIRC may not support this feature (ala lirc_mceusb2). The solution is to get a simple serial IR blaster but this can be difficult to set up via LIRC.
In order to accomplish this, you must make sure that you have compiled support for both devices. Currently the LIRC_DEVICES environment variable only supports doing one device - to work around this change make LIRC_DEVICES="all" in /etc/make.conf. After this, make sure you add both lirc_* modules into /etc/modules.autoload.d/kernel-2.x. Additionally, make sure you are used the "transmitter" USE flag when you emerged lirc.
The second step is to run two concurrent processes of LIRC for both devices and have them interact with each other. This can be tricky so I've taken the liberty of posting my own /etc/init.d/lircd:
| File: /etc/init.d/lircd |
start() {
ebegin "Starting lircd"
start-stop-daemon --start --pidfile /var/run/lircd1.pid --quiet --exec /usr/sbin/lircd -- --driver=default --device=/dev/lirc/1 --output=/dev/lircd1 --pidfile=/var/run/lircd1.pid --listen
start-stop-daemon --start --pidfile /var/run/lircd.pid --quiet --exec /usr/sbin/lircd -- --driver=default --device=/dev/lirc/0 --output=/dev/lircd --pidfile=/var/run/lircd.pid --connect=localhost:8765
eend $?
}
stop() {
ebegin "Stopping lircd"
start-stop-daemon --stop --quiet --pidfile /var/run/lircd1.pid --exec /usr/sbin/lircd -- --pidfile=/var/run/lircd1.pid
start-stop-daemon --stop --quiet --pidfile /var/run/lircd.pid --exec /usr/sbin/lircd -- --pidfile=/var/run/lircd.pid
eend $?
}
|
Essentially what this does is it creates two instances of lircd, one running at /dev/lircd/0 and the other at /dev/lircd/1. Edit the --device=/dev/lirc* line to suit whatever devices you have in your system in whatever order. Since my transmitter is /dev/lirc/1 and my reciever is /dev/lirc/0, /dev/lircd corresponds to my reciever and /dev/lircd1 corresponds to transmitter. This is optimal as some applications may have problems dealing with a non /dev/lircd LIRC device.
Run "/etc/init.d/lircd start" and both instances should start. Test them out, one by going "irw" and the other with irsend -d /dev/lircd1.
[edit] Hardware specific instructions
[edit] CommandIR Mini - USB Multi-Transceiver
CommandIR can control up to 4 devices independently using emitters and contains a built-in universal receiver to integrate all inbound and outbound IR control into a single Linux-native device. Installation instructions for Gentoo can be found in the manufacturers support site.
[edit] ALSA audio
First read about the hardware and the LIRC driver for ALSA. Now you have to tell LIRC what audio device to capture. In order to do it you simply edit the /etc/conf.d/lircd file. Virtually everyone wants to have:
| File: /etc/conf.d/lircd |
# Options to pass to the lircd process LIRCD_OPTS="-d hw:0,0" |
Note: For the lirc_mceusb2 module you need to have the /etc/conf.d/lircd file this this order! Note 2: -> also notice that i am using /dev/lirc/0 NOT /dev/lirc0 -> the latter did not work for me but the former did.
| File: /etc/conf.d/lircd |
LIRCD_OPTS="-d hw:0,0" LIRCD_OPTS="-d /dev/lirc/0" |
[edit] UIRT2 with Lirc
To use the homebrew UIRT2 with lirc we have to set some LIRC options in either our make.conf or in the environment.
For the UIRT2 with transmitter the following options are required. (The setup.sh would generate this.) export LIRC_OPTS="--with-driver=uirt2_raw --with-tty=/dev/tts/0 --with-port=none --with-irq=none"
or
| File: /etc/make.conf |
LIRC_OPTS="--with-driver=uirt2_raw --with-tty=/dev/tts/0 --with-port=none --with-irq=none" |
Alternativly you can create your own remote control definition file. (And also test your UIRT2 for connection etc).
Start irrecord irrecord myremote_definition.conf -d /dev/tts/0
Notice that we supplied the actual location (Com1) of the UIRT2. Even though we set the compile flag, it doesn't default to that location. Also know that you have to have serial_core and 8250 modules loaded or have them compiled into your kernel.
Note: the UIRT2 does not require any other kernel drivers than these. E.g. no lirc_dev nor lirc_serial.
If irrecord fails, make sure the connections are OK and that lircd is NOT running.
If everything was successfull you have now created a definition file for your remote control. Please email it to lirc@bartelmus.de so that others can benefit from your work.
Since irrecord showed us the communication part worked, we configure lircd and fire it up.
Edit the configuration file and let it point to your serial port.
| File: /etc/conf.d/lircd |
LIRC_OPTS="-d /dev/tts/0" |
[edit] Homebrew Serial Transmitter (serial)
Serial transmitter is smooth sailing, the only tricky thing to know is that kernel support for the serial port will conflict the driver. The way to fix this is to emerge the setserial utility, and then add "setserial /dev/ttyS0 uart none" (ttyS0 is COM1, ttyS1 is COM2, etc.) to /etc/conf.d/local.start. You will then have to add "modprobe lirc_serial" into /etc/conf.d/local.start afterwards because the script is executed after modules.autoload.d.
Alternatively you may try to add "/dev/ttyS0 uart none" to /etc/serial.conf (after emerging setserial) and run serial at boot "rc-update add serial boot". And have lirc_serial module loaded by adding it to /etc/modules.autoload.d/kernel-2.6 (don't forget to run update-modules afterwards).
If you are using receiver wired in "Igor" way, i.e. like this one: [1] - made for "Grider" with "Igor" plugin, make sure to add type=4 option while loading lirc_serial kernel module. The whole module loading command may then look like this:
modprobe lirc_serial irq=3 io=0x2f8 type=4
Alternatively you can emerge lirc with serial_igor_cesko module, then putting type=4 in modprobe call is unnecessary.
[edit] ATI All-in-Wonder and X10 Remote Controls (atiusb)
The ATI All-in-Wonder and the X10 remotes can be configured either as a kernel module or using LIRC. If you use the kernel module it will appear as an additional mouse and keyboard and will *not* work with LIRC.
[edit] Configuring as a kernel module
Add support in the kernel
Make sure your /usr/src/linux symlink points to your kernel source folder, and run make menuconfig in there.
| Linux Kernel Configuration: enabling Ati remote control |
Device Drivers ---> USB support ---> <M> ATI / X10 USB RF remote control |
Then save and exit. Do make modules and then make modules_install
Load the module : modprobe ati_remote
The next time you start X you should be able to control the pointer using the big directional pad and the buttons should all be mapped to keyboard inputs.
[edit] Configuring using LIRC
Add the following line to /etc/make.conf:
| File: /etc/make.conf |
LIRC_DEVICES="atiusb" |
Now emerge LIRC using emerge lirc.
Once LIRC has finished installing start the LIRC daemon and test that it works
# /etc/init.d/lircd start * Starting lircd ... [ ok ] # irw
Once you are happy that it works add lircd to the default startup.
[edit] ATI Remote Wonder II (lirc_atiusb)
| File: /etc/lircd.conf |
# # brand: ATI Remote Wonder II # aka: ATI Sapphire Remote Bob II USB # model no. of remote control: 5000024400 # begin remote name ATI-RemoteWonderII bits 16 eps 30 aeps 100 one 0 0 zero 0 0 pre_data_bits 8 pre_data 0x0 post_data_bits 16 post_data 0x0 gap 299851 toggle_bit 0 begin codes aux1 0x023F aux2 0x023F aux3 0x023F aux4 0x023F mouse_left_btn 0x02A9 mouse_right_btn 0x02AA a 0x0278 b 0x0279 power 0x020C dvd 0x0238 tv 0x0239 help 0x02BE pc 0x023F resize 0x02D5 hand 0x02D0 ati 0x028E vol_up 0x0210 vol_down 0x0211 mute 0x020D ch_up 0x0220 ch_down 0x0221 mouse_cursor_up 0x01FF mouse_cursor_down 0x02FF mouse_cursor_left 0x20FF mouse_cursor_right 0x10FF mouse_cursor_upleft 0x21FF mouse_cursor_upright 0x11FF mouse_cursor_downleft 0x22FF mouse_cursor_downright 0x12FF 1 0x0201 2 0x0202 3 0x0203 4 0x0204 5 0x0205 6 0x0206 7 0x0207 8 0x0208 9 0x0209 0 0x0200 list 0x0254 check 0x0282 info 0x02F9 timer 0x0296 arrow_up 0x0258 arrow_left 0x025A arrow_right 0x025B arrow_down 0x0259 ok 0x025C c 0x027A d 0x027B play 0x022C e 0x027C f 0x027D rewind 0x0229 rec 0x0237 stop 0x0231 pause 0x0230 ffwd 0x0228 end codes end remote |
[edit] USB-IR-Boy
Instead of compiling LIRC with a specific driver, you should edit this file as follows, after you have set up your USB IR Boy according to the information at http://usbirboy.sourceforge.net/docs.html:
| File: /etc/conf.d/lircd |
LIRCD_OPTS="-d /dev/usbirboy" |
[edit] Creative Sound Blaster Audigy 4 (with USB Receiver)
NOTE This describes how to get the IR working using Ecto's program (see below) to use with Xmms. If you can provided general information about how to make this IR work with standards linux programs like LIRC please append this section. If you know how to modify Ecto's program to make it work with other applications (Quod Libet, Mplayer...etc.) please post your documents and share your knowledge.
The method for the Sound Blaster Audigy 2 Platinum never worked for with my Audigy 4. The IR when plugged in will output ID 041e:3100 Creative Technology, Ltd Philips Electronics - RCS Singapore Creative USB IR Receiver when typing dmesg in a console.
NOTE These instructions are old. Try using the Audigy 2 Platinum method using this remote config file, changing "livedrive_midi" to "alsa_usb" in the LIRC_DRIVERS= option and then report back here and let us know if it worked :).
|
Someone called Ecto has posted a nifty little piece of code here to enable the use of the IR with XMMS. Check the link and follow the instructions in the README file.
However, the code relies on XMMS and Xmms-Perl which have both been moved out of portage... :) So if you already uninstalled XMMS you'll need to reinstall again XMMS and the Perl and Remote plugins.
With some small changes, Ecto's perl and C++ listener can be used to control either XMMS or Audacious without much effort. Here's my hacked-up version of Ecto's perl script. Note that it does NOT depend on any perl packages out of normal distribution. Note we're controlling the volume with aumix and Audacious with audtool.
#!/usr/bin/perl
# $Id: event_dispatcher.pl,v 1.3 2006-12-27 07:35:00 svh Exp $
# Licensed under GPLv2
use strict;
use warnings;
$| = 1;
my %event_map = (
"power" => sub {`audtool --playback-play`},
"mute" => sub {`aumix -v0`} ,
"vol-" => sub { `aumix -v-1` },
"vol+" => sub { `aumix -v+1` },
"stop-eject" => sub { `audtool --playback-stop` },
"play-pause" => sub { `audtool --playback-playpause` },
"prev" => sub { `audtool --playlist-reverse` },
"next" => sub { `audtool --playlist-advance` }
);
open EVENT, './hid_read2|';
while ( <EVENT> ) {
print and next unless /^ \+ got key\(..\): (.*)$/;
print "key[$1]: ";
print "no event for this key\n" and next unless defined $event_map{$1};
&{$event_map{$1}};
print "event dispatched\n"
}
close EVENT;
[edit] First method: the gentoo way
Here is an Xmms ebuild I copied from somewhere on the web. Create the directory /usr/portage/media-sound/xmms, copy the ebuild (give it the same as described here otherwise it won't work)
| File: /usr/portage/media-sound/xmms/xmms-1.2.10.r16.ebuild |
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/www/viewcvs.gentoo.org/raw_cvs/gentoo-x86/media-sound/xmms/Attic/xmms-1.2.10-r16.ebuild,v 1.5 2006/11/20 20:05:33 flameeyes dead $
inherit flag-o-matic eutils libtool
PATCH_VER="2.3.1"
M4_VER="1.1"
PATCHDIR="${WORKDIR}/patches"
DESCRIPTION="X MultiMedia System"
HOMEPAGE="http://www.xmms.org/"
SRC_URI="http://www.xmms.org/files/1.2.x/${P}.tar.bz2
mirror://gentoo/gentoo_ice-xmms-0.2.tar.bz2
http://dev.gentoo.org/~metalgod/xmms/${P}-gentoo-m4-${M4_VER}.tar.bz2
http://dev.gentoo.org/~metalgod/xmms/${P}-gentoo-patches-${PATCH_VER}.tar.bz2
http://dev.gentoo.org/~metalgod/xmms/gnomexmms.xpm"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sh ~sparc ~x86"
IUSE="nls esd mmx vorbis 3dnow mikmod directfb alsa oss arts jack sndfile lirc flac mad mp3"
DEPEND="=x11-libs/gtk+-1.2*"
RDEPEND="${DEPEND}
directfb? ( dev-libs/DirectFB )
app-arch/unzip"
#We want these things in DEPEND only
DEPEND="${DEPEND}
>=sys-devel/automake-1.9
>=sys-devel/autoconf-2.5
sys-devel/libtool
nls? ( dev-util/intltool
dev-lang/perl
sys-devel/gettext )
!nls? ( !<sys-devel/gettext-0.14.1 )"
# USE flags pull in xmms plugins
PDEPEND="lirc? ( media-plugins/xmms-lirc )
flac? ( media-libs/flac )
mikmod? ( media-plugins/xmms-mikmod )
mp3? ( mad? ( >=media-plugins/xmms-mad-0.7 )
>=media-plugins/xmms-mpg123-1.2.10-r1 )
vorbis? ( >=media-plugins/xmms-vorbis-1.2.10-r1 )
sndfile? ( media-plugins/xmms-sndfile )
alsa? ( media-plugins/xmms-alsa )
arts? ( media-plugins/xmms-arts )
jack? ( media-plugins/xmms-jack )
esd? ( media-plugins/xmms-esd )
oss? ( media-plugins/xmms-oss )"
src_unpack() {
unpack ${A}
cd ${S}
EPATCH_SOURCE="${WORKDIR}/patches" EPATCH_SUFFIX="patch" \
EPATCH_FORCE="yes" epatch
export WANT_AUTOMAKE=1.9
export WANT_AUTOCONF=2.5
sed -i 's:Output Input Effect General Visualization::' Makefile.am
for dir in . libxmms; do
cd ${S}/${dir}
rm acinclude.m4
libtoolize --force --copy || die "libtoolize --force --copy failed"
[ ! -f ltmain.sh ] && ln -s ../ltmain.sh
aclocal -I ${WORKDIR}/m4 || die "aclocal failed"
autoheader || die "autoheader failed"
automake --gnu --add-missing --include-deps --force-missing --copy || die "automake failed"
autoconf || die "autoconf failed"
done
if use nls; then
cd ${S}/po
cp ${FILESDIR}/po-update.pl update.pl
perl update.pl --pot
fi
}
src_compile() {
export EGREP="grep -E"
filter-flags -fforce-addr -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
local myconf=""
if use !amd64 && { use 3dnow || use mmx; }; then
myconf="${myconf} --enable-simd"
else
myconf="${myconf} --disable-simd"
fi
# Please see Bug 58092 for details
use ppc64 && replace-flags "-O[2-9]" "-O1"
econf `use_enable nls` ${myconf} || die
# For some reason, gmake doesn't export this for libtool's consumption
emake -j1 || die
}
src_install() {
export EGREP="grep -E"
make DESTDIR="${D}" install || die
dodoc AUTHORS ChangeLog FAQ NEWS README TODO
newdoc ${PATCHDIR}/README README.patches
newdoc ${PATCHDIR}/ChangeLog ChangeLog.patches
keepdir /usr/share/xmms/Skins
insinto /usr/share/pixmaps/
newins ${DISTDIR}/gnomexmms.xpm xmms.xpm
doins xmms/xmms_logo.xpm
insinto /usr/share/pixmaps/mini
doins xmms/xmms_mini.xpm
insinto /etc/X11/wmconfig
newins xmms/xmms.wmconfig xmms
insinto /usr/share/applications
doins ${FILESDIR}/xmms.desktop
# Add the sexy Gentoo Ice skin
insinto /usr/share/xmms/Skins/gentoo_ice
doins ${WORKDIR}/gentoo_ice/*
docinto gentoo_ice
dodoc ${WORKDIR}/README
insinto /usr/include/xmms/libxmms
doins ${S}/libxmms/*.h
insinto /usr/include/xmms
doins ${S}/xmms/i18n.h
}
pkg_postinst() {
einfo "media-sound/xmms now just provides the xmms binary and libxmms."
einfo "All plugins that were packaged with xmms are now provided by other"
einfo "packages in media-plugins. Some of these are automatically pulled in"
einfo "based on USE flags. Others you will need to emerge manually. The"
einfo "following is a list of packages which were previously provided by"
einfo "media-sound/xmms that are not automatically emerged:"
einfo "media-plugins/xmms-blur-scope"
einfo "media-plugins/xmms-cdaudio"
einfo "media-plugins/xmms-disk-writer"
einfo "media-plugins/xmms-echo"
einfo "media-plugins/xmms-ir"
einfo "media-plugins/xmms-joystick"
einfo "media-plugins/xmms-opengl-spectrum"
einfo "media-plugins/xmms-sanalyzer"
einfo "media-plugins/xmms-song-change"
einfo "media-plugins/xmms-stereo"
einfo "media-plugins/xmms-tonegen"
einfo "media-plugins/xmms-voice"
einfo "media-plugins/xmms-wav"
}
|
Then do:
|
Now if like me you cannot get Xmms-Perl to compile by invoking:
|
Get the Xmms-Perl ebuild below and repeat the procedure above and change accordingly the path as follows: /usr/portage/dev-perl/Xmms-Perl. The ebuild should be saved in this directory under the name Xmms-Perl-0.12.ebuild.
| File: /usr/portage/dev-perl/Xmms-Perl/Xmms-Perl-0.12.ebuild |
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/www/viewcvs.gentoo.org/raw_cvs/gentoo-x86/dev-perl/Xmms-Perl/Attic/Xmms-Perl-0.12.ebuild,v 1.15 2006/11/20 19:44:59 flameeyes dead $
inherit perl-module eutils
DESCRIPTION="A Perl extension interface to XMMS"
HOMEPAGE="http://www.cpan.org/modules/by-module/Xmms/${P}.readme"
SRC_URI="mirror://cpan/authors/id/D/DO/DOUGM/${P}.tar.gz"
LICENSE="Artistic"
SLOT="0"
KEYWORDS="alpha amd64 ia64 ppc sparc x86"
IUSE=""
DEPEND="media-sound/xmms
dev-perl/MP3-Info
dev-perl/Term-ReadLine-Perl
dev-lang/perl"
RDEPEND="${DEPEND}"
src_unpack() {
unpack ${P}.tar.gz
}
|
NOTE: I had to delete a few lines at the end of the ebuild because it would not compile. Take the original one if this does not work for you.
Then do:
|
[edit] Second method: build from source
Get the tar from The XMMS Site. Then do:
|
|
|
|
|
To install the Xmms-Perl package. Refer to this page.
Now cd to Ecto's program directory and execute
|
Pressing on the keys should give you an output, if XMMS is running it should actually respond to the keys accrodingly. NOTE: I could not get this to work myself.
[edit] Creative Labs Sound Blaster Audigy 2 Platinum
(Primary author: rcbarnes. Having just registered, this section was authored as anon. Contact me for issues regarding this section. Remove notice when appropriate) Users: If you find errors or omissions in this section I'd like to know about them. Drop me a line if you are confused about any of this. clay dot barnes at gmail.
If you're not using udev (shame on you!), or changed your device name config, the path /dev/dmmidi (naturally) will not work for you. You should replace it with the path to the midi device that spits out garbage when you cat /dev/devname and press buttons on your remote (for me, although I do use UDEV and have not changed anything, it is /dev/snd/midiC0D1). Also note that with the EX model, you won't get any output until you initalize it with a command string. Since you have to know the path to send the string, you must either guess and check with all the midi devices, or send the initalization string to all the midi devices (rarely more than two or three).
First let's activate the IR port on the card. We need to pass the enable_ir=1 option to the alsa module. Add the following to the end of /etc/modules.d/alsa
| File: /etc/modules.d/alsa |
[...] options snd-emu10k1 enable_ir=1 |
Now you need to propagate your changes into /etc/modules.conf, so (as root) run modules-update.
Reload your alsa modules (as root) with modprobe -rv snd_emu10k1 modprobe -v snd_emu10k1 to activate the changes
If you have the EX model, you have to enable the port by sending it the activation string (assuming default udev naming conventions): echo -e '\360\000\040\041\141\000\000\000\177\000\367' > /dev/dmmidi If that does not work try outputting the data to /dev/snd/midiC0D1 also the above line on some setups doesnt work and if it doesnt for you try echo -en "\xf0\x00\x20\x21\x61\x00\x00\x00\x7f\x00\xf7" > /dev/snd/midiC0D1
Rather than run that every time you start your computer, just add the following line after your last changes in /etc/modules.d/alsa.
| File: /etc/modules.d/alsa |
[...] options snd-emu10k1 enable_ir=1 post-install snd-emu10k1 echo -e '\360\000\040\041\141\000\000\000\177\000\367' > /dev/dmmidi |
because of the latest udev which will load modules while its loading rather then when alsa loads it, it will create a file instead of putting the data to the device, so you may want to put that line in /etc/conf.d/local.start.
Let's make sure you are actually getting your signals. cat /dev/dmmidi, and see if you get garbage when you press the buttons on your remote.
Lirc in portage is over a year old unless you unmask ~x86 for it:
| File: /etc/portage/package.keywords |
app-misc/lirc ~x86 |
Now add the following to your /etc/make.conf:
| File: /etc/make.conf |
LIRC_DEVICES="livedrive_midi" |
As root run emerge lirc
Once that is done, drop these mappings into /etc/lircd.conf if you're using the RM-1000W remote (the latest version is available here):
| File: /etc/lirc.conf |
#
# contributed by Andrew de Quincey
#
# brand: rm1000w
# model no. of remote control:
# devices being controlled by this remote:
#
begin remote
name rm1000w
flags SPACE_ENC|CONST_LENGTH
bits 16
eps 30
aeps 100
header 9000 4500
one 563 1687
zero 563 562
pre_data_bits 16
pre_data 0x8322
gap 108000
toggle_bit 0
repeat 9000 2250
frequency 38000
duty_cycle 33
begin codes
1 0x0000000000008B74
2 0x0000000000008F70
3 0x000000000000906F
4 0x0000000000008A75
5 0x000000000000847B
6 0x0000000000007887
7 0x0000000000008976
8 0x000000000000837C
9 0x0000000000007788
0 0x000000000000807F
stop 0x000000000000857A
play 0x0000000000007986
pause 0x0000000000007986
slow 0x0000000000007D82
step 0x0000000000007E81
prev 0x0000000000007F80
next 0x0000000000007A85
mute 0x0000000000006E91
vol- 0x000000000000639C
vol+ 0x000000000000629D
eax 0x0000000000008C73
options 0x000000000000827D
display 0x0000000000007689
return 0x0000000000008E71
start 0x0000000000008877
close 0x0000000000007C83
up 0x0000000000007B84
down 0x0000000000008D72
left 0x0000000000008778
right 0x000000000000758A
ok 0x000000000000817E
power 0x000000000000619e
cmss 0x000000000000718e
record 0x000000000000738c
end codes
end remote
|
Now it's time to see if you've got everything right up to here. Run this command lircd -H livedrive_midi -d /dev/dmmidi -n as root. Press some buttons, and see if they show up on the console.
Now, all you have to do is edit /etc/conf.d/lircd to contain your device. The example here has the udev name
| File: /etc/conf.d/lircd |
# Options to pass to the lircd process LIRCD_OPTS="-d /dev/dmmidi" |
Now let's test the device by creating a dummy client:
| File: ~/.lircrc |
begin button = right prog = foo config = something end |
Now restart /etc/init.d/lircd with sudo /etc/init.d/lircd restart.
And the moment of truth: ircat foo and press the right button (the [>>] button in the circle at the bottom of the remote). You should get 'something' echoed on the screen. Congratulations, you have lirc working!
Tne next step is to get some real clients and actions going. Let's turn on the daemons for every boot. As root, rc-update add lircd default, and also rc-update add lircmd default if you want to use the remote as a mouse. You also want irexec and irxevent to run, too. Just stick them (doen't forget the -d flag for irexec, and a trailing & for irxevent) in some script that starts automatically, like .xinitrc.
[edit] Pinnacle PCTV remote
If the lirc_serial driver will not work you can always try to use the 8250 kernel serial driver. This can be compiled as a module and added to /etc/modules.autoload.d/kernel-2.x. In this way the module will be loaded during the boot
| File: /etc/modules.autoload.d/kernel-2.x |
# /etc/modules.autoload.d/kernel-2.6: kernel modules to load when system boots. # $Header: /home/cvsroot/gentoo-src/rc-scripts/etc/modules.autoload.d/kernel-2.6,v 1.1 2003/07/16 18:13:45 azarah Exp $ # # Note that this file is for 2.6 kernels. # # Add the names of modules that you'd like to load when the system # starts into this file, one per line. Comments begin with # and # are ignored. Read man modules.autoload for additional details. # For example: # 3c59x dvb-bt8xx #lirc_serial 8250 |
Then you have to say the lirc deamon to use the serial device instead of the /dev/lircd device.
| File: /etc/conf.d/lircd |
LIRCD_OPTS="-d /dev/ttyS0" |
[edit] DVICO FusionHDTV DVB-T Plus IR Remote
It's surprisingly easy to setup this remote control. First and foremost, you must be using lirc 0.7.2 which has full support for the remote. As I write this (30/11/05), it's currently in portage masked as testing. If you're already using lirc 0.7.2, you can safely skip the following step.
Step 1: Simply add the following line to your /etc/portage/package.keywords.
| File: /etc/portage/package.keywords |
app-misc/lirc ~x86 |
Step 2: Chris Pascoe, the guy who developed the DVICO driver states that we need to enable support for hiddev in the kernel. Edit your kernel config to reflect this change.
| Linux Kernel Configuration: enabling HIDDEV support |
Device Drivers ---> USB support ---> <*> /dev/hiddev raw HID device support |
Compile and install the kernel.
Step 3: Before emerging lirc, it's important to specify which driver you want to use. Fortunately for us, it's dvico. Ammend /etc/make.conf with the following line.
| File: /etc/make.conf |
LIRC_OPTS="--with-driver=dvico" |
Now emerge lirc. # emerge lirc
(note: the LIRC ebuild provided does not work with the 2.6.14 kernel, and perhaps others. Save yourself a few days' headaches by checking out this bug report)
Step 4: Test the remote control by executing the following command.
- /usr/sbin/lircd --driver=dvico --device=/dev/usb/hiddev0
Chris Pascoe also mentions that if this is not the only USB device on your system you will need to substitute the appropriate device number for your system. (The device number can be discovered by running "dmesg | grep hiddev" after you attach the device. Due to a bug in the Linux kernel, if it says "hiddev96" then the device to use is actually /dev/usb/hiddev0, "hiddev97" is /dev/usb/hiddev1, etc).
In 2.6.13, I experienced this problem, however it seems to be fixed in 2.6.14.
You should now be able to execute irw from a terminal.
Point your remote at the reciever and press the buttons, you should see some funky output displayed.
Step 5: Now it's time to fix the init.d script to properly load our driver everytime we boot the machine. Simply make the following changes to /etc/init.d/lircd.
| File: /etc/init.d/lircd |
start() {
ebegin "Starting lircd"
start-stop-daemon --start --quiet --exec /usr/sbin/lircd -- --driver=dvico --device=/dev/usb/hiddev0
eend $?
}
|
Note: Instead of editing the init file itself, the lircd options could be placed into the config file for the init scrip: /etc/conf.d/lircd Now try starting the service.
| File: /etc/conf.d/lircd |
# Options to pass to the lircd process
LIRCD_OPTS="--driver=dvico --device=/dev/usb/hiddev0"
|
# /etc/init.d/lircd start Again, try irw. Everything should be functional.
Don't forget to add lircd to startup. # rc-update add lircd default
That's it, you should be good to go! Enjoy :)
[edit] Enabling software support
Start by adding the "lirc" USE flag to make.conf.
| File: /etc/make.conf |
USE="lirc" |
You can then re-emerge your installed packages with remote control support. This will work with:
- mplayer
- mythtv
- xine-ui
- totem
- rhythmbox
- audacious
and others.
A complete list of software affected by this USE flag can be found on gentoo-portage.com
[edit] Using LIRC with mplayer
First all we need mplayer with lirc support:
USE="lirc" emerge mplayer
For a list of all commands that can be used with LIRC and mplayer, run mplayer -input cmdlist, you will get a list that contains commands and appropriate value format descriptors:
| Code: MPlayer input commands (incomplete) |
seek Float [Integer] audio_delay Float speed_incr Float speed_mult Float speed_set Float quit [Integer] pause [...] |
This commands listed here can be used in the config = <command> lines!
We need to configure ~/.lircrc, here an example:
| File: ~/.lircrc |
begin
button = Up
prog = mplayer
config = volume 1
repeat = 1
end
begin
button = Down
prog = mplayer
config = volume -1
repeat = 1
end
begin
button = Circle
prog = mplayer
config = pause
end
begin
button = Cross
prog = mplayer
config = quit 0
end
begin
button = Right
prog = mplayer
config = pt_step 1
repeat = 0
end
begin
button = Left
prog = mplayer
config = pt_step -1
repeat = 0
end
begin
button = Square
prog = mplayer
config = mute
end
|
[edit] Using LIRC with mythtv
If your remote responds on screen with irw but not inside MythTV, you may not have finished the entire setup. First of all, if you're using irexec, I wanted to say that irexec only translates your button signals into a command. This means that you may very easily use irexec to start MythTV with a single button, because starting MythTV is as easy as typing mythfrontend in a terminal. But programming your entire MythTV controls with irexec is a bit of a challenge. Perhaps, it may be as difficult as having to assign each remote keys to a macro of keyboard commands while considering the window session focus. I'd say this method is not impossible, but a challenge. I haven't tried, of course.
The following method is one that I find to be easier, but not yet well documented (neither is the one mentioned above, really):
As stated above, if you haven't done so already, you'll need to re-compile MythTV with:
USE="lirc" emerge mythtv
Believe it or not, you're still not quite finished yet. Now, you need to tell the mythtv-lirc-module (not lirc itself) about your remote control button configuration. This means population of the MythTV LIRC config in $USERNAME/.mythtv/lircrc, where $USERNAME is the user running the mythfrontend interface.
| File: ~/.mythtv/lircrc |
## repeat = X means repeath every Xth time signal received
## default is 0 => don't repeat
## mythtv config for SBLive/Audigy Platinum Remote RM-900 / RM-1000W
## other remotes may be somehwat similar
## if you have a TV remote rather than a DVD remote you'll probably want
## to change up/down to something like ch+ ch- -- use irw too see what your
## remote calls them
#this bunch are pretty self-explanatory
begin
remote = *
button = up
prog = mythtv
config = Up
repeat = 1
end
begin
remote = *
button = down
prog = mythtv
config = Down
repeat = 1
end
begin
remote = *
button = left
prog = mythtv
config = Left
end
begin
remote = *
button = right
prog = mythtv
config = Right
end
#stop in mythmusic OR show osd
begin
remote = *
button = stop
prog = mythtv
config = O
end
begin
remote = *
button = play
prog = mythtv
config = P
end
begin
remote = *
button = prev
prog = mythtv
config = Home
end
begin
remote = *
button = next
prog = mythtv
config = End
end
begin
remote = *
button = vol-
prog = mythtv
config = [
repeat = 1
end
begin
remote = *
button = vol+
prog = mythtv
config = ]
repeat = 1
end
begin
remote = *
button = ok
prog = mythtv
config = Enter
end
begin
remote = *
button = mute
prog = mythtv
config = |
end
begin
remote = *
button = 1
prog = mythtv
config = 1
end
begin
remote = *
button = 2
prog = mythtv
config = 2
end
begin
remote = *
button = 3
prog = mythtv
config = 3
end
begin
remote = *
button = 4
prog = mythtv
config = 4
end
begin
remote = *
button = 5
prog = mythtv
config = 5
end
begin
remote = *
button = 6
prog = mythtv
config = 6
end
begin
remote = *
button = 7
prog = mythtv
config = 7
end
begin
remote = *
button = 8
prog = mythtv
config = 8
end
begin
remote = *
button = 9
prog = mythtv
config = 9
end
begin
remote = *
button = 0
prog = mythtv
config = 0
end
#Show menu
begin
remote = *
button = options
prog = mythtv
config = M
end
#Jump to bookmarked position
begin
remote = *
button = return
prog = mythtv
config = K
end
#Cycle through aspect ratios
begin
remote = *
button = display
prog = mythtv
config = W
end
#close/cancel/escape
begin
remote = *
button = close
prog = mythtv
config = Esc
repeat = 3
end
#show teletext / captions
begin
remote = *
button = cmss
prog = mythtv
config = T
end
#Show information (OK button is Enter)
begin
remote = *
button = start
prog = mythtv
config = I
end
#adjust time stretch
begin
remote = *
button = slow
prog = mythtv
config = A
end
#increase play speed
begin
remote = *
button = step
prog = mythtv
config = U
end
#cycle through audio streams
begin
remote = *
button = eax
prog = mythtv
config = +
end
begin
remote = *
button = power
prog = mythtv
config = Esc
end
begin
remote = *
button = record
prog = mythtv
config = R
end
#doesn't usually trigger on my remote
begin
remote = *
button = pause
prog = mythtv
config = P
end
|
After you've placed this code into the mentioned file (with enough of specific), try restarting mythfrontend. You may have to enter the LiveTV mode to test if the number buttons actually work. Try channel 2 with the (button 0) (button 2). Try channel 21 with (button 2) (button 1). If it does, then go along and set up the other numbers as well as the MythTV functions. (These can be looked up in the MythTV documentation) Well, I wish you luck. It took me too long to find this out.
[edit] Using LIRC with VLC media player
First we have to emerge vlc with lirc support.
USE="lirc" emerge vlc
Then we need to edit ~/.lircrc. Following is an example for a potential configuration.
| File: ~/.lircrc |
begin prog = vlc button = Pause config = key-play end begin prog = vlc button = Stop config = key-pause end # Use this target if you have a combined play/pause button begin prog = vlc button = Ok config = key-play-pause repeat = 0 end begin prog = vlc button = 8 config = key-stop end begin prog = vlc button = Quit config = key-quit end begin prog = vlc button = Channel+ config = key-next repeat = 0 end begin prog = vlc button = Channel- config = key-prev repeat = 0 end begin prog = vlc button = Up config = key-fullscreen end begin prog = vlc button = Red config = key-slower end begin prog = vlc button = Green config = key-faster end begin prog = vlc button = Left config = key-jump-short repeat = 1 end begin prog = vlc button = Right config = key-jump+short repeat = 1 end begin prog = vlc button = Chan-Stop config = key-jump-1min end begin prog = vlc button = Chan+Play config = key-jump+1min end #Audio controls begin prog = vlc button = Vol- config = key-vol-down repeat = 1 end begin prog = vlc button = Vol+ config = key-vol-up repeat = 1 end begin prog = vlc button = SOMEBUTTON config = key-audio-track end begin prog = vlc button = Mute config = key-vol-mute end |
As a last step we have to make sure that the file ~/.vlc/vlcrc contains a line like
| File: ~/.vlc/vlcrc |
|
control=lirc |
Alternatively the program can be started with the option --control lirc in the command line.
[edit] Using LIRC with totem
First we have to emerge totem with lirc support.
USE="lirc" emerge totem
Then we need to edit ~/.lircrc. Following is an example for a potential reduced configuration.
| File: ~/.lircrc |
begin
prog = Totem
remote = *
button = play
config = play
end
begin
prog = Totem
remote = *
button = pause
config = pause
end
|
The full list of available commands can be found in the file totem-remote.c in the totem source tree.
Here's the interesting contents for totem version 2.16.4
| File: totem-remote.c |
/* strings that we recognize as commands from lirc */ #define TOTEM_IR_COMMAND_PLAY "play" #define TOTEM_IR_COMMAND_PAUSE "pause" #define TOTEM_IR_COMMAND_NEXT "next" #define TOTEM_IR_COMMAND_PREVIOUS "previous" #define TOTEM_IR_COMMAND_SEEK_FORWARD "seek_forward" #define TOTEM_IR_COMMAND_SEEK_BACKWARD "seek_backward" #define TOTEM_IR_COMMAND_VOLUME_UP "volume_up" #define TOTEM_IR_COMMAND_VOLUME_DOWN "volume_down" #define TOTEM_IR_COMMAND_FULLSCREEN "fullscreen" #define TOTEM_IR_COMMAND_QUIT "quit" #define TOTEM_IR_COMMAND_UP "up" #define TOTEM_IR_COMMAND_DOWN "down" #define TOTEM_IR_COMMAND_LEFT "left" #define TOTEM_IR_COMMAND_RIGHT "right" #define TOTEM_IR_COMMAND_SELECT "select" #define TOTEM_IR_COMMAND_MENU "menu" #define TOTEM_IR_COMMAND_PLAYPAUSE "play_pause" #define TOTEM_IR_COMMAND_ZOOM_UP "zoom_up" #define TOTEM_IR_COMMAND_ZOOM_DOWN "zoom_down" #define TOTEM_IR_COMMAND_SHOW_PLAYING "show_playing" #define TOTEM_IR_COMMAND_EJECT "eject" #define TOTEM_IR_COMMAND_PLAY_DVD "play_dvd" #define TOTEM_IR_COMMAND_MUTE "mute" |
[edit] Using LIRC with rhythmbox
The idea is the same as for totem and vlc. First we have to emerge rhythmbox with lirc support.
USE="lirc" emerge rhythmbox
Then we need to edit ~/.lircrc. Following is an example for a potential reduced configuration.
| File: ~/.lircrc |
begin
prog = Rhythmbox
remote = *
button = play
config = play
end
begin
prog = Rhythmbox
remote = *
button = pause
config = pause
end
|
The full list of available commands can be found in the file rb-lirc-plugin.c in the rhythmbox source tree.
Here's the interesting contents for rhythmbox version 0.9.7
| File: rb-lirc-plugin.c |
#define RB_IR_COMMAND_PLAY "play" #define RB_IR_COMMAND_PAUSE "pause" #define RB_IR_COMMAND_PLAYPAUSE "playpause" #define RB_IR_COMMAND_STOP "stop" #define RB_IR_COMMAND_SHUFFLE "shuffle" #define RB_IR_COMMAND_REPEAT "repeat" #define RB_IR_COMMAND_NEXT "next" #define RB_IR_COMMAND_PREVIOUS "previous" #define RB_IR_COMMAND_SEEK_FORWARD "seek_forward" #define RB_IR_COMMAND_SEEK_BACKWARD "seek_backward" #define RB_IR_COMMAND_VOLUME_UP "volume_up" #define RB_IR_COMMAND_VOLUME_DOWN "volume_down" #define RB_IR_COMMAND_MUTE "mute" |
[edit] Using LIRC with audacious
We need audacious-plugins with lirc support, first:
USE="lirc" emerge audacious-plugins
Then you have to enable the lirc plugin in the audacious plugins configuration dialog.
Write your ~/.lircrc in order to map the audacious lirc commands.
| File: ~/.lircrc |
begin
button = PLAY
prog = audacious
config = PLAY
repeat = 0
end
begin
button = VOL+
prog = audacious
config = VOL_UP
repeat = 1
end
(...)
|
The following command list has been taken from lirc.c file from audacious-plugins source code.
| Code: Audacious input commands (complete) |
PLAY STOP PAUSE PLAYPAUSE NEXT PREV SHUFFLE REPEAT FWD BWD VOL_UP VOL_DOWN QUIT MUTE BAL_LEFT BAL_RIGHT BAL_CENTER LIST PLAYLIST_CLEAR PLAYLIST_ADD |
[edit] Using LIRC in KDE
If you are using KDE, then it's not necessary to manually create a ~/.lircrc file. Usually located in Utilities->Peripherals, KDE LIRC Server (IRKick) can help alot in configuring the actions for your remote.
IRKick allows you to easily define and use multiple modes for a single keyboard. In other words, you can use the same set of buttons for multiple programs, while still keeping some global assignments.
For example, you can create three modes: Amarok, Mplayer and Radio. In each of these modes, you can assign a specific action to the "play" button, to wether play Amarok, Mplayer or Radio. To switch between these mappings, you can set keys like "1" "2" and "3" to the default mode. This can be done by selecting the default mode, clicking Add... -> "I wish to change remote control's mode" then select "1" from the list and on the next page, select the desired mapping.
Another usefull feature is that it allows you to "manually select a function from a running program" which means it detects DCOP calls that can be used on running programs. Most of the KDE applications allow this kind of control, although it is not always fully functional, KMplayer for example doesn't provide "play" or "stop" just "maximize" and "quit".
Another nice global action would be to get your computer to say what time it is aloud. For that, just
emerge festival
then in IRKick select the default mode, click "Add..." for an action, then pick "KDE Program Launcher" from the list (which has the same function like irexec), select your desired button, on the next page select Execute, then select "The executable name and path of the executable or script to run" and in the input box at the bottom of the window, type saytime. (You may want to type that in a console shell too, just to check if it works).
[edit] Tips
For multiple remotes you can always concattenate them to one big lircd.conf file. cat remote1_definition.conf remote2_defintion.conf > /etc/lircd.conf
To have LIRC start at boot, at it to the default run-level: rc-update add lircd default
lircrc configurations for programs including MythTV, Xine, Mplayer, VLC and more can be configured for any remote control and any hardware online at http://lircconfig.commandir.com.
[edit] Troubleshooting
[edit] Module doesn't load
If the kernel modules does not load, there could be a few reasons. If the serial driver in the kernel is being loaded before the LIRC driver, LIRC will fail and complain that the port is already in use.
| Code: dmesg output |
lirc_dev: IR Remote Control driver registered, at major 61 lirc_serial: port 03f8 already in use lirc_serial: use 'setserial /dev/ttySX uart none' lirc_serial: or compile the serial port driver as module and lirc_serial: make sure this module is loaded first |
If this happens you have a couple of options.
[edit] Prevent the kernel module from configuring the port
The ideal solution is to run echo "/dev/ttySX uart none" >> /etc/serial.conf. This will append the statement "/dev/ttySX uart none" into /etc/serial.conf. After that you have to enable serial init-script via rc-update add serial default. /etc/init.d/serial will disable the uart for the specified ttySX. Now modprobe lirc_serial should work fine during bootup!
[edit] Use setserial to de-configure the port
You can follow the instructions and run the setserial /dev/ttySX uart none command, making sure you have already run emerge setserial. You may need to set this up to run at boot so that it can always take effect.
[edit] Use modules configuration to load the lirc module first
If the above does not not as it didn't for me, you could configure the module loading by the following: - Modify /etc/modules.d/lirc and uncomment the lines that match your serial port, this will enable the lirc_serial module to be loaded before the kernel modules if built or disable the serial port. No init-script for serial is then required.
[edit] Load serial support as a kernel module
Still another option is to compile serial support for your kernel as a module, and the Gentoo boot scripts will take care of things for you during boot, but not necessarilly once the system is already up and running. The following may be useful if the /etc/serial.conf update for preventing the kernel from configuring the port doesn't solve the problem.
Tell the serial module that the lirc_driver module (replace lirc_driver with your particular driver, e.g. lirc_sir) is a dependency so that the lirc_driver module captures the I/O port first. Once the lirc_driver is loaded and attached to the port, the regular serial driver takes whatever is left over.
For example, my serial ports use the 8250 module, so the following works: echo "add below 8250 lirc_sir >> /etc/modules.d/lirc; modules-update. Now when I modprobe 8250, the lirc_sir module and all dependencies are loaded first, then everything necessary for the remaining serial ports to function.
[edit] Disable serial support in the kernel
Another other option is to disable serial port support in the kernel altogether, as the LIRC driver will take care of things for you. Obviously this will be an impractical solution if you have any other serial devices, but if you don't have any, this will also work.
[edit] Device /dev/lirc/0 isn't being created
If lirc seems to compile, and modprobeing the lirc_<driver> works without errors but you aren't seeing a /dev/lirc/0 being created it is likely because udev is unable to complete the creation of the device. If running:
udevtest /classes/lirc/lirc0
returns an error about udev being unable to read/write from the db becuase there is no such file or directory, re-emerging udev may fix the problem:
emerge --sync
emerge udev
After the emerge, udev should re-start and /dev/lirc/0 should now show up.
[edit] LIRC won't compile
The following flags may become important if LIRC does not work straight as described in the basic configuration.
- --with-port=port (port number for the lirc device.)
- --with-irq=irq (irq line for the lirc device.)
- --with-timer=value (timer value for the parallel driver)
- --with-tty=file (tty to use (Irman, RemoteMaster, etc.))
- --without-soft-carrier (if your serial hw generates carrier)
- --with-transmitter (if you use a transmitter diode)
If any of these options apply to you, you will have to add them with the appropriate values to your LIRC_OPTS variable in /etc/make.conf
[edit] Emerge gives you access violations
There is a bug in gcc that causes problems with sandbox. if the emerge returns you an error of access violation for /usr/src/linuex-..../null.gcda Try emerging with the following command: FEATURES="-sandbox" emerge lirc
