SDB:Linux and IrDA

Şuraya atla: kullan, ara


Version: 6.3

Request

You'd like to connect a deivce using an infra-red port.

Background

Almost all Laptops and some peripheral equipment include an infra-red port for wireless communication.  The IrDA Protocol from the Infrared Data Association has become the standard for communication using these devices.

Information on the implementation of the IrDA protocol in Linux can be found under http://irda.sourceforge.net/. Detailed information can also be found under http://www.linuxdoc.org/HOWTO/Infrared-HOWTO/, the IrDA HOWTO.

Almost all infra-red ports that are built into a PC can be addressed in the same way as a serial port.  This means that the Linux serial-port driver detects the port and configures it as it does any other serial port on a computer.  The infra-red port can be used thanks to an extra kernel-module which accesses the serial-port driver.

The communication between most devices that use the IrDA protocol is supported under Linux.  Better put...the following protocols are supported:

  • IrCOMM - Emulates a serial port.  The driver in the Linux kernel creates a simulated serial port, /dev/ircomm0 which enables communication with a device using using almost any program, for example minicom or even pppd.  For instance, the Siemens S25 Mobile telephone and the program wvdial can be used to connect to the Internet.
  • IrLPT or Printer - Emulates a parallel port.  The driver in the kernel simulates a parallel port /dev/irlpt0 that is addressable in almost the same manner as a normal, "wired" pinter-port /dev/lp0.  A printer connected with an infra-red port is addressed in the same manner as a normal printer except that the name of the port is different.
  • IrLAN - Using this protocol 2 or more computers can be networked.  Unfortunately the kernel driver is still experimental.  A network port is simulated, irlan0, which is configurable using ifconfig/route in the same manner as the eth0 port.
  • IrOBEX - This protocol is supported by Palmtops and other so-called hand-held computers. Support of this protocol is provided under Linux by different programs.

Prerequisites

Infra-red support is included since SuSE 6.3.  The preconfigured package irda includes programs which can integrate most infra-red ports using an UART compatable SIR infra-red port.  All necessary modules needed by the kernel cna be found in the kernmod package.

Configuring the Port

Check to see which I/O address and IRQ interrupt your infra-red port is using.  /dev/ttyS1 and Interrupt 3 are default settings (which means the I/O address 0x2f8.

If these prerequisites are filled you can begin.  IrDA is started with the command rcirda start.  After starting you can check if everything is running correctly with irdadump.  If everything goes as planned you should receive the following monitor-output every 3 seconds:

erda:~ # irdadump
13:42:57.118679 xid:cmd d04496e2 > ffffffff S=6 s=0 (14)
13:42:57.208957 xid:cmd d04496e2 > ffffffff S=6 s=1 (14)
13:42:57.298645 xid:cmd d04496e2 > ffffffff S=6 s=2 (14)
13:42:57.388923 xid:cmd d04496e2 > ffffffff S=6 s=3 (14)
13:42:57.478670 xid:cmd d04496e2 > ffffffff S=6 s=4 (14)
13:42:57.568914 xid:cmd d04496e2 > ffffffff S=6 s=5 (14)
13:42:57.658705 xid:cmd d04496e2 > ffffffff S=6 s=* erde hint=0500 [ PnP Computer ] (23)

These are the so-called Discovery packages. (exchange station identification frame - therefore `xid').

When another device with an infra-red port is brought in view the "xid" packages should be returned, which looks like:

09:12:56.756986 xid:cmd 84663133 > ffffffff S=6 s=0 (14)
09:12:56.846938 xid:cmd 84663133 > ffffffff S=6 s=1 (14)
09:12:56.936963 xid:cmd 84663133 > ffffffff S=6 s=2 (14)
09:12:57.026938 xid:cmd 84663133 > ffffffff S=6 s=3 (14)
09:12:57.116931 xid:cmd 84663133 > ffffffff S=6 s=4 (14)
09:12:57.206934 xid:cmd 84663133 > ffffffff S=6 s=5 (14)
09:12:57.286939 xid:rsp 84663133 < 556ecd9e S=6 s=5 BJC-80 hint=8804 [ Printer IrCOMM ] (23)
09:12:57.296982 xid:cmd 84663133 > ffffffff S=6 s=* erde hint=0500 [ PnP Computer ] (23)

If this second device doesn't receive a signal compare the hardware settings (I/O Address, Interrupts) of the laptop to those found in the file /etc/rc.config.  the variables to look for are IRDA_PORT, the serial port in use, and IRDA_IRQ which listgs the interrupt.

The output of irdadump also shows which protocols the peripheral device supports.  In the example above the device "BJC-80" supports both Printer and IrCOMM.  In this case the device could be addressed as a printer over the serial port /dev/irlpt0.

If you'd like to start the IrDA support at boot set the variable "START_IRDA" in the file /etc/rc.config to yes.

Configuring a printer with IrDA support

If the test above was succesfull you can configure your printer using YaST:

  • Start YaST. Choose menu item System Administration --> / Integrate Hardware into System --> / Configure Printer.
  • Configure the printer as normal.  Choose Attached to Port: Parallel Port and Device Name: /dev/irlpt0
  • After configuration restart the printer-service with the command rclpd restart, after which you should be able to print normally.

Configuring a Modem Connection (Example with a Cellular Telephone)

Enter the following commands to use the modem in a cellular telephone:

rm /dev/modem
ln -s /dev/ircomm0 /dev/modem

After this you should be able to connect using minicom or wvdial. Configure the modem as given in the handbook for normal serial-port modems.  Please check the compatability-list found under http://www.cs.uit.no/linux-irda/hardware.html to see if your modem can be used under Linux.

Exchanging Data between Linux Computers

Exchanging data between Linux Computers is normally accomplished with the IrLAN protocol. Although sometimes this process has problems auto-detecting the communication partners.

The most reliable method is to use the PPP protocol over a simulated serial port.

Place two computers in view of one another and start the PPP daemon on one computer, for example with the following command:

erde:~# pppd /dev/ircomm0 10.0.0.1:10.0.0.2

On the other computer start pppd as follows:

sonne:~# pppd /dev/ircomm0

With this a PPP connection is made between two computers over an infra-red port simulating a serial port. The computer "sonne" is given the IP Address 10.0.0.2 from the computer "erde" (which has the IP Address 10.0.0.1, given by the PPP interface). In short, you can reach the computer "erde" from the computer "sonne" (with the IP Address 10.0.0.1) using normal network-communication programs like ssh, telnet, ftp, nfs...etc. <keyword>irda,linur/ir,infrarot,infrared,notebook,laptop</keyword>