Search:  
Gentoo Wiki

IrDA

Contents

About

This tutorial is dedicated to people having an IrDA USB stick with the Sigmatel 4200 chip. The goal is to connect a mobile phone (a Nokia 5140 in my case) to the computer using an IrDA link. This example is made with a 2.6.16-gentoo-r6 Kernel. Among things that could be interesting, I'm using "udev" (as it is mandatory since Kernel 2.6.14).

BIOS

You may postpone this one because it obviously requires a reboot, but you need to make sure that IR is currently enabled in the BIOS. A quick check can be made with

# dmesg | grep tty
serial8250: ttyS1 at I/O 0x2f8 (irq = 3) is a 16550A

which gives relevant information anyway. If you get no replies, chances are your BIOS is not properly configured.

Warning: It is reported [1] that some BIOS need Microsoft Windows for being set.

Kernel

Make sure you have the four modules compiled with your kernel:

Linux Kernel Configuration: Enable IrDA
   Networking --->
      --- Networking support
          --- IrDA (Infrared) subsystem support
          ---   IrDA protocols
          < >   IrLAN protocol
          <M>   IrCOMM protocols
          [ ]   Ultra (connectionless)
          [*]   Cache last LSAP
          [*]   Fast RRs (low latency)
          [ ]   Debug information
                Infrared-port device drivers --->
                   --- SIR device drivers
                   <M> IrTTY (uses Linux serial driver)
                   --- Dongle support
                   [ ] Serial dongle support
                   --- Old SIR device drivers
                   <M> IrPORT (IrDA serial driver)
                   --- FIR device drivers
                   <M> IrDA USB dongle
                   <M> SigmaTel STIr4200 bridge
                   <M> NSC PC87108/PC87338
                   <M> Winbond W83977AF (IR)
                   <M> Toshiba Type-O IR Port
                   <M> SMSC IrCC
                   <M> ALi M5123 FIR
                   <M> VLSI 82C147 SIR/MIR/FIR
                   <M> VIA VT8231/VT1211 SIR/MIR/FIR

You should probably chose only one kernel driver, also see [2] for more detailed informations.

Compile the modules, install and modprobe the following modules (assuming your USB is already working):

Note: the device drivers are installed in /usr/src/linux/drivers/net/irda
irda
stir4200  <- your driver here
ircomm
ircomm_tty

You should verify that all modules you need are registered with the kernel.

Code: lsmod | grep stir4200
  stir4200               10500  0
  irda                  101432  3 ircomm_tty,ircomm,stir4200
  usbcore               102788  8 stir4200,usblp,ohci_hcd,uhci_hcd,usb_storage,usbhid,ehci_hcd

Userland

IrDA-utils

Emerge irda-utils and test the initscript /etc/init.d/irda start if it works, you can enable it on boot with rc-update add irda default.

Code: rc-update show | grep irda
irda |      default

Then, put your phone / your mobile device / your PDA in front of the IR receiver, paying attention that you made the IR connection active on the mobile device.

irattach

irattach irda0 -s should load the kernel module and set you ready to go on.

Warning: you may need to edit /etc/modprobe.d/aliases for irattach to load the correct driver!

irdadump

irdadump can be used to test the connection with an IR-aware device. You should get this:

Code: irdadump
  07:38:28.372663 xid:cmd fd6302bc > ffffffff S=6 s=0 (14)
  07:38:28.472615 xid:cmd fd6302bc > ffffffff S=6 s=1 (14)
  07:38:28.553081 xid:rsp fd6302bc < 0000bb1a S=6 s=1 Nokia 5140i hint=b125 [ PnP Modem Fax Telephony   IrCOMM IrOBEX ] (28)
  07:38:28.572618 xid:cmd fd6302bc > ffffffff S=6 s=2 (14)
  07:38:28.672619 xid:cmd fd6302bc > ffffffff S=6 s=3 (14)
  07:38:28.772624 xid:cmd fd6302bc > ffffffff S=6 s=4 (14)
  07:38:28.872625 xid:cmd fd6302bc > ffffffff S=6 s=5 (14)
  07:38:28.972628 xid:cmd fd6302bc > ffffffff S=6 s=* 10PARC hint=0400 [ Computer ] (22)

  8 packets received by filter

So, in this example, my Nokia phone seems detected. The device is working.

Note: This test can be performed without any IR-aware device to test the interface only.

irdaping

Execute irdaping fd6302bc where fd6302bc is the address you found with irdadump will ping your IR-aware device.

Network utils

irattach is a very handy tool to set up an IR connection, however, it should be noted that the connection can be set up in the same way as any network connection, that is using modprobe to load the driver, ifconfig to bring the interface up, etc.

Network tools can thus be used for testing the interface and retrieving debug information.

/proc interface

You can also check the files in /proc/net/irda, especially irlap :

Code: cat /proc/net/irda/irlap
  irlap0 state: LAP_NDM
  device name: irda0, hardware name: usb#2
  caddr: 0x46, saddr: 0xfd6302bc, daddr: 0x00bb1a
  win size: 1, win: 1, line capacity: 960, bytes left: 960
  tx queue len: 0 win queue len: 0 rbusy: FALSE mbusy: FALSE
  retrans: 0 vs: 0 vr: 3 va: 255
  qos   bps     maxtt   dsize   winsize addbofs mintt   ldisc   comp
  tx    9600    0       64      1       12      0       0
  rx    9600    0       64      1       12      0       0

ifconfig

Code: ifconfig
eth0      Link encap:Ethernet  HWaddr 00:50:8D:FB:47:56
          inet addr:84.216.77.76  Bcast:81.227.97.245  Mask:255.255.255.0
          UP BROADCAST NOTRAILERS RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:82689 errors:0 dropped:0 overruns:0 frame:0
          TX packets:72606 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:71041951 (67.7 Mb)  TX bytes:17753384 (16.9 Mb)
          Interrupt:16

irda0     Link encap:IrLAP  HWaddr fd:63:02:bc
          UP RUNNING NOARP  MTU:2048  Metric:1
          RX packets:1906 errors:215 dropped:128 overruns:0 frame:87
          TX packets:14820 errors:0 dropped:0 overruns:0 carrier:0
          collisions:4 txqueuelen:8
          RX bytes:43037 (42.0 Kb)  TX bytes:213617 (208.6 Kb)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:175 errors:0 dropped:0 overruns:0 frame:0
          TX packets:175 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:10812 (10.5 Kb)  TX bytes:10812 (10.5 Kb)

Where to go from here

Well, if you are able to talk to your IR-aware device, you might want to do something with the connection, like setting a net-dialup/ppp (or variants: pppoe or usermode pppoe) or openobex connection for cell phones or PDAs, but this should be the subject for another HOWTO and is beyond this guide.

Debug

What to do if you tried all this and it doesn't work:

BIOS

Reboot and verify your BIOS setting if you have not done it yet. Rebooting will also have the advantage of making sure the drivers are really ready for use after you have compiled and installed them or if you have compiled them into the kernel (in which case you do need to boot into the new kernel. You an then look into dmesg and look for the drivers.

SIR vs. FIR

The SIR (standard infrared) interface is slower (115kbps) than FIR (Fast infrared) (4Mbps), however, you should probably try setting SIR first as it is very much more likely to succeed. There are generic drivers for SIR, which makes it easier. Once SIR works, you can (keep it or) try setting FIR, provided you identify the correct IR chip and know what driver to use.

/dev nodes not created

And then the problem is that in the documentation you can find on the web, the remaining problem is to create a device in /dev which would be called "irda0", issuing the command irattach irda0 -s.

For me, this command never worked, and for what I've read in various forum, it seems I'm not alone in this case. So, here's a way to make it works, using the SIR emulation rather than probably being in FIR mode, is to use the /dev/ircomm device from udev. The speed is certainly lowest but it works. And for phone exchanges, the speed doesn't matter.

However, you should have devices created in /dev, nammed ircomm0 to ircomm30 when ircomm_tty module is loaded (modprobe ircomm_tty). Those ones you can use for communicating with the phone.

Try changing the permissions or file ownership if you don't have the rights to access "ircomm". The default ircomm to use seems to be "ircomm0".

In an application like kmobiletools or gnokii, simply tell to use /dev/ircomm0.

nsc-ircc or irattach does not load the correct driver

I have use the nsc-ircc device driver (on an Acer Aspire laptop) and adding

File: /etc/modprobe.d/aliases
# Use FIR with the nsc-ircc dev driver
alias irda0 nsc-ircc

followed by update-modules should help irattach so that it knows which module to load. Control what it does in syslog and/or dmesg.

See also

Retrieved from "http://www.gentoo-wiki.info/IrDA"

Last modified: Fri, 05 Sep 2008 06:02:00 +0000 Hits: 1,648