Table of contents
- 1. Introduction
-
- 1.1. Concepts
- 1.2. Revision history
- 1.3. Disclaimer
- 2. Kernel setup
-
- 2.1. Required modules
- 3. Bluetooth setup
-
- 3.1. Packages
- 3.2. Bluetooth configuration
- 4. PPP setup
-
- 4.1. PPP config file
- 4.2. Chat scripts
- 5. Connecting
-
- 5.1. Opening the connection
- 5.2. Troubleshooting
- 6. Conclusion
1. Introduction
1.1. Concepts
This document describes my experiences on using a Sony Ericsson P990i smartphone with HP’s Compaq nx7400 ‘business’ laptop a.k.a. notebook computer. I will assume that you have GPRS/3G already working on your phone (i.e. you can surf the web on your phone). This setup works fine also on a HP nc6400 laptop.
1.2. Revision history
| Revision v0.1.1 | 7. November 2007 | By: Jani Reinikainen |
| Corrected a few spelling errors, fixed TOC and added section 5. | ||
| Revision v0.1.0 | 16. January 2005 | By: Jani Reinikainen |
| Initial revision. | ||
1.3. Disclaimer
Use the information in this document at your own risk. I disavow any potential
liability for the contents of this document. Use of the concepts, examples,
and/or other content of this document is entirely at your own risk.
All copyrights are owned by their owners, unless specifically noted otherwise.
Use of a term in this document should not be regarded as affecting the
validity of any trademark or service mark.
Naming of particular products or brands should not be seen as endorsements.
You are strongly recommended to make a backup of your system before major
installation and should make backups at regular intervals.
2. Kernel setup
2.1. Required modules
In addition to the drivers to your specific Bluetooth adapter, you’ll need the following:
CONFIG_BT_RFCOMM=y CONFIG_PPP=y CONFIG_PPP_ASYNC=y
3. Bluetooth setup
3.1. Packages
As of Gutsy (7.10) bluez-pin is no longer required and should be omitted. Multisync is not strictly needed for web access only, but is useful for synchronization between phone and PC.
3.2. Bluetooth configuration
First of all we need to fire up the Bluetooth subsystem:
To connect to the phone, we need to find out which of it’s channels is the serial port. To do this we can use the following commands:
This will return the MAC addresses of the phones in range. Make sure Bluetooth is turned on in your phone, and that ‘Visible to other devices’ is set! The output should be something like this:
Scanning ...
00:00:00:00:00:00 P990i
Make a note of what the MAC address is (I’ve obfuscated mine for demonstration purposes). To find the serial port channel from your phone we must then use sdptool to list the available services, and make a note of the Serial Port channel number:
On my P990i, I got the following:
Service Name: AVRCP Target
Service Description: Audio Video Remote Control
Service Provider: Symbian Software Ltd.
Service RecHandle: 0x10000
Service Class ID List:
"AV Remote" (0x110e)
Protocol Descriptor List:
"L2CAP" (0x0100)
PSM: 23
"AVCTP" (0x0017)
uint16: 0x100
uint16: 0xf00
Service Name: AVRCP Controller
Service Description: Audio Video Remote Control
Service Provider: Symbian Software Ltd.
Service RecHandle: 0x10001
Service Class ID List:
"AV Remote" (0x110e)
Protocol Descriptor List:
"L2CAP" (0x0100)
PSM: 23
"AVCTP" (0x0017)
uint16: 0x100
uint16: 0xf
Service Name: Personal Ad-hoc User Service
Service Description: Personal Ad-hoc User Service
Service Provider: Symbian Software Ltd.
Service RecHandle: 0x10004
Service Class ID List:
"PAN User" (0x1115)
Protocol Descriptor List:
"L2CAP" (0x0100)
PSM: 15
"BNEP" (0x000f)
Version: 0x0100
SEQ8: 0 6 dd
Language Base Attr List:
code_ISO639: 0x656e
encoding: 0x6a
base_offset: 0x100
Profile Descriptor List:
"PAN User" (0x1115)
Version: 0x0100
Service Name: Group Ad-hoc Network Service
Service Description: Personal Group Ad-hoc Network Service
Service Provider: Symbian Software Ltd.
Service RecHandle: 0x10005
Service Class ID List:
"PAN Group Network" (0x1117)
Protocol Descriptor List:
"L2CAP" (0x0100)
PSM: 15
"BNEP" (0x000f)
Version: 0x0100
SEQ8: 0 6 dd
Language Base Attr List:
code_ISO639: 0x656e
encoding: 0x6a
base_offset: 0x100
Profile Descriptor List:
"PAN Group Network" (0x1117)
Version: 0x0100
Service Name: SEMC HLA
Service RecHandle: 0x10006
Service Class ID List:
"" (0x8e771301)
Protocol Descriptor List:
"L2CAP" (0x0100)
PSM: 61689
"" (0x8e770300)
Language Base Attr List:
code_ISO639: 0x656e
encoding: 0x6a
base_offset: 0x100
Profile Descriptor List:
"" (0x8e771303)
Version: 0x0100
Service Name: Dial-up Networking
Service Description: Symbian OS,UIQ phone
Service Provider: Sony Ericsson
Service RecHandle: 0x10007
Service Class ID List:
"Dialup Networking" (0x1103)
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 7
Language Base Attr List:
code_ISO639: 0x656e
encoding: 0x6a
base_offset: 0x100
Profile Descriptor List:
"Dialup Networking" (0x1103)
Version: 0x0100
Service Name: Audio Streaming Source
Service Description: Symbian OS,UIQ phone
Service Provider: Sony Ericsson
Service RecHandle: 0x10009
Service Class ID List:
"Audio Source" (0x110a)
Protocol Descriptor List:
"L2CAP" (0x0100)
PSM: 25
"AVDTP" (0x0019)
uint16: 0x100
Language Base Attr List:
code_ISO639: 0x656e
encoding: 0x6a
base_offset: 0x100
Profile Descriptor List:
"Advanced Audio" (0x110d)
Version: 0x0100
Service Name: Object Push
Service RecHandle: 0x1000e
Service Class ID List:
"OBEX Object Push" (0x1105)
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 3
"OBEX" (0x0008)
Profile Descriptor List:
"OBEX Object Push" (0x1105)
Version: 0x0100
Service Name: File transfer
Service RecHandle: 0x1000f
Service Class ID List:
"OBEX File Transfer" (0x1106)
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 4
"OBEX" (0x0008)
Profile Descriptor List:
"OBEX File Transfer" (0x1106)
Version: 0x0100
Service Name: Headset Audio Gateway
Service Description: Symbian OS,UIQ phone
Service Provider: Sony Ericsson
Service RecHandle: 0x10025
Service Class ID List:
"Headset Audio Gateway" (0x1112)
"Generic Audio" (0x1203)
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 8
Language Base Attr List:
code_ISO639: 0x656e
encoding: 0x6a
base_offset: 0x100
Profile Descriptor List:
"Headset" (0x1108)
Version: 0x0100
Service Name: Hands-free Audio Gateway
Service Description: Symbian OS,UIQ phone
Service Provider: Sony Ericsson
Service RecHandle: 0x10026
Service Class ID List:
"Handfree Audio Gateway" (0x111f)
"Generic Audio" (0x1203)
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 9
Language Base Attr List:
code_ISO639: 0x656e
encoding: 0x6a
base_offset: 0x100
Profile Descriptor List:
"Handsfree" (0x111e)
Version: 0x0105
Service Name: m-Router Connectivity
Service Description: m-Router Connectivity
Service Provider: Symbian Ltd.
Service RecHandle: 0x1002f
Service Class ID List:
"Error: This is UUID-128" (0xa2157972-3541-4d0b-a551-b3abe639f526)
"Generic Networking" (0x1201)
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 1
Language Base Attr List:
code_ISO639: 0x656e
encoding: 0x6a
base_offset: 0x100
Service Name: m-Router Connectivity
Service Description: m-Router Connectivity
Service Provider: Symbian Ltd.
Service RecHandle: 0x10030
Service Class ID List:
"Serial Port" (0x1101)
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 2
Language Base Attr List:
code_ISO639: 0x656e
encoding: 0x6a
base_offset: 0x100
Simply put, channel 7 is the one we want to use (Dial-Up Networking). Now that you know the address and channel of the device, you can setup /etc/bluetooth/rfcomm.conf:
#
# RFCOMM configuration file.
#
rfcomm0 {
# Automatically bind the device at startup
bind yes;
# Bluetooth address of the device
device 00:00:00:00:00:00;
# RFCOMM channel for the connection
channel 7;
# Description of the connection
comment "GPRS/3G connection";
}
Again, replace the zeros with the MAC address of your phone. Older Ubuntus (6.10) do not have a /dev/rfcomm0 socket by default, but you can just mknod it:
Newer Ubuntus (7.10) have a device /dev/.static/dev/rfcomm0 you can use by default. You might want to add your user to the ‘dialout’ group or chmod the device 0666, otherwise you risk errors such as “Can’t connect RFCOMM socket: Connection refused”.
Move on to /etc/bluetooth/hcid.conf:
#
# HCI daemon configuration file.
#
# HCId options
options {
# Automatically initialize new devices
autoinit yes;
# Security Manager mode
# none - Security manager disabled
# auto - Use local PIN for incoming connections
# user - Always ask user for a PIN
#
security auto;
# Pairing mode
# none - Pairing disabled
# multi - Allow pairing with already paired devices
# once - Pair once and deny successive attempts
pairing once;
# Default PIN code for incoming connections
passkey "0000";
}
# Default settings for HCI devices
device {
# Local device name
# %d - device id
# %h - host name
name "%h-%d";
# Local device class
class 0x3e0100;
# Default packet type
#pkt_type DH1,DM1,HV1;
# Inquiry and Page scan
iscan enable; pscan enable;
discovto 0;
# Default link mode
# none - no specific policy
# accept - always accept incoming connections
# master - become master on incoming connections,
# deny role switch on outgoing connections
lm accept;
# Default link policy
# none - no specific policy
# rswitch - allow role switch
# hold - allow hold mode
# sniff - allow sniff mode
# park - allow park mode
lp rswitch,hold,sniff,park;
}
Next, pair your phone with your laptop. On my P990i I went to Connections -> Bluetooth -> My Devices -> New device. Assuming your laptop is in range and Bluez is running, initiate the pairing and input the same passkey you used in /etc/bluetooth/hcid.conf.
You can now test the connection by running:
Or, if you’re running a newer Ubuntu:
Your phone should ask you to accept or reject the incoming connection in a pop-up with the text “Connection request, A device is trying to connect over Bluetooth.”. The service name should be “Dial-up Networking”, if it’s not, you’ve probably got the wrong channel (recheck sdptools’ output). Click on “Accept” and tick the “Always trust this device” box unless you want to be bugged by the notice every time you connect. The output should be similar to:
Connected /dev/rfcomm0 to 00:00:00:00:00:00 on channel 7 Press CTRL-C for hangup
And it should just sit there until you issue a Ctrl-C. Great, now we just need some PPP scripts that actually open the connection and talk to the carrier.
4. PPP setup
4.1. PPP config file
Create a new file /etc/ppp/peers/3g and place the following in it. Also remember to set the ‘device’ option accordingly. These settings should work with most newer Sony Ericsson phones:
# Most GPRS phones don't reply to LCP echo's lcp-echo-failure 0 lcp-echo-interval 0 # Keep pppd attached to the terminal: # Comment this to get daemon mode pppd nodetach # Debug info from pppd: # Comment this off, if you don't need more info debug # Show password in debug messages show-password # Connect script: # scripts to initialize the GPRS modem and start the connection, connect /etc/ppp/peers/3g-connect-chat # Disconnect script: # AT commands used to 'hangup' the GPRS connection. disconnect /etc/ppp/peers/gprs-disconnect-chat # Serial device to which the GPRS phone is connected: /dev/rfcomm0 # Serial port line speed 115200 # fast enough1 # Hardware flow control: # Use hardware flow control with cable, Bluetooth and USB but not with IrDA. crtscts # serial cable, Bluetooth and USB, on some occations with IrDA too # Ignore carrier detect signal from the modem: local # IP addresses: # - accept peers idea of our local address and set address peer as 10.0.0.1 # (any address would do, since IPCP gives 0.0.0.0 to it) # - if you use the 10. network at home or something and pppd rejects it, # change the address to something else 0.0.0.0:0.0.0.0 # pppd must not propose any IP address to the peer! noipdefault # Accept peers idea of our local address ipcp-accept-local # Add the ppp interface as default route to the IP routing table defaultroute # DNS servers from the phone: # some phones support this, some don't. usepeerdns # ppp compression: # ppp compression may be used between the phone and the pppd, but the # serial connection is usually not the bottleneck in GPRS, so the # compression is useless (and with some phones need to disabled before # the LCP negotiations succeed). novj nobsdcomp novjccomp nopcomp noaccomp # The phone is not required to authenticate: noauth # Username and password: # If username and password are required by the APN, put here the username # and put the username-password combination to the secrets file: # /etc/ppp/pap-secrets for PAP and /etc/ppp/chap-secrets for CHAP # authentication. See pppd man pages for details. user "none" password 123456 mtu 1500 mru 1500
4.2. Chat scripts
You will need a chat script that works with your provider. Create a new file such as /etc/ppp/peers/3g-chat-connect (the name of this file needs to be the same as specified in ‘connect’ option in the file above). I use the following for the Saunalahti provider here in Finland. THIS SCRIPT IS CARRIER-DEPENDANT – the script below WILL NOT WORK FOR OTHER CARRIERS WITHOUT MODIFICATIONS. Ask your carrier for more details.
#!/bin/bash
#
# $Id: gprs-connect-chat,v 1.2 2004/02/02 23:19:28 mcfrisk Exp $
#
# File:
# gprs-connect-chat
#
# Description:
# chat script to open Saunalahti's GPRS service with GPRS phones. If ppp
# negotiation stalls, try restarting the phone. To try with other GPRS
# operator setting, change the PDP contex setting. The settings work with
# most Ericsson models, but Nokia 8310 and 30 do not support QoS parameters
# with AT commands, so just delete those lines and it'll work.
#
# Set PDP context CID=1, protocol=IP, APN=internet:
# AT+CGDCONT=1,"IP","internet","",0,0
#
# Set CID=1 QoS requirements from the network, not supported by Nokia:
# AT+CGQREQ=1,0,0,0,0,0
#
# Set CID=1 minimum acceptable QoS parameters, not supported by Nokia:
# AT+CGQMIN=1,0,0,0,0,0
#
# 'Call' CID=1 (activate PDP context one, perform GPRS attach):
# ATD*99***1#
#
# Some phones like the Orange SPV (yes, the Microsoft Smartphone) use this
# dial string to start GPRS connection:
# ATD*99#
#
# The actual chat script:
exec chat \
TIMEOUT 5 \
ECHO ON \
ABORT '\nBUSY\r' \
ABORT '\nERROR\r' \
ABORT '\nNO ANSWER\r' \
ABORT '\nNO CARRIER\r' \
ABORT '\nNO DIALTONE\r' \
ABORT '\nRINGING\r\n\r\nRINGING\r' \
'' \rAT \
TIMEOUT 12 \
SAY "Press CTRL-C to close the connection at any stage!" \
SAY "\ndefining PDP context...\n" \
OK ATH \
OK ATE1 \
OK 'AT+CGDCONT=1,"IP","internet.saunalahti","",0,0' \
OK ATD*99# \
TIMEOUT 22 \
SAY "\nwaiting for connect...\n" \
CONNECT "" \
SAY "\nConnected." \
SAY "\nIf the following ppp negotiations fail,\n" \
SAY "try restarting the phone.\n"
5. Connecting
5.1. Opening the connection
Okay, let’s connect! Issue the following command to make the Bluetooth connection from your PC to your phone:
$ rfcomm bind all
Assuming all want well (no output), issue the following command to open the PPP connection over Bluetooth (3g is the name of the script that needs to be called, depends on what you named the file):
The output should be similar to this:
Press CTRL-C to close the connection at any stage! defining PDP context... rAT OK ATH OK ATE1 OK AT+CGDCONT=1,"IP","internet.saunalahti","",0,0 OK waiting for connect... ATD*99# CONNECT Connected. If the following ppp negotiations fail, try restarting the phone. Serial connection established. using channel 1 Using interface ppp0 Connect: ppp0 <--> /dev/.static/dev/rfcomm0 sent [LCP ConfReq id=0x1] rcvd [LCP ConfReq id=0x2 ] sent [LCP ConfRej id=0x2 ] rcvd [LCP ConfAck id=0x1 ] rcvd [LCP ConfReq id=0x3 ] sent [LCP ConfAck id=0x3 ] rcvd [CHAP Challenge id=0x0 <22b370e96e0f9ca57a2b88214607345dd2a3a0591effcc152a1bb891f6f764cd8293d0c9ceeffc85da0be801a6>, name = "Kermit"] sent [CHAP Response id=0x0 <8971ceaf76c665b2ec95427f509bae7d>, name = "none"] rcvd [CHAP Success id=0x0 "Congratulations!"] CHAP authentication succeeded: Congratulations! CHAP authentication succeeded sent [CCP ConfReq id=0x1 ] sent [IPCP ConfReq id=0x1 ] rcvd [LCP ProtRej id=0x1 80 fd 01 01 00 0c 1a 04 78 00 18 04 78 00] Protocol-Reject for 'Compression Control Protocol' (0x80fd) received rcvd [IPCP ConfReq id=0x1] sent [IPCP ConfNak id=0x1 ] rcvd [IPCP ConfNak id=0x1 ] sent [IPCP ConfReq id=0x2 ] rcvd [IPCP ConfReq id=0x2] sent [IPCP ConfAck id=0x2] rcvd [IPCP ConfAck id=0x2 ] Could not determine remote IP address: defaulting to 10.64.64.64 found interface eth1 for proxy arp local IP address 85.77.252.82 remote IP address 10.64.64.64 primary DNS address 195.197.54.100 secondary DNS address 195.74.0.47 Script /etc/ppp/ip-up started (pid 7340) Script /etc/ppp/ip-up finished (pid 7340), status = 0x0
Congratulations, your connection is now set up!
5.2. Troubleshooting
The easiest ways to troubleshoot the connection is “tail -f /var/log/syslog” and also keep a close eye on what’s displayed on your phone’s screen. Also check that routes (man route) and DNS servers (/etc/resolv.conf) are defined properly. Also check what ‘ifconfig’ reports for the ppp connection.
6. Conclusion
Hope you found the guide useful. A good idea is to have “Enable power saving” ticked in your phone’s settings, as both Bluetooth and high-speed data connections draw a lot of power. Expect a drastically shortened battery life. A donation wouldn’t hurt (even if it’s only a euro or two – everything helps), as this site is getting so many hits it’s getting a bit expensive. There’s a link to PayPal at the lower left corner of this site. Thanks!
