Using a Windows Mobile phone to connect to the internet

Posted by George Wright Wed, 22 Nov 2006 01:31:00 GMT

As some of you may know, I have a Windows Mobile 5 based phone. It’s possibly got the worst software I’ve ever used in my life but the hardware’s really nice so I put up with it.

One of the major things I use the phone for is as a modem for Linux because I have an (effectively) unlimited data tarriff on my contract, so being able to use it with my laptop is incredibly useful.

Previously, I have been using the USB cable and using wvdial to treat the phone as a dial up modem to connect to the internet. This wasn’t without complications as Windows Mobile seems to require an initialisation string which no other phone uses. This is:

AT+CGDCONT=1,"IP","APN",""

Where ‘APN’ is the access point name for your data carrier. In my case (T-Mobile), it’s “general.t-mobile.uk”.

To connect via USB though, you first need to load the appropriate module to give you a serial interface (/dev/ttyUSB0) to communicate through. You’d think this was as simple as running ”modprobe ipaq”, but no - it’s more complicated.

First you have to modprobe ipaq then run lsusb -v. You then need to look up your phone’s entry and record the hex numbers for the vendorID and the productID then rmmod ipaq and load it again passing those identification numbers as parameters to the module, so in my case:

modprobe ipaq vendor=0x0bb4 product=0x00cf

This will then give you /dev/ttyUSB0 to play with. However, it’s still isn’t that simple from here. You need one more fiddle to get it working. You need to set “Stupid Mode” in wvdial to force pppd to start as soon as the modem connects. Thus, the final wvdial.conf is as follows:

[Dialer Defaults]
Modem = /dev/ttyUSB0
Baud = 115200
Init = AT+CGDCONT=1,"IP","APN",""
Phone = *99#
Username = USERNAME
Password = PASSWORD
New PPPD = yes
Stupid Mode = yes

So, after setting up Linux you just need to run the “Wireless Modem” program on the phone and start the softmodem.

Unfortunately, trying to get it to connect via bluetooth appears to be infinitely more difficult. Luckily, I finally managed to get it to connect today after a few hours of research and fiddling, and it now seems rather trivial.

Firstly, Edgy’s bluez packages appear to be sufficiently broken that it doesn’t bring up the bluetooth adapter in discoverable mode - thus resulting in severe breakage when trying to connect the phone. This is fixed by running the command:

hciconfig hci0 piscan

You then need to fiddle some values in /etc/bluetooth/hcid.conf to allow the phone to pair.

I set a default passkey using the passkey "xyz"; option in hcid.conf as I couldn’t be bothered to set up a helper application. However, it should work just fine if you do set up a helper application. That’s basically all that needs to be altered.

Now onto the phone.

Going into Settings -> Connections -> Bluetooth, make sure the phone is discoverable and pair it with the computer. Once it’s paired, the Linux box’s ID should appear in the list on the “Devices” tab. You then just need to go into the “Internet Connection Sharing” program and start the connection using “Bluetooth PAN”. Once that’s done, it’s fairly trivial. On the computer, run the command:

pand --connect BADDR -n

Where “BADDR” is the 6-element bluetooth address of your phone, which can be obtained using the command hcitool scan. After that, it should splurt out something like:

pand[8361]: Bluetooth PAN daemon version 3.7
pand[8361]: Connecting to BADDR
pand[8361]: bnep0 connected

This means that pand has brought up a new ethernet interface called bnep0 for you to play with. After this, it’s just standard networking. Run a dhcp client on bnep0 and it will give you an IP address and NAT you across to the phone.

Hooray - the phone is connected via bluetooth to the internet. I still haven’t worked out how to get it to act as an actual modem over bluetooth (taking AT commands etc), but to be honest, I fail to see any point if we have Bluetooth PAN instead.

Posted in ,  | 10 comments

Comments

  1. caveman said about 18 hours later:

    AT+CGDCONT=1,”IP”,”APN”,””

    isn’t a windows mobile thing is a GPRS/EDGE thing, you would need to do the same thing with a pcmcia card.

  2. frederick said about 1 month later:

    Hi, am trying to connect my laptop to the internet through my mobile phone. but it only gives me 30mbps speed. instead of 100mbps to allow my laptop to work. Thanks for your help.

    Frederick.

  3. Henry said 2 months later:

    Hi, I’ve tried what you suggested, without the bluetooth as I am using a docking station, but cannot come right. It connects to the point where it retrieves the local IP, remote IP and DNS servers. It then just seems to sit and wait?!? The device itselfs still says “Connecting…”. Also my APN does not require a username and password. When leaving this blank wvdial complains. Any ideas?

    Thanks.

  4. Enrico said 5 months later:

    I’ve tried ypur config but it’s wasn’t possibile to use the ipaq as a mode. I’ve added thees line to the wvdial config

    [Dialer Defaults] Modem = /dev/ttyUSB0 Baud = 115200 Init1 = ATZ Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 Init3 = AT+CGDCONT=1,”IP”,”APN” Phone = *99# Username=” Password=” Stupid mode = yes

    and now it works.

    Tankyou for this post , it was a good starting place.

  5. Nathan said 6 months later:

    Thanks for sharing your experience with the BT PAN connection! I’d spent a lot of time before reading of the simple but effective way of doing it.

  6. e.sjamal@gmail.com said 8 months later:

    hiiiii: my name is Samer and ealy i’m trying to get or control the mobile throw internet .. i mean i have a mobile phone so far from me and i want to control it the PC->Internet->NMS->pSTn .. or i don’t know who .. so can u give me help please .. thanks alot.

  7. orbistertius said 8 months later:

    Hello, I’ve just found out that you can do a similar thing over the USB connection.

    You need a recent RNDIS linux kernel driver (see this page in the SynCE wiki).

    Once you have the modules loaded:

    1. edit /etc/network/interfaces adding this line:
            iface rndis0 inet dhcp
      (this might be Debian / Ubuntu specific but other distros shouldn’t differ much)
    2. connect handheld and linux machine with the USB cable;
    3. go to Internet connection sharing on the handheld, choose USB for the PC connection and click “Connect”;
    4. on the linux machine, run (as root or with sudo) ifup rndis0

    That’s it. The device should give your rndis0 interface an IP address and the default route, and populate /etc/resolv.conf with the IP address of the nameserver.

  8. orbistertius said 8 months later:

    Hello, I’ve just found out that you can do a similar thing over the USB connection.

    You need a recent RNDIS linux kernel driver (see this page in the SynCE wiki).

    Once you have the modules loaded:

    1. edit /etc/network/interfaces adding this line:
            iface rndis0 inet dhcp
      (this might be Debian / Ubuntu specific but other distros shouldn’t differ much)
    2. connect handheld and linux machine with the USB cable;
    3. go to Internet connection sharing on the handheld, choose USB for the PC connection and click “Connect”;
    4. on the linux machine, run (as root or with sudo) ifup rndis0

    That’s it. The device should give your rndis0 interface an IP address and the default route, and populate /etc/resolv.conf with the IP address of the nameserver.

  9. barry wheeler said about 1 year later:

    how can i conect my windows live telephone having trouble

  10. musakahmad@rocketmail.com said about 1 year later:

    i want to connect mobile phone with internet , phone model no nokia N95 china product.my phone number is 08072585977 or 08084367008.

(leave url/email »)

   Comment Markup Help Preview comment