Configuring IrDA with a laptop and a T610

Laptop: Acer TravelMate 730TE
Phone: SonyEricsson T610
Operating system: Debian GNU/Linux (sid)

First, look at the Infrared-HOWTO to get detailed instructions to get IrDA working: basically you should compile the support in the kernel (preferably as a module) and install the needed packages (irda-utils, etc.)

Keep in mind that this document depends very heavily on my hardware setup: your controller may be very different and may require a different approach (SIR and not FIR, serial or USB dongles, etc.)

Some sections are very Debian-specific: if you use another distribuition, try to adapt the istructions to fit your needs.

Disable the shared serial port

To use the internal controller, it is likely that you should disable a serial port: on many laptop there is only a single serial connector, but the serial controller configures two serial ports, so it is possible to disable the second one (which is not very useful anyway).

To do so, log in as root and launch:

# setserial /dev/ttyS1 uart none

If you want to keep this setting across reboots, add it to your /etc/serial.conf see the manpages for setserial for more info).

Discover the controller chip

Then, still as root, find out what kind of controller chip you have with the following command:

# findchip -v

On my laptop the output looks like this:

Found NSC PC87338 Controller at 0x2e, DevID=0x0b, Rev. 2
   SIR Base 0x2f8, FIR Base 0x2f8
   IRQ = 3, DMA = 3
   Enabled: yes, Suspended: no
   UART compatible: yes
   Half duplex delay = 0 us

Configure the kernel modules

As it is a NSC PC87338 chip it needs the nsc-ircc kernel driver.

You have to tell the system that, if you want IrDA and you have a modular kernel, this is the module to load. To do so on a Debian system, edit /etc/modutils/irda and add the following line:

alias irda0 nsc-ircc

Now you can run this command to update the configuration:

# update-modules

If everything is ok it should be possible to load the correct module with this command:

# modprobe irda0

Connect the serial port to the IrDA stack

To get IrDA to a functional state, you shoud connect the IrDA stack to the serial port you have disabled before:

# irattach irda0 -s 1

Check if everything works

Now enable IrDA in the phone and put it in front of the transceiver on the laptop. If everything is working properly you should see your phone from the computer with this command:

# irdadump

The output on my notebook is this:

21:46:17.594217 xid:cmd e2354e76 > ffffffff S=6 s=0 (14)
21:46:17.684223 xid:cmd e2354e76 > ffffffff S=6 s=1 (14)
21:46:17.774223 xid:cmd e2354e76 > ffffffff S=6 s=2 (14)
21:46:17.864223 xid:cmd e2354e76 > ffffffff S=6 s=3 (14)
21:46:17.945045 xid:rsp e2354e76 < 41ba5208 S=6 s=3 T610 series hint=9124 [ PnP Modem IrCOMM IrOBEX ] (28)
21:46:17.954222 xid:cmd e2354e76 > ffffffff S=6 s=4 (14)
21:46:18.044228 xid:cmd e2354e76 > ffffffff S=6 s=5 (14)
21:46:18.134236 xid:cmd e2354e76 > ffffffff S=6 s=* abulafia hint=0400 [ Computer ] (24)

Note especially the line containing the string "T610 series", indicating a reply from the phone to the broadcast query sent by the computer.

It is also possible to use the following command to "ping" the IrDA device:

# irdaping `grep daddr /proc/net/irda/discovery|sed s/.*daddr://`

Beware that it works only if there is only one IrDA device.

Enabling IrDA across reboots

On a Debian system you can put the following text in your /etc/irda.conf:

# set IRDA device
IRDADEV=irda0

# set DONGLE type
#DONGLE=<type>

# enable DISCOVERY mode (-s)
DISCOVERY=-s

# set ENABLE to 'no' if you do not need to start irattach 
# (FIR)
ENABLE=yes

Workaround the T610 bugs

Now with the openobex utils it should be possible to upload and push images and files between your computer and phone.

If you try to connect to the T610 using the IrDA serial emulation (/dev/ircomm0) with a terminal software (minicom or gtkterm) the phone doesn't seem to respond.

After searching a little on the net I've found that is necessary to add a workaround to get it working:

# echo 1 > /proc/sys/net/irda/max_tx_window

On a Debian system it is possible to put it in a executable script in the /etc/init.d/ directory (I've called it irda-T610) and having it executed at every boot with the command:

# update-rc.d irda-T610 defaults 46

Now it should be possible to connect to the phone using the standard AT GSM commands, for example getting information about the phone using the gsmlib utils:

# gsmctl -d /dev/ircomm0 ALL