InfraRED

From OESF

Jump to: navigation, search

This !HowTo has been contributed by Gerald J. Normandin Jr. It has been found at: http://www.ruault.com/Zaurus/ppp-IrDA-howto.html

Version 0.1 18/07/2002 by Carlos Vidal

Contents

Introduction

This document is a quick guide on how to setup a ppp connection from the Sharp Zaurus SL-5000D to a Linux laptop with a IrDA port. As you may notice, the document is pretty much a copy of Charles-Edouard Ruault "PPP over USB on Zaurus HOWTO"

This document assumes you're using a kernel 2.4.x.

Setup on the PC side

Most of the recent distributions already have all we need (!RedHat 7.x, !SuSe 8.x, Mandrake 8.x). Otherwise compile the kernel with support for PPP and IrDA (see the corresponding HOWTOs for more details).

Setup on the Zaurus side

Nothing (for ROM 1.13 at least)

Start IrDA on the PC side

If you have !RedHat you do:

 # /etc/rc.d/init.d/irda start

This basically does:

 # /usr/sbin/irattach /dev/ttySx -s

where "ttySx" is the serial device corresponding to your IR eye.

Now you just need to start pppd on the PC ...

 # pppd /dev/ircomm0 noauth PC_IP:ZAURUS_IP

or, if your laptop is on a network you want to open up to the Zaurus:

 # pppd /dev/ircomm0 noauth PC_IP:ZAURUS_IP ktune ms-dns DNS_IP passive

Where ircomm0 is the IrDA communication device, PC_IP the IP assigned to the PPP interface on your PC ( for example 192.168.129.200 ) and ZAURUS_IP is the IP assigned to the PPP interface on the Zaurus ( for example 192.168.129.201 ), and DNS_IP is the address of your DNS server.

 # On the Zaurus : run /etc/rc.d/init.d/irda start
 # and: pppd /dev/ircomm defaultroute usepeerdns

The "defaultroute usepeerdns" are only needed in the second PPP mode.

Looking in /var/log/messages on the PC, you should see something like this:

 pppd: Connect: ppp0 <--> /dev/ircomm0
 pppd: local  IP address PC_IP
 pppd: remote IP address ZAURUS_IP

This means that the connections has been successfully established!

That's it ... now, on your PC try : ping ZAURUS_IP and on the Zaurus try ping PC_IP. If it's successful you made it .... otherwise it's time to start troubleshooting. I would be happy to include all the information you find in this HOWTO, feel free to email me comments/additions and I will update this document.

Misc

In the PC I modified !RedHat '/etc/rc.d/init.d/irda' script to start/stop IrDA and PPP alltogether. The changes are in the the start()|stop() functions as follows:

 start() {
   # Attach irda device
   echo -n $"Starting $prog: "
   daemon /usr/sbin/irattach ${DEVICE} ${ARGS}
   echo
   if [ ! -z "${LOCAL_IP}" ]; then
     echo -n $"Listen for PPP over IrDA:"

sleep 5

     daemon pppd /dev/ircomm0 noauth ${LOCAL_IP}:${REMOTE_IP} \
         proxyarp ktune ms-dns ${DNS_IP} passive persist holdoff 10
     touch /var/lock/subsys/irda
   fi
   echo
 }
 stop() {
   # Stop service.
   if [ ! -z "${LOCAL_IP}" ]; then
     echo -n $"Shutting down PPP: "  
     killproc pppd
     echo
   fi
   echo -n $"Shutting down $prog: "
   killproc irattach
   rm -f /var/lock/subsys/irda
   echo 
 }

In the file /etc/sysconfig/irda I defined the variables LOCAL_IP, REMOTE_IP and DNS_IP like:

 IRDA=yes
 DEVICE=/dev/ttyS1
 DISCOVERY=yes
 LOCAL_IP=192.168.129.200
 REMOTE_IP=192.168.129.201
 DNS_IP=192.168.10.1

Then I activated IrDA permanently in the PC with "chkconfig irda on"

In the Zaurus I wrote the following script to bring the IrDA connection up and down:

 #!/bin/sh
 #
 # Script "ir start|stop"
 case "$1" in
   start)
     /etc/rc.d/init.d/irda start
 	  echo "Wait for IR discovery"
          sleep 10
     pppd /dev/ircomm defaultroute usepeerdns
     echo "IrDA started"
     ;;
   stop)
     killall pppd
     /etc/rc.d/init.d/irda stop
     echo "IrDA stopped"
     ;;
   *)
     echo "Usage: $0 {start|stop}"
     ;;
 esac

With these tools, once the laptop is running, I just put the Zaurus facing the IR eye and type ./ir start in it. As I installed openssh and KOrganizer in the Zaurus I have a couple of scripts that automatically synchronize my KOrganizer using scp. Next step will be to use FIR and synchronize the address book! :-).

Personal tools