Sunday, November 27, 2011
Fast Infrared (FIR) how-to for applicable Toshiba laptops
I wrote this several years ago, once I figured out how to get IR working. It was primarily aimed at Slackware users, and now includes ubuntu 8.10, 9.04, 10.04 and 11.x - not tested. There seems no reason it shouldn’t work… However, it may be getting a little out of date and reference only.
IRDA (FIR mode) on Toshiba laptop with an smsc-ircc IrDA device and no BIOS setting.
Because the laptop came with IRDA, this was more of a challenge than anything else, and more difficult than first imagined. Most people get SIR working, I didn’t!
Acknowledgements to the various IR sites - GMane in particular.
——————————————————————–
If your laptop (Toshiba) is equipped with an “ISA bridge: Intel Corporation 82801DBM (ICH4-M) LPC Interface Bridge”, and a 24cc controller or similar, it will require the smsc-ircc2 kernel module driver. Patches are added from time to time and may be viewed on Gmane; http://blog.gmane.org/gmane.linux.irda.general
If you want to support a specific combination of bridge and controller Gmane may be a good place to start, to see if your combination is supported.
Distribution
Slackware 11.0, 12.0 and 12.1 running a recent 2.6.x kernel, and more recently ubuntu up to 11.x
Please read the documentation for your distribution.
NOTE: The smsc-ircc2 module is experimental and may break your system.
Software requirements
Latest irdautils, openobex and recent kernel (2.6.17.13 at the time of writing) (still working with 2.6.26.3 and ubuntu 2.6.27-9-generic - plus).
Kernel setup
Not an issue with ubuntu
Networking > IRDA (compiled as modules).
ISA and Serial support enabled (SIR capable).
The smsc-ircc2 module is experimental, therefore it is necessary to set > Code maturity level options > Prompt for development and/or incomplete code/drivers = y.
Please refer to the many howto’s on compiling and installing the linux kernel.
IrDA hardware
PCI by name (the relevant bits)
#lspci -v
00:1f.0 ISA bridge: Intel Corporation 82801DBM (ICH4-M) LPC Interface Bridge (rev 03)
Flags: bus master, medium devsel, latency 0
PCI by numbers
#lspci -v -n
00:1f.0 0601: 8086:24cc (rev 03)
Flags: bus master, medium devsel, latency 0
Install the software and then create the IrDA devices (linux irda howto - 2.6 kernel)
# mknod /dev/ircomm0 c 161 0
# mknod /dev/ircomm1 c 161 1
# mknod /dev/irlpt0 c 161 16
# mknod /dev/irlpt1 c 161 17
# mknod /dev/irnet c 10 187
# chmod 666 /dev/ir*
Set the aliases in /etc/modprobe.d - Kernel 2.6.x requires a separate entry eg. /etc/modprobe.d/smsc-ircc2 will do.
Regardless of options placed in modprobe.d, I chose to pass the required options during modprobe. It was impossible to load the module otherwise.
alias irda0 smsc-ircc2
alias tty-ldisc-11 irtty-sir
alias char-major-161 ircomm-tty
alias char-major-10-187 irnet
For information on your chip, run smcinit
NOTE: Other than for setup, never run smcinit to initialize the smsc-ircc IrDA device - it will prevent IR from working.
#smcinit -v
smcinit 0.5cvs
SIR ioport: 0×3f8
FIR ioport: 0×130
FIR interupt: 3
FIR DMA: 3
Detected IO hub vendor id: 0×8086
Detected IO hub device id: 0×24cc.
Detected Chip id: 0×7a
SIR ioport register write: 0xfe read: 0xfe
FIR interrupt register write: 0×3 read: 0×3
FIR ioport register write: 0×26 read: 0×26
FIR dma register write: 0×3 read: 0×3
Initialization of the SMC 47Nxxx succeeded
Windows device manager indicates the following values
I/O 02f8 - 02FF (SIR)
I/O 0130-0137 (FIR)
IRQ 07 (FIR)
DMA 01 (FIR)
Controller 24cc
There are differences in some values between Windows and smcinit. I used the smcinit values.
The SIR serial device in this case is /dev/ttyS0
but may vary depending on your hardware.
To confirm
#setserial /dev/ttyS0
/dev/ttyS0, UART: 16550A, Port: 0×03f8, IRQ: 4
From smcinit above, SIR ioport: 0×3f8 = /dev/ttyS0 Port: 0×03f8.
dmesg will provide the same information concerning your serial ports, however, it may be necessary to match the correct serial driver with the irda hardware, as they may vary from machine to machine.
To initialize FIR, first disable the serial device
#setserial /dev/ttyS0 uart none
or whatever your SIR port /dev/ttySX is.
Load the smsc-ircc2 module using the values provided by smcinit;
#modprobe smsc-ircc2 -v –ignore-install ircc_dma=3 ircc_irq=3 ircc_fir=0×130 ircc_sir=0×3f8
–ignore-install was not always necessary, but occasionally the module would not load without it? See “man modprobe” for details. ircc_dma=7 works also. Otherwise, the values are fixed as far as I can tell. -v for debugging.
dmesg
# dmesg grep | tail
Detected unconfigured Toshiba laptop with Intel 8281DBM LPC bridge SMSC IrDA chip, pre-configuring device.
Setting up Intel 82801 controller and SMSC device
Overriding FIR address 0×0130
Overriding SIR address 0×03f8
SMsC IrDA Controller found
IrCC version 2.0, firport 0×130, sirport 0×3f8 dma=3, irq=3
No transceiver found. Defaulting to Fast pin select
IrDA: Registered device irda0
Then
#irattach irda0 -s
If all has gone well you should see something similar to this in /var/log/messages
#tail /var/log/messages
Oct 20 16:32:38 localhost irattach: executing: ‘/sbin/modprobe irda0′
Oct 20 16:32:38 localhost irattach: executing: ‘echo xx > /proc/sys/net/irda/devname’
Oct 20 16:32:38 localhost irattach: executing: ‘echo 1 > /proc/sys/net/irda/discovery’
Oct 20 16:32:38 localhost irattach: Starting device irda0
“xx” the laptop - 1 device discovered.
Then run irdadump to verify the whole process. You should see your computer and any device that you used to test the link. In this case a Palm.
#irdadump
07:32:53.284907 xid:cmd 286e7df5 > ffffffff S=6 s=5 (14)
07:32:53.374893 xid:cmd 286e7df5 > ffffffff S=6 s=* xx hint=0400 [ Computer ] (18)
07:32:54.462330 xid:rsp 286e7df5 < 3ea004c9 S=6 s=5 zz hint=8220 [ PDA/Palmtop IrOBEX ] (20)
07:32:55.834526 xid:cmd 286e7df5 > ffffffff S=6 s=0 (14)
xx is the computer name, zz is the Palm username.
And, just to be sure, the following shows the Palm device.
# cat /proc/sys/net/irda/discovery
IrLMP: Discovery log:
nickname: zz, hint: 0×8220, saddr: 0×286e7df5, daddr: 0×3ea004c9
This start|stop|restart script is adapted from the slmodemd script. Added module loading and unloading, to ensure that all relevant modules are loaded before the smsc-ircc2 module, otherwise IR will not work, and to unload the modules when stopping IR, ready for the next start. Not really necessary, but it is cleaner and prevents problems.
NOTE: Don’t use this script in ubuntu
#!/bin/sh
# rc.irda
#
# Start irda
#
irda_start()
{
if [ -x /sbin/setserial ]; then
echo -n “Starting irda:”
/sbin/setserial /dev/ttyS0 uart none
/sbin/modprobe ircomm
/sbin/modprobe ircomm-tty
/sbin/modprobe smsc-ircc2 –ignore-install ircc_dma=3 ircc_irq=3 ircc_fir=0×130 ircc_sir=0×3f8
/usr/sbin/irattach irda0 -s
fi
}
irda_stop()
{
echo “Shutting down irda”
killall irattach
/sbin/rmmod smsc-ircc2
/sbin/rmmod ircomm-tty
/sbin/rmmod ircomm
/sbin/rmmod irda
}
irda_restart()
{
irda_stop
sleep 1
irda_start
}
case “$1” in
’start’)
irda_start
;;
’stop’)
irda_stop
;;
‘restart’)
irda_restart
;;
*)
echo “usage $0 start|stop|restart”
esac
Make it executable - as su or sudo
#chmod +x /etc/rc.d/rc.irda
Run as su or sudo
#/etc/rc.d/rc.irda
Irlan, irnet, rfcomm, phone and pda connections etc, are adequately explained in other tutorials.
I did manage to sync the Palm with my desktop. Set /dev/ircomm0 in Kpilot or Jpilot preferences. If you are using Gnome, it’s under Evolution, Edit>Synchronisation options… menu, or the Gnome Preferences menu.
ubuntu setup: up to and including 11.x should be OK.
1. Ubuntu kernel has smsc-ircc2 module configured.
2. In /etc/modprobe.d/irda-utils add line: alias irda0 smsc-ircc2
3. In /etc/default/irda-utils edit: DEVICE=”irda0” SETSERIAL=”/dev/ttyS0” SMCINIT=”no”
4. In /etc/init.d/irda-setup under FIR=”smsc-ircc2”; add line
OPTIONS=”–ignore-install ircc_dma=3 ircc_irq=3 ircc_fir=0×130 ircc_sir=0×3f8”
NOTE: Invoking smcinit or setting to “yes” in /etc/defaults/irda-utils prevents the operation of IR. Ensure other related modules are loaded before invoking /etc/init.d/irda-utils start.