Building the lirc_serial driver
First, make sure you install the kernel sources that match the kernel
you are running. This is important,
you must match the kernel you
are running, if you have updates, or let emerge, or mandakeupdate,
or whatever, go out onto the net and get the "latest" kernel source,
and that source is not the source for your kernel, you are going to fail.
Go find and unpack the lirc-0.7.0pre8
sources, later versions will probably work fine, but I used this for
my build. Once you unpack the tarball, go into the new directory,
"cd /usr/src/lirc-0.7.0pre8/" and run the setup "./setup". In setup,
choose option 1, "Driver configuration", on the next screen choose
"Home brew (16x50 UART compatible serial port)". On the next screen,
choose the serial port that we will be using for the electronics to be
connected to, I chose "COM2" which is /dev/ttyS1. It will ask you for
an option choice, I chose "software generated carrier" as there is no
transmit diode in my MythTV setup (meaningless).
Once these choices have been made, setup will return to the main
screen. Choose item 3, "Save configuration and run configure". When
you are returned to the console, configure will run and discover where
stuff is that it needs (recall the kernel source warning?). After
configure successfully finishes, run make "make". This will build
your lirc_serial driver, then run "make install" to have the driver
put into it's proper place within /lib/modules so it can be found
by modprobe.
TopInstalling lirc_serial without a new kernel
You can use the lirc_serial driver without building a new kernel,
however, your keyboard will not be available until the machine has
nearly finished booting. You would edit /etc/rc.local and add
"setserial /dev/ttyS1 uart none" to release the serial port,
then next add "modprobe lirc_serial" as the next line. The last few
lines of /etc/rc.local should look something like this:
cat /etc/security/msec/issue.net.$SECURE_LEVEL > /etc/issue.net
elif [ -f /etc/security/msec/issue.net ]; then
cat /etc/security/msec/issue.net > /etc/issue.net
else
rm -f /etc/issue.net
fi
fi
touch /var/lock/subsys/local
# activate the WebPal IR keyboard stuff
setserial /dev/ttyS1 uart none
modprobe lirc_serial
modprobe uinput
/usr/sbin/lircd -d /dev/lirc0
/usr/sbin/lirc_keybd
Test the driver installation with "setserial /dev/ttyS1 uart none"
and "modprobe lirc_serial", it should quietly run and a /dev/lirc0
should now appear in the /dev directory. If it does not, then check
the /var/log/messages and file under /var/log/kernel to see what kind
of error you had. Note that the lircd and lirc_keybd daemons are also
being activated as well?
TopInstalling lirc_serial earlier in the boot process
Later, when stuff is tested and working, you will want to have the
module loaded at boot time. Follow the procedure for this with your
distro of linux. You will have to compile your own kernel and make
the 8250 driver a loadable module. Otherwise, the serial port kernel
module will grab all the serial ports and make it impossible for
lirc_serial to get at the one we configured it for. The entry you
want for this is under (make menuconfig) "Device Drivers | Character
devices | Serial drivers" and change "8250/16550 and compatible serial
support" to "M" (module). Save out the config and build your kernel
as normal (make ; make modules_install ; make install).
Boot the machine, then run "uname -r" to verify that your new
kernel is being used. Once you verify this, check to see that
no serial ports yet exist (8250 module is not yet loaded) with
"ls /dev/ttyS*", you should see nothing (no /dev/ttyS0, /dev/ttyS1, ...).
If you see serial ports, check to see if the 8250 module was
autoinstalled by the hardware detection logic while booting
"lsmod 8250". If it is there, do a "rmmod 8250" and check to see
there are no serial ports. If you still see serial ports, then
you didn't compile the kernel correctly. :( Something broke.
Once you've verified the operation of the 8250 module, that it
is not loading serial ports when you boot. You can add lirc_serial
then 8250 to your /etc/modules files. On Mandrake10, I added two
lines to /etc/modprobe.preload:
# /etc/modprobe.preload: kernel modules to load at boot time.
#
# This file should contain the names of kernel modules that are
# to be loaded at boot time, one per line. Comments begin with
# a `#', and everything on the line after them are ignored.
# this file is for module-init-tools (kernel 2.5 and above) ONLY
# for old kernel use /etc/modules
lirc_serial
8250
uinput
This will load the lirc_serial module fairly early in the system
boot process. Please note, the uninput driver module needs to also
be loaded. The kernel cannot sense that the lirc_keybd daemon will
want this, so we will manually specify it to be loaded.
I suspect that you could also go as far as to modify the kernel
sources to include the lirc_serial into your running kernel. The
advantage would be that you could then have an initrd.img which
could load the driver even earlier? That is more work than I
need to do here, it is beyond the scope of what I wanted to
accomplish, for now. ;)
TopCleanup the IVTV modules statements
You've probably already gotten MythTV running and checked out before
you moved on to trying out this "keyboard idea of Tom's"? We need
to change some of those PVR250 / PVR350 IVTV aliases and such in
/etc/modules.conf file. We need to comment out the loading of the
ivtv lirc driver, my modules.conf looks like this for a twin
PVR250MCE setup:
alias char-major-81 videodev
alias char-major-81-0 ivtv
#alias char-major-61 lirc_device
options ivtv debug=1
options tuner type=2
options msp3400 once=1 simple=1
add below ivtv msp3400 saa7115 tuner
#add above ivtv lirc_dev lirc_i2c
If we don't do this, then things will get confusing, more likely you
will end up with both a /dev/lirc0 and a /dev/lirc1 IR device. I don't
think that there would be a conflict, but you would then need to decide
which is which device that is actually lirc_serial appearing in the
device directory. Better to comment out the ivtv stuff for now. You
can always put it back later if you decide to, or you cannot get all
this working. :-P