BluetoothGprs

= Opie 1.1.9 - Bluetooth - GPRS by Gints =

This HowTo explains how to connect to the internet using your mobile phone and GPRS. The connection from the PDA to the mobile phone will be established via bluetooth. I'm using an iPAQ 3970 with Familiar v.0.8.1 and Opie 1.1.9.

As you install Familiar v.0.8.1, Bluetooth has been bundle with. So there no need additional package to be installed. (except you need bluetooth icon to display at task bar or opie bluetooth manager to manage with bluetooth)

1. Make pin code
echo "1324" > /etc/bluetooth/pin

2. Make executable file for givepin:
echo '#!/bin/sh' > /etc/bluetooth/givepin echo 'echo "PIN:1324"' >> /etc/bluetooth/givepin

3. Set it as executable:
chmod +x /etc/bluetooth/givepin

4. Modify /etc/bluetooth/hcid.conf.
Insert line pin_helper /etc/bluetooth/givepin; and comment at dbus_pin_helps;

# PIN helper # pin_helper /usr/bin/bluepin; pin_helper /etc/bluetooth/givepin; # D-Bus PIN helper #dbus_pin_helper;

5. Start bluetooth to see Other Bluetooth address.
killall hciattach hciattach /dev/tts/1 bcsp 921600 hciconfig hci0 up hcitool scan

You may see the result as

root@h3900:~# hcitool scan Scanning ... 00:02:EE:D7:E4:11      Nokia 6820 root@h3900:~# Note: Address 00:02:EE:D7:E4:11 will be used for rfcomm.

6. Make rfcomm file to show your phone address and other connections if you have such with serial..
root@h3900:~# cat /etc/bluetooth/rfcomm.conf rfcomm0 { # Automatically bind the device at startup bind yes; # Bluetooth address of the device (here goes mobile phone address) device 00:02:EE:D7:E4:11; # RFCOMM channel for the connection channel 1; # Description of the connection comment "My Nokia 6820"; } rfcomm1 { bind yes; device 00:00:00:00:00:00; channel 2; comment "My desktop for serial connection"; }

7. Restart Bluetooth
killall hciattach /etc/init.d/bluetooth stop /etc/init.d/bluetooth start

8. For network connections to other bluetooth device
you can use such script:

killall hciattach hciattach /dev/tts/1 bcsp 921600 hciconfig hci0 up rfcomm bind all pand --listen GW pand --connect 00:00:00:00:00:00
 * 1) !/bin/sh
 * 2) Reenable bluetooth
 * 1) bind all coms if defined
 * 1) allow bluetooth network connections
 * 1) connect to your favorite device (give your device address here)

9. use (below) part 3 of this wiki "3. Set up GPRS-connection"
to configure you new bluetooth GPRS modem...

That's it.

Thank you very much to Gints Polis! / Chan 2005-03-02

= Opie - Bluetooth - GPRS Older Released =

This HowTo explains how to connect to the internet using your mobile phone and GPRS. The connection from the PDA to the mobile phone will be established via bluetooth. I'm using an iPAQ 3870 with Familiar 0.7 and Opie 1.0, but the procedure should be the same for OpenZaurus.

1. Get Bluetooth up and running
First of all, you need to get bluetooth set up. I recommend using BlueZ, the official Linux bluetooth stack. On Familiar you would do:


 * 1) ipkg install bluetooth-modules
 * 2) ipkg install bluez-utils
 * 3) ipkg install bluez-sdp
 * 4) ipkg install opie-bluepin

Now install the bluetooth applet for Opie. The bluetooth-manager is not yet usable as of Opie 1.0, so we will need to do some stuff on the command line.


 * 1) ipkg install opie-bluetoothapplet

You should now be able to enable bluetooth by tapping the applet-icon (next to the clock). Ensure that bluetooth is up by typing:

hci0:  Type: UART BD Address: 00:02:C7:0C:C5:E6 ACL MTU: 128:8 SCO MTU: 64:8 UP RUNNING PSCAN ISCAN RX bytes:270 acl:0 sco:0 events:13 errors:0 TX bytes:446 acl:0 sco:0 commands:12 errors:0
 * 1) hciconfig

If the interface is marked as down this means hcid is not running:

hci0:  Type: UART BD Address: 00:00:00:00:00:00 ACL MTU: 0:0 SCO MTU: 0:0 DOWN RX bytes:12 acl:0 sco:0 events:0 errors:0 TX bytes:6 acl:0 sco:0 commands:0 errors:0

If there's no output at all, bluetooth apparently could not be enabled. Make sure that your  contains the following lines:

alias net-pf-31 bluez alias bt-proto-0 l2cap alias bt-proto-2 sco alias bt-proto-3 rfcomm alias bt-proto-4 bnep alias tty-ldisc-15 hci_uart alias char-major-10-250 hci_vhci

Then try again. I encountered this problem on OpenZaurus 3.2, even " " did not work before adding these lines.

hcid should be started automatically by an init script, but for now start it by hand:


 * 1) /etc/init.d/hcid start

If hciconfig prints no output at all, the bluetooth adapter could not be enabled. This can have several reasons, so please contact me for further assistance. Also try logread to get information on what went wrong.

2. Establish connection to mobile phone
Now that bluetooth is working, you need to set up the connection to the phone. This is done via RFCOMM, a protocol that emulates a serial connection via Bluetooth. To applications, a RFCOMM link will look just like a real serial port.

Although I do not recommend using Bluetooth without encryption, you should disable it for now. If anything else works, you can try to enable it later. Edit  to look like this (I removed some comments):

options { # Automatically initialize new devices autoinit yes;
 * 1) HCId options

# Security Manager mode security auto;

# Pairing mode pairing multi;

# PIN helper pin_helper /opt/QtPalmtop/bin/bluepin; }

device { # Local device name name "iPAQ";
 * 1) Default settings for HCI devices

# Local device class class 0x114;

# Default packet type #pkt_type DH1,DM1,HV1;

# Inquiry and Page scan iscan enable;pscan enable;

# Default link mode lm accept;

# Default link policy lp hold,sniff,park,rswitch;

# Authentication and Encryption auth disable; encrypt disable; }

Now set your default PIN in the file. Only use numbers, so that you can enter the PIN on the mobile phone later.

Now kill all running instances of hcid (there should only be one):

hcid: no process killed
 * 1) killall hcid
 * 2) killall hcid

(I start killall two times to make sure hcid is really gone... :) Now start hcid again.

Now it's time to do the interesting stuff. We need to know the bluetooth address of the mobile phone, so we start a scan for all devices in range (make sure your mobile phone has bluetooth enabled):

Scanning ... 00:60:57:79:F9:E7      Nokia 6310i
 * 1) hcitool scan

To check if we can "talk" to the phone, you can ping it just like you would do it for network hosts:

Ping: 00:60:57:79:F9:E7 from 00:02:C7:0C:A2:A6 (data size 20) ... 0 bytes from 00:60:57:79:F9:E7 id 200 time 43.62ms 0 bytes from 00:60:57:79:F9:E7 id 201 time 34.36ms 0 bytes from 00:60:57:79:F9:E7 id 202 time 30.70ms 0 bytes from 00:60:57:79:F9:E7 id 203 time 38.12ms [Ctrl+C] 4 sent, 4 received, 0% loss
 * 1) l2ping 00:60:57:79:F9:E7

If you cannot ping the phone although the output of  shows it, you might need to bind / pair the PDA and phone. This procedure differs depending on your mobile phone. The T68 for instance offers an option to search for devices and then bind them.

A bluetooth device usually offers several services, so we need a list to pick the dial-up networking.

Browsing 00:60:57:79:F9:E7 ...
 * 1) sdptool browse 00:60:57:79:F9:E7

A list of all services the phone offers appears. One of them should be something like the following:

Service Name: Dial-up networking Service RecHandle: 0x10002 Service Class ID List: "Dialup Networking" (0x1103) "Generic Networking" (0x1201) Protocol Descriptor List: "L2CAP" (0x0100) "RFCOMM" (0x0003) Channel: 1 Language Base Attr List: code_ISO639: 0x656e encoding:   0x6a base_offset: 0x100 Profile Descriptor List: "Dialup Networking" (0x1103) Version: 0x0100

The "Protocol Descriptor List" is the interesting part. It tells us that this service can be reached via RFCOMM on channel 1. There are several channels possible for entirely different services, so be sure to pick the right one.

With this information, we can modify :

rfcomm0 { # Automatically bind the device at startup bind yes;

# Bluetooth address of the device device 00:60:57:79:F9:E7;

# RFCOMM channel for the connection channel 1;

# Description of the connection comment "6310i"; }

You can have several rfcommX-Blocks for different bluetooth devices and/or services. Save the file and put your changes into effect by:


 * 1) rfcomm bind all

Add this line to an init script so the bindings are set up automatically on reboot. To see a list of all rfcomm-bindings and their status, you can at any time do:

rfcomm0: 00:60:57:79:F9:E7 channel 1 closed
 * 1) rfcomm

As soon as an application opens rfcomm0, the bluetooth connection will be established. This means that you won't need to connect by hand, the bluetooth stack handles this transparently for you.

Test the rfcomm-connection by opening :


 * 1) cat /dev/bluetooth/rfcomm/0

The mobile phone should somehow indicate that a connection has been established (at least the Nokia 6310i does). cat will not output anything nor return, so you need to terminate it by pressing Ctrl+C.

3. Set up GPRS-connection
Install the networksettings and the PPP plugin:


 * 1) ipkg install opie-networksettings
 * 2) ipkg install opie-networksettingsplugin-kppp

Congratulations, from now on you can do everything via the graphical user interface. Start Network from the Settings tab and tap Add. Select PPP from the list and tap Add once again. Add a new account and enter  as the number to dial:



All other fields can be left as they are (at least this worked for the German providers D2 Vodafone and O2). You also need to add a new device and name the correct rfcomm device (for me it's ).



Tap Modem Commands as you need to modify them for a GPRS connection. Initialization string 2 is specific to your GPRS provider. It basically contains the APN which is the Access Point Name. In the table below you can find the settings for some common providers.



All other options can be left as they are.

If you want to use a GSM connection instead of GPRS, you need to leave Initialization string 2 empty and enter the following information into the appropriate fields:

Feel free to add your GSM and/or HSCSD settings to the table.

To check whether the modem (your mobile phone) is reachable, you can tap the Query Modem button. It gathers some information from the phone (without establishing a GPRS connection):



If you cannot query the modem although it is reachable (and you can do a l2ping), you might need to bind / pair the PDA and phone. This procedure differs depending on your mobile phone. The T68 for instance offers an option to search for devices and then bind them.

Accept your changes by tapping OK. Your list of network devices should now include the GPRS connection.





All you should need to do to establish the GPRS connection is:


 * 1) Enable bluetooth using the applet
 * 2) Start dialling via networksettings

In case of problems, don't hesitate to contact me at fut at gmx dot net with as much information as possible.