This Howto will describe, how to set up a GPRS Internet connection using bluetooth device and compatible mobile phone.

This Howto will describe, how to set up a GPRS Internet connection using bluetooth device and compatible mobile phone.

Line 35:

Line 36:

Version: 0x0100

Version: 0x0100

</pre>Now check the line beginning with "Channel:" - it contains the channel which is used for Dial-Up Network and it is <strong>not necessarily</strong> 1 and so is the case with my Nokia N70; my phone uses channel 3. Check also that you are reading the right results; the bluetooth hardware address must match your phone's.</li>

</pre>Now check the line beginning with "Channel:" - it contains the channel which is used for Dial-Up Network and it is <strong>not necessarily</strong> 1 and so is the case with my Nokia N70; my phone uses channel 3. Check also that you are reading the right results; the bluetooth hardware address must match your phone's.</li>

−

<li>Next, edit /etc/bluetooth/hcid.conf . Set the following in options section: <pre>autoinit yes;

−

security auto;</pre> Editing the same file, comment out passkey, as it is not used actually. Also, in the device section change

−

the line beginning with name to: <pre>name "BlueZ (%h)";</pre></li>

<li>Now edit /etc/bluetooth/rfcomm.conf , first uncomment the rfcomm0 device section. Then add/change the lines as this (if necessary): <pre>bind yes;

<li>Now edit /etc/bluetooth/rfcomm.conf , first uncomment the rfcomm0 device section. Then add/change the lines as this (if necessary): <pre>bind yes;

device 00:19:79:89:13:8E;

device 00:19:79:89:13:8E;

channel 3;

channel 3;

comment "GPRS dialup";</pre>Of course, you should use your device address and the appropriate channel.</li>

comment "GPRS dialup";</pre>Of course, you should use your device address and the appropriate channel.</li>

−

<li>Edit the bluetooth script in /etc/rc.d/bluetooth to make the rfcomm start when bluetooth system is started: <pre>RFCOMM_ENABLE="true"</pre></li>

+

<li>Edit the bluetooth conf file in /etc/conf.d to make the rfcomm start when bluetooth system is started: <pre>

<li>Look, whether the bluetooth device is bound to the phone. It should look like this: <pre>ll /dev/rfcomm0

+

<li>Look, whether the bluetooth device is bound to the phone. It should look like this: <pre>ls -l /dev/rfcomm0

crw-rw---- 1 root tty 216, 0 2007-08-10 21:32 /dev/rfcomm0</pre></li>

crw-rw---- 1 root tty 216, 0 2007-08-10 21:32 /dev/rfcomm0</pre></li>

−

<li>Now comes the interesting part. You see, there must be an agreed password for connecting to the phone's modem. And this password is set up in an awkward way. First decide a password. Then open another root console, type there (substitute your phone's hardware address and password accordingly) <pre>passkey-agent 8922 00:19:79:89:13:8E</pre> , but don't press enter yet. On another root window, issue

+

<li>Now comes the interesting part. You see, there must be an agreed password for connecting to the phone's modem. This password is set up in the following way: Open up another root terminal and execute <pre>bluez-simple-agent</pre> (if there is an error concerning a .service file, just stop bluetoothd, restart dbus and start bluetooth again). This should give you a message saying the device is ready, do not do anything else here for now, but go to the first terminal and type in <pre>cat /dev/rfcomm0</pre> and press Return. Shortly after the phone should be asking for a code for pairing with the computer. Use whatever code you wish on the phone. Then in the bluez-simple-agent a prompt appears asking for this code. After you have entered it and cofirmed via Return you can CTRL-c it and close the terminal. The phone is now paired with the computer.</li>

−

<pre>cat /dev/rfcomm0</pre> and immediately after that execute the typed passkey-agent command in other window. Situation is like this http://asuka.fi/u/jpaalija/tmp/catting_passkey-agent_ready.png The phone should now show something like this: http://asuka.fi/u/jpaalija/tmp/passcode_dialog.jpg . Quickly, enter the passcode and press "Ok". If the passkey-agent prints something like <pre>Passkey request for device 00:19:79:89:13:8E

+

</ol>

−

Passkey service has been released</pre> you have no need to hurry anymore as you are almost set.

+

==Connection==

−

Next, go to Menu->Connectivity->Bluetooth, select right for paired devices, select Options->Set as authorized, confirm and you are done!</li>

chmod a+r /etc/resolv.conf</pre>This change is used to set correct DNS settings after connection.</li>

+

chmod a+r /etc/resolv.conf</pre>This change is used to set correct DNS settings after connection.

−

<li>Now you need scripts to actually use the phone's modem and call your ISP. My ISP is the Finnish saunalahti, mainly because of it's predefined fee for unlimited data access. You must substitute saunalahti for your ISP accordingly through the rest of the document. First we edit the modem setup script for my isp. I'm using script named /etc/ppp/peers/saunalahti and having the following content: <pre>show-password

+

Now you need scripts to actually use the phone's modem and call your ISP. My ISP is the Finnish saunalahti, mainly because of it's predefined fee for unlimited data access. You must substitute saunalahti for your ISP accordingly through the rest of the document. First we edit the modem setup script for my isp. I'm using script named /etc/ppp/peers/saunalahti and having the following content: <pre>show-password

noauth

noauth

/dev/rfcomm0

/dev/rfcomm0

Line 89:

Line 89:

A good list of Carrier's and ther username/password pairs can be found here: http://wiki.openmoko.org/wiki/GPRS

A good list of Carrier's and ther username/password pairs can be found here: http://wiki.openmoko.org/wiki/GPRS

−

The lines starting with "connect" and "disconnect" are locations for connect and disconnect chat scripts. Chat scripts are used to "talk" with the modem. Lets take a look at them next. </li>

+

The lines starting with "connect" and "disconnect" are locations for connect and disconnect chat scripts. Chat scripts are used to "talk" with the modem. Lets take a look at them next.

−

<li>Now, we edit the connect script. Mine is at /etc/ppp/peers/saunalahti-connect and is like the following: <pre>#!/bin/sh

+

Now, we edit the connect script. Mine is at /etc/ppp/peers/saunalahti-connect and is like the following: <pre>#!/bin/sh

exec chat \

exec chat \

TIMEOUT 5 \

TIMEOUT 5 \

Line 113:

Line 113:

SAY "\nConnected." \

SAY "\nConnected." \

SAY "\nIf the following ppp negotiations fail,\n" \

SAY "\nIf the following ppp negotiations fail,\n" \

−

SAY "try restarting the phone.\n"</pre>Also some remarks about these: In the place of internet.saunalahti you should have your mobile operators access point name. That can be checked from Settings->Connection->Access points . Hilight the Internet access point and select edit. Go down to section "Access point name". There you have it. One more thing. The modem command "ATD*99#"'s number "*99#" is a special number (at least in Nokia phones) which is used to "call to Internet access point". Pretty clever I'd say; no fiddling around with actual numbers, let the phone handle everything behind the scenes.</li>

+

SAY "try restarting the phone.\n"</pre>Also some remarks about these: In the place of internet.saunalahti you should have your mobile operators access point name. That can be checked from Settings->Connection->Access points . Hilight the Internet access point and select edit. Go down to section "Access point name". There you have it. One more thing. The modem command "ATD*99#"'s number "*99#" is a special number (at least in Nokia phones) which is used to "call to Internet access point". Pretty clever I'd say; no fiddling around with actual numbers, let the phone handle everything behind the scenes.

−

<li>Edit the disconnect script (mine's is in /etc/ppp/peers/saunalahti-disconnect). You should have something like this: <pre>#!/bin/sh

+

Edit the disconnect script (mine's is in /etc/ppp/peers/saunalahti-disconnect). You should have something like this: <pre>#!/bin/sh

Set executable atribute for files saunalahti-connect and saunalahti-disconnect<pre>chmod +x /etc/ppp/peers/saunalahti*connect</pre>

−

<li>Ok, you have completely set up bluetooth + gprs connection. Yay! Next thing to do is to test it. If you let the "nodetach" option uncommented in section 12, running (again, substitute yourisp for, well your ISP :) <pre>pon yourisp</pre> should return something like this: <pre>Press CTRL-C to close the connection at any stage!

+

Ok, you have completely set up bluetooth + gprs connection. Yay! Next thing to do is to test it. If you let the "nodetach" option uncommented in section 12, running (again, substitute yourisp for, well your ISP :) <pre>pon yourisp</pre> should return something like this: <pre>Press CTRL-C to close the connection at any stage!

defining PDP context...

defining PDP context...

rAT

rAT

Line 154:

Line 154:

remote IP address 10.6.6.6

remote IP address 10.6.6.6

primary DNS address 195.197.54.100

primary DNS address 195.197.54.100

−

secondary DNS address 195.74.0.47</pre> If the output is something similar, you have a working connection . If this is the case, you can press ctrl-c to abort the connection and uncomment the "nodetach" option from section 12. Later when you want connection, you can just run <pre>pon yourisp</pre> and when disconnecting <pre>poff yourisp</pre>.

+

secondary DNS address 195.74.0.47</pre>

−

<li>Add "dbus bluetooth" to the DAEMONS section in /etc/rc.conf so you can connect more easily after reboot.</li>

+

−

<li>All done, enjoy!</li>

+

If the output is something similar, you have a working connection . If this is the case, you can press ctrl-c to abort the connection and uncomment the "nodetach" option from section 12.

−

</ol>

+

+

Later when you want connection, you can just run

+

+

<pre>pon yourisp</pre>

+

+

and when disconnecting

+

+

<pre>poff yourisp</pre>

+

+

You can add "dbus bluetooth" to the DAEMONS section in /etc/rc.conf so you can connect more easily after reboot (be aware that hal already starts dbus).

+

All done, enjoy!

+

+

+

+

===wvdial===

+

Bluez-simple-agent must be running in another terminal for this step even if you already paired your devices. Edit the file /etc/wvdial.conf and put the following line on it

+

+

<pre>

+

[Dialer Defaults]

+

Modem = /dev/modem

+

Baud = 115200

+

Init1 = ATZ

+

Init2 = ATE0

+

+

[Dialer pin]

+

Init1 = AT+CPIN=YOURPIN

+

+

[Dialer YOURISP]

+

Modem = /dev/rfcomm0

+

Init3 = AT+cgdcont=1,"IP","YOURISPAPN"

+

Phone = *99***1#

+

Stupid Mode = 1

+

Username = username

+

Password = password

+

</pre>

+

+

Replace YOURISP/YOURPIN/YOURISPAPN/username/password with the right data and use

−

==Use Blueman and NetworkManager==

+

<pre>

−

Up to blueman 1.02-1 and networkmanager 0.70-1, there is no need to edit any configuration files anymore, so that we can easily set up bluetooth GRPS dialup purely in GUI. Tested with Nokia N70.

+

# wvdial YOURISP

+

</pre>

−

1, Click bluetooth applet and right click in blank area to select "Setup", then Bluetooth Manager will automatically search and setup devices for you, and you can choose to "connect to DialUp networking" if your device support this. After this, check out if you've got /dev/rfcomm0, if so you've got paired.

+

for connect, if you need to pass the PIN number, use

−

2, Right click on nm-applet and choose "Edit Connections", choose Mobile Broadband tab, click "add" it will pop you up to choose a Mobile Broadband Connection, there you can see your bluetooth device.

+

<pre>

+

# wvdial pin

+

</pre>

−

3, Edit properties of the connection, remember to change up to your own network setting. Normally, you only need to provide number and APN, leave others blank. And uncheck "Use authentication" in PPP tab, otherwise dialup would fail.

+

==Use Blueman and NetworkManager==

+

As of blueman 1.02-1 and networkmanager 0.70-1, there is no need to edit any configuration files anymore, so that we can easily set up bluetooth GRPS dialup purely in GUI. Tested with Nokia N70.

−

4, Select and connect to dialup service just like other connection type with networkmanager.

+

# Click bluetooth applet and right click in blank area to select "Setup", then Bluetooth Manager will automatically search and setup devices for you, and you can choose to "connect to DialUp networking" if your device support this. After this, check out if you've got /dev/rfcomm0, if so you've got paired.

+

# Right click on nm-applet and choose "Edit Connections", choose Mobile Broadband tab, click "add" it will pop you up to choose a Mobile Broadband Connection, there you can see your bluetooth device.

+

# Edit properties of the connection, remember to change up to your own network setting. Normally, you only need to provide number and APN, leave others blank. And uncheck "Use authentication" in PPP tab, otherwise dialup would fail.

+

# Select and connect to dialup service just like other connection type with networkmanager.

Now check the line beginning with "Channel:" - it contains the channel which is used for Dial-Up Network and it is not necessarily 1 and so is the case with my Nokia N70; my phone uses channel 3. Check also that you are reading the right results; the bluetooth hardware address must match your phone's.

Now edit /etc/bluetooth/rfcomm.conf , first uncomment the rfcomm0 device section. Then add/change the lines as this (if necessary):

bind yes;
device 00:19:79:89:13:8E;
channel 3;
comment "GPRS dialup";

Of course, you should use your device address and the appropriate channel.

Edit the bluetooth conf file in /etc/conf.d to make the rfcomm start when bluetooth system is started:

# Activate rfcomm ports (default: false)
RFCOMM_ENABLE="true"

Restart the bluetooth service:

/etc/rc.d/bluetooth restart

Look, whether the bluetooth device is bound to the phone. It should look like this:

Now comes the interesting part. You see, there must be an agreed password for connecting to the phone's modem. This password is set up in the following way: Open up another root terminal and execute

bluez-simple-agent

(if there is an error concerning a .service file, just stop bluetoothd, restart dbus and start bluetooth again). This should give you a message saying the device is ready, do not do anything else here for now, but go to the first terminal and type in

cat /dev/rfcomm0

and press Return. Shortly after the phone should be asking for a code for pairing with the computer. Use whatever code you wish on the phone. Then in the bluez-simple-agent a prompt appears asking for this code. After you have entered it and cofirmed via Return you can CTRL-c it and close the terminal. The phone is now paired with the computer.

Connection

pppd

This change is used to set correct DNS settings after connection.
Now you need scripts to actually use the phone's modem and call your ISP. My ISP is the Finnish saunalahti, mainly because of it's predefined fee for unlimited data access. You must substitute saunalahti for your ISP accordingly through the rest of the document. First we edit the modem setup script for my isp. I'm using script named /etc/ppp/peers/saunalahti and having the following content:

Also some remarks about these: In the place of internet.saunalahti you should have your mobile operators access point name. That can be checked from Settings->Connection->Access points . Hilight the Internet access point and select edit. Go down to section "Access point name". There you have it. One more thing. The modem command "ATD*99#"'s number "*99#" is a special number (at least in Nokia phones) which is used to "call to Internet access point". Pretty clever I'd say; no fiddling around with actual numbers, let the phone handle everything behind the scenes.
Edit the disconnect script (mine's is in /etc/ppp/peers/saunalahti-disconnect). You should have something like this:

Set executable atribute for files saunalahti-connect and saunalahti-disconnect

chmod +x /etc/ppp/peers/saunalahti*connect

Ok, you have completely set up bluetooth + gprs connection. Yay! Next thing to do is to test it. If you let the "nodetach" option uncommented in section 12, running (again, substitute yourisp for, well your ISP :)

Replace YOURISP/YOURPIN/YOURISPAPN/username/password with the right data and use

# wvdial YOURISP

for connect, if you need to pass the PIN number, use

# wvdial pin

Use Blueman and NetworkManager

As of blueman 1.02-1 and networkmanager 0.70-1, there is no need to edit any configuration files anymore, so that we can easily set up bluetooth GRPS dialup purely in GUI. Tested with Nokia N70.

Click bluetooth applet and right click in blank area to select "Setup", then Bluetooth Manager will automatically search and setup devices for you, and you can choose to "connect to DialUp networking" if your device support this. After this, check out if you've got /dev/rfcomm0, if so you've got paired.

Right click on nm-applet and choose "Edit Connections", choose Mobile Broadband tab, click "add" it will pop you up to choose a Mobile Broadband Connection, there you can see your bluetooth device.

Edit properties of the connection, remember to change up to your own network setting. Normally, you only need to provide number and APN, leave others blank. And uncheck "Use authentication" in PPP tab, otherwise dialup would fail.

Select and connect to dialup service just like other connection type with networkmanager.