Next Previous Contents

5. Linux/IrDA-Utils

5.1 Compilation

A recommendation from Bjoern Hansson <>: If make depend fails on stdef.h and stdarg.h just add -I/usr/lib/gcc-lib/i586-linux/egcs-2.90.29/include/ or the according path for your system to the SYS_INCLUDES line in Makefile.

To compile irdadump and irdaping (which are not necessary to get Linux/IrDA to work) you probably to tweek the source a little:

Dag Brattli: " The problem is that I'm including kernel header files which conflicts with the libc header files. So why do I need to include kernel header files? Well, the libc/glibc header files does not know that much about IrDA (yet). The reason is just that IrDA is quite new. I could have just defined the stuff in the program itself, but then people would be able to compile the stuff even if the definitions had changed in the kernel. I think its better that you get a compile error than some possible strange behaviour. If you don't want to wait until I figure out how to solve this stuff, you can just remove the linux header files and define the constants in your program yourself:


#define PF_IRDA          23
#define AF_IRDA          PF_IRDA

#define ARPHRD_IRDA      783
#define ETH_P_IRDA       0x0017

All the stuff above should not be changed, so it is probably safe to just hardcode them. I'll change the programs so they just includes the normal header files, and then defines these constants only if the header files didn't know about them. It should however be safe to include linux/irda.h ."

Though I never succeeded to compile all utilities without errors, I recommend to use at least the latest packages of libtool, m4, autoconf, and automake if you want to compile irdadump, irdaping, etc.

5.2 Precompiled Packages

NOKUBI Takatsugu provides an unofficial irda-utils Debian package (needs libc2.1). This package is part of the Potato Debian release. Also Mandrake 6.1, Redhat 6.1 and SuSE 6.1 contain RPM packages of irda-utils.

5.3 Contents of Linux/IrDA-Utils

irmanager

The irmanager is user-space daemon that is inspired and quite similar to the cardmgr used in the PCMCIA distribution. For example, if IrLMP discovers a remote device with IrLAN provider capabilities and no local IrLAN client has registered, then IrLMP will send an event to the IrManager and make it modprobe the module required. When application level clients are ready for communication and user-space configuration, they can also notify IrManager about this, so that it can execute the right script. For example will IrLAN send the event EVENT_IRLAN_START when the data channel is ready for exchanging Ethernet frames. When IrManager receives this event, it will execute /etc/irda/network start <devname> to configure the network interface. If you use the RedHat variant of it, it will in turn execute /sbin/ifup<devname> .

irattach

Usually irattach is started by irmanager. irattach attaches an IrDA capable tty to the basic services of Linux/IrDA. If kerneld or kmod are running, the modules irda and irtty are loaded automatically, if not you have to load them by hand in that order. It is recommended to start irattach in the background. To stop irattach just kill the process.

load_misc

A Perl script which loads a Linux/IrDA module and builds the according device in /dev using mknod.

/etc/irda

Configuration files, e.g. contains the serial port of the SIR driver:


drivers
network
network.opts
obex

You should at least configure the IR driver drivers:


#! /bin/sh
#
# drivers
#
# Initialize and shutdown IrDA device drivers.
#
# This script should be invoked with two arguments. The first is the
# action to be taken, either "start", "stop", or "restart".
#

action=$1
device=$2

case "${action:?}" in
start)
    irattach /dev/ttyS2          # The third serial port is an IrDA port
    # irattach /dev/ttyS0 -d esi # Attach a ESI dongle to the first serial port
    # insmod pc87108             # If your machine as a pc87108 FIR chipset
    ;;
stop)
    killall irattach             # ... or something. Currently not used
    ;;
restart)
    /sbin/ifconfig ${device:?} down up
    ;;
esac

irdaping

This is a program similar to ping(8). It sends IrDA test frames (added some userdata which contains the frame number and the time the frame was sent). You can also change the size of the frame by using the -s option. You must supply an IrDA device address, and not an IP address. You have to be able to get that device address by some method irdadump?

Here is one output sample (pinging an ACTiSYS IR-100M):


dagbnb /home/dagb/linux/irda-utils/irdaping/ # ./irdaping 0xf7be8388 
IrDA ping (0xf7be8388): 32 bytes
32 bytes from 0xf7be8388: irda_seq=0 time=102.466003 ms.
32 bytes from 0xf7be8388: irda_seq=1 time=102.202003 ms.
32 bytes from 0xf7be8388: irda_seq=2 time=102.170998 ms.
32 bytes from 0xf7be8388: irda_seq=3 time=101.633003 ms.

4 packets received by filter

irdadump

One advantage of implementing IrDA device drivers as network device drivers is that you should be able to attach sniffers to the device (or actually the packet type). That way, it is possible to use a really handy utility called irdadump (instead of tcpdump). This will make debugging MUCH easier. Linux-2.2 implements the BPF (Berkeley Packet Filter), so its possible to filter out exactly the frames you want to see.

Note: You probably have to be root for using irdadump . CONFIG_PACKET has to be enabled in the kernel. If compiled as a module you might load the module manually. irdadump has been converted into a library, so it can be used from GUI applications as well.

Here is a sample output of a small session between Linux and a Palm III. This log shows that the local irobex layer is not responding, so the Palm III sends a disc frame.


dagbnb /home/dagb/linux/irda-utils/irdadump/ # ./irdadump 

20:18:15.305711 xid:cmd:saddr=0x05c589 > daddr=0xffffffff,S=6,s=0
20:18:15.385597 xid:cmd:saddr=0x05c589 > daddr=0xffffffff,S=6,s=1
20:18:15.465568 xid:cmd:saddr=0x05c589 > daddr=0xffffffff,S=6,s=2
20:18:15.545953 xid:cmd:saddr=0x05c589 > daddr=0xffffffff,S=6,s=3
20:18:15.625574 xid:cmd:saddr=0x05c589 > daddr=0xffffffff,S=6,s=4
20:18:15.705575 xid:cmd:saddr=0x05c589 > daddr=0xffffffff,S=6,s=5
20:18:15.785601 xid:cmd:saddr=0x05c589 > daddr=0xffffffff,S=6,s=255,info=Linux
20:18:18.075526 xid:cmd:saddr=0xb50c14b > daddr=0xffffffff,S=6,s=0
20:18:18.225498 xid:cmd:saddr=0xb50c14b > daddr=0xffffffff,S=6,s=1
20:18:18.375495 xid:cmd:saddr=0xb50c14b > daddr=0xffffffff,S=6,s=2
20:18:18.526355 xid:cmd:saddr=0xb50c14b > daddr=0xffffffff,S=6,s=3
20:18:18.675614 xid:cmd:saddr=0xb50c14b > daddr=0xffffffff,S=6,s=4
20:18:18.676364 xid:rsp:saddr=0x05c589 > daddr=0xb50c14b,S=6,s=4
20:18:18.765506 xid:cmd:saddr=0xb50c14b > daddr=0xffffffff,S=6,s=5
20:18:18.927221 xid:cmd:saddr=0xb50c14b > daddr=0xffffffff,S=6,s=255,info=Palm III
20:18:18.975796 snrm:cmd,ca=0xfe,pf=1
20:18:18.976534 ua:rsp,ca=0x58,pf=1
20:18:18.977145 ua:rsp,ca=0x58,pf=1
20:18:19.585627 rr:rsp,ca=0x58,nr=0,pf=1
20:18:19.585810 rr:rsp,ca=0x58,nr=0,pf=1
20:18:19.606413 i:cmd,ca=0x58,nr=0,ns=0,pf=1
20:18:19.606582 rr:rsp,ca=0x58,nr=1,pf=1
20:18:19.627708 rr:cmd,ca=0x58,nr=0,pf=1
20:18:19.627871 i:rsp,ca=0x58,nr=1,ns=0,pf=1
20:18:19.650571 disc:cmd,ca=0x58,pf=1
20:18:19.650736 ua:rsp,ca=0x58,pf=1
20:18:21.165524 xid:cmd:saddr=0xb50c14b > daddr=0xffffffff,S=6,s=0
20:18:21.315608 xid:cmd:saddr=0xb50c14b > daddr=0xffffffff,S=6,s=1
20:18:21.315793 xid:rsp:saddr=0x05c589 > daddr=0xb50c14b,S=6,s=1
20:18:21.395499 xid:cmd:saddr=0xb50c14b > daddr=0xffffffff,S=6,s=2
20:18:21.545516 xid:cmd:saddr=0xb50c14b > daddr=0xffffffff,S=6,s=3
20:18:21.695500 xid:cmd:saddr=0xb50c14b > daddr=0xffffffff,S=6,s=4
20:18:21.845840 xid:cmd:saddr=0xb50c14b > daddr=0xffffffff,S=6,s=5
20:18:22.007222 xid:cmd:saddr=0xb50c14b > daddr=0xffffffff,S=6,s=255,info=Palm III
20:18:22.056143 snrm:cmd,ca=0xfe,pf=1
20:18:22.056310 ua:rsp,ca=0xc8,pf=1
20:18:22.056381 ua:rsp,ca=0xc8,pf=1

37 pacckets received by filter

gnobex

GNOME GUI for using the IrOBEX protocol, to connect to Palm III.

irkbd

Support for infrared keyboard (and mouse?) protocol IrKBD.

irdalib

Linux/IrDA library.

obex

Please compile irdalib before compiling obex. Contains irobex_test, irobex_receive and irobex_palm3 . And obex_tcp which makes it possible to use OBEX over TCP/IP.

findchip

findchip can be used to detect the type of FIR chip.


Next Previous Contents