Handhelds.org - Open source for handheld devices

UserPreferences

IrDA


IrDA

Connecting your iPAQ to your mobile phone's IrDA port (and connecting to the Internet). (Only works if your operator supports data calls)

This document describes how to get your iPAQ to use your mobile phone to dial up your ISP. If you're looking for how to use your mobile phone as a GPRS modem, refer to the GPRS guide.

Note: Refer to further down for help relevant to the H39xx iPAQs. Also, this information may be a little out of date.

My setup:

First of all, check you have the necessary kernel modules installed:

sh-2.03# modprobe ircomm-tty 
sh-2.03# modprobe irtty 

Then double check what you have:

sh-2.03# lsmod |grep ir
irtty                   8976   2 
ircomm-tty             35952   0 
ircomm                 16288   0  [ircomm-tty] 
irda                  165328   1  [irtty ircomm-tty ircomm]

If you don't get that then go get the modules using ipkg:

sh-2.03# ipkg list | grep irda
irda-common - IrDA management utilities
irda-modules-2.4.3-rmk2-np1 - IrDA kernel modules

Then install them (substituting the version of irda-modules that is shown in your list):

sh-2.03# ipkg install irda-common irda-modules-2.4.3-rmk2-np1

There is a bug in the kernel that comes with Familiar 0.4 (2.4.3) and the IrDA port won't work after the iPAQ has sleeped. So if your iPAQ has been sleeping reboot it now. (Or upgrade your kernel to 2.4.6 or above I believe - but haven't tried).

Jiri Svoboda advises that you can fix this by "(re)loading sa1100_ir.o module (probably reinitializes controller). it can be unloaded immediately again (thanx to Ales Koval for hint)". I haven't got this to work yet. My interpretation of "(re)loading" is to do this:

rmmod sa1100_ir
modprobe sa1100_ir
Until 0.5 arrives I'll continue to reboot :(

Jiri Svoboda goes on to say that the "irattach process must be killed before deep sleep, otherwise iPAQ will be frozen after "wake up" (at least my system is)" I haven't noticed that either but it's worth mentioning.

Now you can check to see if your iPAQ thinks it has an IrDA port:

sh-2.03# cat /proc/sys/net/irda/discovery
1

The "1" indicates that it thinks it does. This is Good.

Now, enable the IrDA port on your phone and line them up (direction is more important than distance here). Your iPAQ should discover the phone. Try this:

sh-2.03# cat /proc/net/irda/discovery
IrLMP: Discover log:

nickname: Nokia 6210, hint: 0xb125, saddr: 0x931adf95, daddr: 0x28610000

Florian Zimmermann (flo@0x17.org) had no luck with discovering his Siemens S35 by IrDA. The solution was to not use irattach, but irlan:

#!/bin/sh
echo 1 >/proc/sys/net/irda/discovery
modprobe irlan
ifconfig irda0 up
sleep 2
cat /proc/net/irda/discovery
This way it got correctly discovered and worked ;-)

Now we're ready to start writing the script to connect the two together. This comes straight from Tor-Åke Fransson's site (with a few uncritical modifications and comments by me). I've put mine at /usr/local/bin/irdappp:

#!/bin/sh

# Read in user and password from stdin. 
# If you want to be less security conscious 
# and hard code them here then you can.
echo -n user:
read PPPUSERNAME
echo -n password:
read PPPPASSWORD

# We might already have these loaded but 
# it does no harm to double check
modprobe ircomm-tty
modprobe irtty
modprobe sa1100_ir  # needed this one as well -Kero

# Confirm that everything is OK
lsmod | grep ir

# Run the irattach program that is bundled with Familiar 0.4
irattach /dev/ttySA2 -s &
# I needed this instead -Kero
# irattach irda0   # where irda0 is aliased to sa1100_ir in /etc/modules.conf

# Create the pap-secrets file on the fly (for more security)
echo $PPPUSERNAME' * '$PPPPASSWORD > /etc/ppp/pap-secrets 
pppd /dev/ircomm0 115200 \
defaultroute usepeerdns \
nocrtscts noauth local lock \
connect 'chat -f /etc/ppp/chatfile' \
user $PPPUSERNAME & 

# wait for a connection
sleep 15

# Show the details
ifconfig | grep -A 6 ppp

# Wait a bit more before we remove the pap-secrets file
sleep 15 
rm /etc/ppp/pap-secrets # remove the file containing your password

And you need to make sure your /etc/nsswitch.conf contains something like:

passwd:   files
group:    files 
hosts:    files dns
networks: files
rpc:      files
netmasks: files
...

Note that nsswitch.conf may contain some more information. That's okay. You probably won't need to modify this file anyway.

If you haven't setup /etc/resolv.conf on your iPAQ you could maybe make use of one that is created during the connection ( option usepeerdns ). In which case you should do this:

sh-2.03# ln -s /etc/ppp/resolv.conf /etc/resolv.conf
And you need a chat script. This is one that will work with an ISP providing PAP. You should save it to the same place mentioned in the script above - /etc/ppp/chatfile :
ABORT "BUSY"
"" "\d"
"" "ate1"
"" "atz"
OK "atdt???????"
CONNECT
The ??????? to be replaced by the number of your ISP.

Now connect to your ISP! Make sure your iPAQ hasn't been asleep since the last reboot. Line up the phone. Enable the IrDA port on your phone. Run the irdappp script. Good luck.

Bill Horsman 22 August 2001

(With thanks to Tor-Åke Fransson and Richard Bland)

2003-Nov-03 - marciowb: If the script above doesn't works (not connection...) you can try the following chatfile. Place it on /etc/ppp/chatfile

ABORT "BUSY"
"" "\d"
"" "atv1"
"" "atz"
OK "atdt???????"
CONNECT

W00T! That's so damn cool. I just got my old Nokia 9000 connecting to my ISP and could surf the net :)

I got this working directly over the serial port to my cellular phone with some minor changes. (3/7/2002)

I changed the pppd call in the above irdappp script to look like: pppd /dev/ttySA0 19200

and needed to change my /etc/ppp/cell/chatfile

TIMEOUT 3
ABORT "BUSY"
"" "\d"
"" "atz"
TIMEOUT 30
OK "atdt???????"
CONNECT

I also needed to put the domainname and nameservers into my resolv.conf file. Beyond that, I had to play a bunch of games to rearrange my proxy settings inside that irdappp (which I called cellppp) like:

/bin/rm -f $HOME/.wgetrc && ln -s $HOME/.wgetrc-noproxy $HOME/.wgetrc
/bin/rm -f $HOME/.dillo/dillorc && ln -s $HOME/.dillo/dillorc-noproxy $HOME/.dillo/dillorc
if [ -f /etc/ppp/options ]; then /bin/rm /etc/ppp/options; fi
if [ -f /etc/ppp/pap-secrets ]; then /bin/rm /etc/ppp/pap-secrets; fi
if [ ! -f /etc/ppp/chatfile ]; then ln -s /etc/ppp/cell/chatfile /etc/ppp/chatfile; fi
if [ ! -f /etc/ppp/resolv.conf ]; then ln -s /etc/ppp/cell/resolv.conf /etc/ppp/resolv.conf; fi
if [ ! -f /etc/resolv.conf ]; then ln -s /etc/ppp/resolv.conf /etc/resolv.conf; fi

You get the picture. It works, but it's sloooooow.

NB: If you want to make GPRS connections, you may also want to look at

http://handhelds.org/pipermail/opie/2002-June/001276.html and http://turtiainen.dna.fi/GPRS-HOWTO

(please feel free to refactor these links somewhere more appropriate)

I've just managed to beam something to my friend's palm for the first time, which is great. Very similar to the above instructions, but you also need the openobex package from familiar. You need to run:

modprobe ircomm-tty
modprobe irtty
irattach /dev/ircomm
echo 1 > /proc/sys/net/irda/discovery

Then point the devices at each other, and run these commands:

cat /proc/net/irda/discovery to see if they've found each other.
irobex_palm3 test.txt will send the file to the palm

-AndrewBirkett

Nice, this also worked with my Siemens S45i, the test file shows up in the FlexMem there. ColinMarquardt, 2003-04-30

I have this working with an iPAQ 3850, Familiar 0.6.1, talking to a Nokia 8390 with gammu 067 (http://www.mwiacek.com/english/gsm/gammu/gammu.html). I compiled gammu like so:

./configure --host=arm-linux
make

This sets up IrDA:

modprobe ircomm-tty
modprobe irtty
modprobe sa1100_ir
rmmod sa1100_ir
modprobe irlan
echo 1 > /proc/sys/net/irda/discovery
ifconfig irda0 up

Enable IR on the phone and point it at the iPAQ's head. You can use minicom on /dev/ircomm0 at 115200 bps to talk to the phone with AT commands, or use this .gammurc:

[gammu]
port = /dev/ircomm0
connection = at115200

I had to add the 8390's model number into the gammu source, but hopefully that patch'll end up in the mainline.

MichaelSmith

IrDA on H39xx

The above does not work on an H3970 running Familiar 0.7. Thanks to Philip Blundell for the following instructions. Run these commands:

modprobe pxa_ir
ifconfig irda0 up
echo 1 > /proc/sys/net/irda/discovery

Then, line up your other IrDA device (in my case, a Nokia 6210), enable IR on the device, wait for about 2 seconds, and then run this command to see if it worked:

cat /proc/net/irda/discovery

You should see an entry for the device in the list.

PaulEggleton, 20030824

ConsumerIR

Opie

If you use Opie, all you need to do is make sure you have the pxa_ir (or presumably sa1100_ir on older devices) module loaded and then you can use the IrDA applet to control IrDA functions. In fact, on recent versions of Familiar, IrDA now works out of the box (at least it does on the H3970). - PaulEggleton