Difference between revisions of "How to make use of IrDA"

From ThinkWiki
Jump to: navigation, search
(ISA PnP patch)
Line 24: Line 24:
 
FIR is the preferred mode of IrDA operation and operates at a bandwidth of 4 Mbps
 
FIR is the preferred mode of IrDA operation and operates at a bandwidth of 4 Mbps
  
=== BIOS settings ===
+
The chips FIR mode first needs to be activated using the ISA PnP or BIOS method.
Main problem here is that the chips FIR mode needs to be activated. On most ThinkPads, the easiest way to activate FIR mode is by entering BIOS setup during boot-up by pressing {{key|F1}} when prompted.
 
Then, selecting 'Config' followed by 'Infrared' will allow you to control the IrDA operation. Here you will need to select the option to Enable the infra-red port, and ensure the proper resources are set (typically: IO 0x2f8 and IRQ 3). Be sure to save the changes, and then Exit.
 
 
 
{{NOTE|Changing these BIOS settings does not affect Windows 2000 or XP operating systems, but may cause resource issues in older windows versions, or other legacy operating systems.}}
 
 
 
{{WARN|If you change the BIOS settings for IO, IRQ or DMA of the IrDA port, remember to do so accordingly on all examples in this page when applying them to your ThinkPad.}}
 
 
 
=== PnP settings from Linux ===
 
If changing the BIOS setting is not an option or if the settings cannot be altered, as on some older ThinkPads, the FIR mode can be activated from Linux with one of the following (this needs to be done on every boot):
 
* setpnp as part of the old pcmcia-utils source package
 
* tpctl, but only for some old ThinkPads
 
setpnp requires a kernel with PNP-BIOS support compiled in, which the {{Redhat}} and {{Fedora}} kernels lack.  Even if your distribution does enable PNP-BIOS support, ACPI-PNP will disable it.
 
  
=== ISA PnP Support ===
+
{{HINT|Regardless of which method you use, you will still have to set the dongle_id and run setserial as shown further below}}
 +
=== ISA PnP support for nsc-ircc ===
 
Starting with the 2.6.17-rc1 kernel, the nsc-ircc driver has ISA PnP support, and seperate patching is no longer required.
 
Starting with the 2.6.17-rc1 kernel, the nsc-ircc driver has ISA PnP support, and seperate patching is no longer required.
  
If you have an older 2.6 kernel, here are some patches, that allow the loading of the driver without the BIOS, setpnp or tpctl hacks.<br />
+
If you have an older 2.6 kernel, here are some patches, that allow the loading of the driver without the below BIOS change.<br />
You will still have to call setserial and set the dongle_id parameter, as shown below.
 
 
* [http://steffenpingel.de/patches/nsc-ircc-pnp.diff 2.6.10 patch]
 
* [http://steffenpingel.de/patches/nsc-ircc-pnp.diff 2.6.10 patch]
 
* [http://shamrock.dyndns.org/~ln/linux/nsc-ircc-pnp.2.6.12-rc6.diff 2.6.12-rc6 patch]  
 
* [http://shamrock.dyndns.org/~ln/linux/nsc-ircc-pnp.2.6.12-rc6.diff 2.6.12-rc6 patch]  
 
* [http://shamrock.dyndns.org/~ln/linux/nsc-ircc-pnp.2.6.12.diff 2.6.12 patch (applies cleanly to 2.6.12 through 2.6.15)]
 
* [http://shamrock.dyndns.org/~ln/linux/nsc-ircc-pnp.2.6.12.diff 2.6.12 patch (applies cleanly to 2.6.12 through 2.6.15)]
* patches as accepted upstream for 2.6.17 (2.6.16-git15): [http://www.kernel.org/diff/diffview.cgi?file=%2Fpub%2Flinux%2Fkernel%2Fv2.6%2Fsnapshots%2Fpatch-2.6.16-git15.bz2;z=1931 nsc-ircc.c]and [http://www.kernel.org/diff/diffview.cgi?file=%2Fpub%2Flinux%2Fkernel%2Fv2.6%2Fsnapshots%2Fpatch-2.6.16-git15.bz2;z=1932 nsc-ircc.h]
+
* patches as part of 2.6.17-rc1: [http://www.kernel.org/diff/diffview.cgi?file=%2Fpub%2Flinux%2Fkernel%2Fv2.6%2Fsnapshots%2Fpatch-2.6.16-git15.bz2;z=1931 nsc-ircc.c]and [http://www.kernel.org/diff/diffview.cgi?file=%2Fpub%2Flinux%2Fkernel%2Fv2.6%2Fsnapshots%2Fpatch-2.6.16-git15.bz2;z=1932 nsc-ircc.h]
 +
 
 +
ISA PnP support seems '''necessary''' in some cases (e.g., ThinkPad {{T43}} and kernel 2.6.14 and 2.6.15).
 +
 
 +
=== Changing BIOS settings ===
 +
On most ThinkPads, the easiest way to activate FIR mode is by entering BIOS setup during boot-up by pressing {{key|F1}} when prompted.
 +
Then, selecting 'Config' followed by 'Infrared' will allow you to control the IrDA operation. Here you will need to select the option to Enable the infra-red port, and ensure the proper resources are set (typically: IO 0x2f8 and IRQ 3). Be sure to save the changes, and then Exit.
 +
 
 +
{{NOTE|Changing these BIOS settings does not affect Windows 2000 or XP operating systems, but may cause resource issues in older windows versions, or other legacy operating systems.}}
  
This patch seems '''necessary''' in some cases (e.g., ThinkPad {{T43}} and kernel 2.6.14 and 2.6.15).
+
{{WARN|If you change the BIOS settings for IO, IRQ or DMA of the IrDA port, remember to do so accordingly on all examples in this page when applying them to your ThinkPad.}}
  
 
===Kernel configuration===
 
===Kernel configuration===
Line 106: Line 102:
 
  modprobe nsc_ircc
 
  modprobe nsc_ircc
 
:The value <tt>pnp0/00\:0d</tt> can vary - look for a resources file containing the appropriate irq/dma/io values, e.g., using {{cmdroot|grep 0x2f8 /sys/devices/pnp*/*/resources}} .
 
:The value <tt>pnp0/00\:0d</tt> can vary - look for a resources file containing the appropriate irq/dma/io values, e.g., using {{cmdroot|grep 0x2f8 /sys/devices/pnp*/*/resources}} .
{{NOTE|The PM (power management) issues should be resolved with the fixes that Linus merged in preperation for the 2.6.17 kernel}}
+
{{NOTE|The power management issues should be resolved starting with the 2.6.17-rc1 kernel.}}
  
 
== Some other things you might want to do with IrDA ==
 
== Some other things you might want to do with IrDA ==

Revision as of 23:25, 4 April 2006

The purpose of this document is to get the IrDA hardware in your ThinkPad operational, setting up communication to other devices is not covered. However, the external links section can prove useful for this.

Serial IR (SIR)

SIR is limited to serial datarates up to 115.2Kb/s

Kernel configuration

Linux 2.4 kernel config

Edit /etc/modules.conf and add the following lines

alias tty-ldisc-11 irtty
alias char-major-161 ircomm-tty

Linux 2.6 kernel config

Edit /etc/modprobe.conf and add the following lines

alias tty-ldisc-11 irtty-sir
alias char-major-161 ircomm-tty

Fast IR (FIR)

FIR is the preferred mode of IrDA operation and operates at a bandwidth of 4 Mbps

The chips FIR mode first needs to be activated using the ISA PnP or BIOS method.

Hint:
Regardless of which method you use, you will still have to set the dongle_id and run setserial as shown further below

ISA PnP support for nsc-ircc

Starting with the 2.6.17-rc1 kernel, the nsc-ircc driver has ISA PnP support, and seperate patching is no longer required.

If you have an older 2.6 kernel, here are some patches, that allow the loading of the driver without the below BIOS change.

ISA PnP support seems necessary in some cases (e.g., ThinkPad T43 and kernel 2.6.14 and 2.6.15).

Changing BIOS settings

On most ThinkPads, the easiest way to activate FIR mode is by entering BIOS setup during boot-up by pressing F1 when prompted. Then, selecting 'Config' followed by 'Infrared' will allow you to control the IrDA operation. Here you will need to select the option to Enable the infra-red port, and ensure the proper resources are set (typically: IO 0x2f8 and IRQ 3). Be sure to save the changes, and then Exit.

NOTE!
Changing these BIOS settings does not affect Windows 2000 or XP operating systems, but may cause resource issues in older windows versions, or other legacy operating systems.
ATTENTION!
If you change the BIOS settings for IO, IRQ or DMA of the IrDA port, remember to do so accordingly on all examples in this page when applying them to your ThinkPad.

Kernel configuration

Linux 2.4 kernel config

Edit /etc/modules.conf and add the following lines

alias irda0 nsc-ircc
options nsc-ircc dongle_id=0x09 io=0x2f8 irq=3 dma=3
pre-install nsc-ircc setserial /dev/ttyS1 uart none port 0 irq 0

Linux 2.6 kernel config

Edit /etc/modprobe.conf and add the following lines

alias irda0 nsc-ircc
options nsc-ircc dongle_id=0x09 io=0x2f8 irq=3 dma=3
install nsc-ircc /bin/setserial /dev/ttyS1 uart none port 0 irq 0; /sbin/modprobe --ignore-install nsc-ircc

The install line is a work-around for the 8250 serial driver taking over the device, and may not be needed in certain distributions.

Gentoo kernel config

Edit / Create /etc/modules.d/nsc-irrc and add the following lines

alias irda0 nsc-ircc
options nsc-ircc dongle_id=0x09 io=0x2f8 irq=3 dma=3

Edit /etc/modules.autoload.d/kernel-2.6 and add the following lines

nsc-ircc

If you have serial support build in the kernel, switch it to a module and add it after nsc-ircc to advoid io base and irq conflict. For kernel 2.4, same as 2.6 changing the path to modules.autoload.d/kernel-2.4.

Debian Sarge/Etch kernel config

Install irda-utils and set it up for serial port emulation. Edit /etc/modprobe.d/irda-utils and add/change the following lines:

alias irda0 nsc-ircc
options nsc-ircc dongle_id=0x09 io=0x2f8 irq=3 dma=3

Edit / create /etc/modules.conf and add the following line before any references to 8250*, if any:

nsc-ircc

Make sure that module-init-tools has a chance to iterate over /etc/modules.conf before udev does the initial pci hotplug (this is a problem at least in Debian Sarge, when using backported udev packages):

# cp /etc/rcS.d/S20module-init-tools /etc/rcS.d/S03module-init-tools

Note that at S03, module-init-tools cannot run depmod for you, so either do it manually before you reboot into a new kernel, or reboot twice to get it to work right. This is also the reason for using cp instead of mv.

If you have the regular serial port drivers as modules, that's it. Otherwise, try adding the install line described in the Linux 2.6 kernel config section, above, or compile them as modules instead of built-in.

Known problems

  • If the FIR mode is not activated, attempts to load the nsc-ircc module will result in an error in syslog of "Wrong chip version ff".
  • After suspend the nsc-ircc module needs to be manually reloaded
  • If module reloading does not work after a suspend, try reactivating the IrDA port as well:
rmmod nsc_ircc
echo disable > /sys/devices/pnp0/00\:0d/resources
echo activate > /sys/devices/pnp0/00\:0d/resources
modprobe nsc_ircc
The value pnp0/00\:0d can vary - look for a resources file containing the appropriate irq/dma/io values, e.g., using # grep 0x2f8 /sys/devices/pnp*/*/resources .
NOTE!
The power management issues should be resolved starting with the 2.6.17-rc1 kernel.

Some other things you might want to do with IrDA

  • add fast PPP support:
# modprobe irnet
  • if needed, limit further the size of the transmit window
# echo 1 > /proc/sys/net/irda/max_tx_window

LIRC and IrDA

Usually, IrDA port's are not compatible with LIRC, but you may have luck using lirc_sir.

If loading the lirc_sir module shows something like the following in # dmesg output, you are lucky and can use LIRC with the IrDA port to remote control your ThinkPad.

lirc_sir: I/O port 0x02f8, IRQ 3.
lirc_sir: Installed.

External Sources