34.3. Infrared Data Transmission

IrDA (Infrared Data Association) is an industry standard for wireless communication with infrared light. Many laptops sold today are equipped with an IrDA-compatible transceiver that enables communication with other devices, such as printers, modems, LANs, or other laptops. The transfer speed ranges from 2400 bps to 4 Mbps.

There are two IrDA operation modes. The standard mode, SIR, accesses the infrared port through a serial interface. This mode works on almost all systems and is sufficient for most requirements. The faster mode, FIR, requires a special driver for the IrDA chip. Not all chip types are supported in FIR mode because of a lack of appropriate drivers. Set the desired IrDA mode in the BIOS of your computer. The BIOS also shows which serial interface is used in SIR mode.

Information about IrDA can be found in the IrDA how-to by Werner Heuser at http://tuxmobil.org/Infrared-HOWTO/Infrared-HOWTO.html. Additionally refer to the Web site of the Linux IrDA Project at http://irda.sourceforge.net/.

34.3.1. Software

The necessary kernel modules are included in the kernel package. The package irda provides the necessary helper applications for supporting the infrared interface. The documentation can be found at /usr/share/doc/packages/irda/README after the installation of the package.

34.3.2. Configuration

The IrDA system service is not started automatically when the system is booted. Use the YaST IrDA module for the activation. Only one setting can be modified in this module: the serial interface of the infrared device. The test window shows two outputs. One is the output of irdadump, which logs all sent and received IrDA packets. This output should contain the name of the computer and the names of all infrared devices in transmission range. An example for these messages is shown in Section 34.3.4, “Troubleshooting”. All devices to which an IrDA connection exists are listed in the lower part of the window.

IrDA consumes a considerable amount of battery power, because a discovery packet is sent every few seconds to detect other peripheral devices. Therefore, IrDA should only be started when necessary if you depend on battery power. Enter the command rcirda start to activate it or rcirda stop to deactivate it. All needed kernel modules are loaded automatically when the interface is activated.

Manual configuration can be performed in the file /etc/sysconfig/irda. This file contains only one variable, IRDA_PORT, which determines the interface to use in SIR mode.

34.3.3. Usage

Data can be sent to the device file /dev/irlpt0 for printing. The device file /dev/irlpt0 acts just like the normal /dev/lp0 cabled interface, except the printing data is sent wirelessly with infrared light. For printing, make sure that the printer is in visual range of the computer's infrared interface and the infrared support is started.

A printer that is operated over the infrared interface can be configured with the YaST Printer module. Because it is not detected automatically, configure it manually by clicking Other (not detected). In the following dialog, select IrDA printer. Usually, irlpt0 is the right connection. Details about operating printers in Linux are available in Chapter 11, Printer Operation.

Communication with other hosts and with mobile phones or other similar devices is conducted through the device file /dev/ircomm0. The Siemens S25 and Nokia 6210 mobile phones, for example, can dial and connect to the Internet with the wvdial application using the infrared interface. Synchronizing data with a Palm Pilot is also possible, provided the device setting of the corresponding application has been set to /dev/ircomm0.

If you want, you can address only devices that support the printer or IrCOMM protocols. Devices that support the IROBEX protocol, such as the 3Com Palm Pilot, can be accessed with special applications, like irobexpalm and irobexreceive. Refer to the IR-HOWTO (http://tldp.org/HOWTO/Infrared-HOWTO/) for information. The protocols supported by the device are listed in brackets after the name of the device in the output of irdadump. IrLAN protocol support is still a “work in progress.

34.3.4. Troubleshooting

If devices connected to the infrared port do not respond, use the command irdadump (as root) to check if the other device is recognized by the computer. Something similar to Example 34.1, “Output of irdadump” appears regularly when a Canon BJC-80 printer is in visible range of the computer:

Example 34.1. Output of irdadump

21:41:38.435239 xid:cmd 5b62bed5 > ffffffff S=6 s=0 (14) 
21:41:38.525167 xid:cmd 5b62bed5 > ffffffff S=6 s=1 (14)
21:41:38.615159 xid:cmd 5b62bed5 > ffffffff S=6 s=2 (14)
21:41:38.705178 xid:cmd 5b62bed5 > ffffffff S=6 s=3 (14)
21:41:38.795198 xid:cmd 5b62bed5 > ffffffff S=6 s=4 (14)
21:41:38.885163 xid:cmd 5b62bed5 > ffffffff S=6 s=5 (14)
21:41:38.965133 xid:rsp 5b62bed5 < 6cac38dc S=6 s=5 BJC-80 
                        hint=8804 [Printer IrCOMM ] (23) 
21:41:38.975176 xid:cmd 5b62bed5 > ffffffff S=6 s=* earth 
                        hint=0500 [ PnP Computer ] (21)

Check the configuration of the interface if there is no output or the other device does not reply. Verify that the correct interface is used. The infrared interface is sometimes located at /dev/ttyS2 or at /dev/ttyS3 and an interrupt other than IRQ 3 is sometimes used. These settings can be checked and modified in the BIOS setup menu of almost every laptop.

A simple video camera can also help in determining whether the infrared LED lights up at all. Most video cameras can see infrared light; the human eye cannot.