3.9. Connecting from Linux to WinCE 3.0 (aka PocketPC)

This chapter is a courtesy of Stanislav Sokolov.

This section covers how to connect a PocketPC device to a Linux box. The information provided in section "Connecting from Linux to WinCE" (found also at CEwindows ) does not apply to PocketPC as Microsoft in one of there brighter moments removed support for direct IrDA connections from version 3.0 of WinCE. I used the document "Linux to Windows CE Connection" (found at The Gadgeteer ) as a starting point, but had to modify and simplify several aspects. This section will go as far as ping between PocketPC and Linux. You should be able to find many networking applications at PDAcentral, CAM or WinCEcity .

Here is the system I used:

On the PocketPC side go to Start -> Settings -> Connection -> Modem. Make a new connection, call it something meaningful (I use Linux-m), choose "Generic IrDA modem", set baud rate to 115200. Tap "Advanced". In "Port Settings" select 8-N-1-Hardware and check "Enter dialing commands manually". This is done so as PocketPC would not try to dial a phone number as we do not want it. The other two boxes should remain unchecked. In TCP/IP select "Use server-assigned IP address" uncheck "Use Slip", but check "Use software compression" and "Use IP header compression". In "name Servers" select "Use server-assigned addresses". Tap "ok" and "Next". You should not be asked for telephone number (if you are, just enter 1 and doublecheck that you actually selected manual dialing commands box in advanced section). Make sure that "Cancel call..." and "Wait for dial tone..." boxes are unchecked. We are now done with the PocketPC part.

On Linux we must first make sure that all the necessary modules are loaded. Here are the modules that were loaded and in use during a successful communication session:

Module                  Size  Used by    Not tainted
ircomm-tty             31040   2
ircomm                 13448   0  [ircomm-tty]
irtty                   7616   2
ppp_async               6688   1
ppp_generic            15740   3  [ppp_async]
slhc                    4592   1  [ppp_generic]
Make sure that ls -la /dev/ircomm* produces a similar output:

crw-------   1 root     root     161,   0 Nov 25 15:09 /dev/ircomm0
crw-r--r--   1 root     root     161,   1 Nov 22 19:30 /dev/ircomm1
Start irattach irattach /dev/ttyS2 -s

Now we have to enable a login terminal on the IrDA port. I used agetty (or your favorite getty variant) for that purpose. Add the following line to your /etc/inittab:

s3:2345:respawn:/sbin/agetty ircomm0 115200 vt100
save the file and activate it by restarting init:

init 2; sleep 3 ; init 3
Also prepare the following shell script that will perform the second phase of connection:

#!/bin/sh
/usr/sbin/pppd -detach noauth local lock 192.168.55.1:192.168.55.2 ircomm0 115200 &

Now the connection itself: Align the IR ports and on the PocketPC go to Start -> Programs -> Connections and tap the connection that you created (Linux-m). In the "Connect To" dialog that shows up leave everything unfilled and just tap on "Connect". "Manual Dialing Terminal" will show up. There you should see the login prompt for your Linux-box (If the login prompt does not show up at once, bring up the virtual keyboard and tap 'enter'). You do not need to login (though it is a bonus - speaking of the ultimate remote controller :)

On the Linux-box execute the pppd command as soon as some "garbage" shows up in the PocketPC's terminal, tap "File" -> "Continue". pppd should come with the following message:

Using interface ppp0
Connect: ppp0 <--> /dev/ircomm0
Cannot determine ethernet address for proxy ARP
local  IP address 192.168.55.1
remote IP address 192.168.55.2
And PocketPC should show a dialog with "Status: Connected". You can run ifconfig to check that ppp0 interface is up and running. ping 192.168.55.2 should produce something like that:

PING 192.168.55.2 (192.168.55.2): 56 data bytes
64 bytes from 192.168.55.2: icmp_seq=0 ttl=32 time=62.5 ms
64 bytes from 192.168.55.2: icmp_seq=1 ttl=32 time=310.0 ms
64 bytes from 192.168.55.2: icmp_seq=2 ttl=32 time=59.9 ms
64 bytes from 192.168.55.2: icmp_seq=3 ttl=32 time=59.8 ms
64 bytes from 192.168.55.2: icmp_seq=4 ttl=32 time=60.0 ms

--- 192.168.55.2 ping statistics ---
5 packets transmitted, 5 packets received, 0% packet loss
round-trip min/avg/max = 59.8/110.4/310.0 ms
RTT will depend on the distance and lighting conditions. When you tap "Disconnect" something like that will show up:

LCP terminated by peer
Modem hangup
Connection terminated.
Connect time 2.6 minutes.
Sent 1336 bytes, received 1274 bytes.

Now, if not all went that well, check the following: