This blog should guide any Linux user through the necessary steps required to setup bluetooth dial-up modem on a Linux platform.This blog was prepared and tested
using Sony Ericsson K750i and Samsung E260 all of which worked well without any problems.
Necessary Devices
1. Phone with bluetooth connectivity
2. Bluetooth dongle(USB or inbuilt into PC).
NOTE: Bluez configuration files are located in the directory /etc/bluetooth in most linux distributions.
NECESSARY PACKAGES
1. bluez-utils(provides bluetooth support for Linux distributions)
To confirm the presence of bluez-utils execute the command “ rpm -q bluez-utils”.
If installed an output similar to this shown below should be output
[stuart@nucleus ~]$ rpm -q bluez-utils
bluez-utils-3.20-4.fc8
STEP-BY-STEP CONFIGURATION
1. Bluetooth Connection (PC to Modem)
1.1. Confirm bluetooth adapter installation
Plug bluetooth dongle if USB and execute the command hcitool dev to confirm bluetooth adopter is
detected.
1.2. Backup default configurations
Execute “mkdir /etc/bluetooth/backup” as root
[root@nucleus stuart]# mkdir /etc/bluetooth/backup
[root@nucleus stuart]#
Copy hcitool.conf and rfcomm.conf into the backup directory.
[root@nucleus stuart]# cp /etc/bluetooth/rfcomm.conf /etc/bluetooth/backup
[root@nucleus stuart]# cp /etc/bluetooth/hcid.conf /etc/bluetooth/backup
[root@nucleus stuart]#
This should enable you to restore the configurations to the default and start all over again incase of a problem.
1.3. Editing hcitool.conf
[stuart@nucleus ~]$ cat /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 user;
# Pairing mode
# none - Pairing disabled
# multi - Allow pairing with already paired devices
# once - Pair once and deny successive attempts
pairing multi;
# Default PIN code for incoming connections
passkey "BlueZ";
}
# Default settings for HCI devices
device {
# Local device name
# %d - device id
# %h - host name
name "%h-%d";
# Local device class
class 0x000100;
# Default packet type
#pkt_type DH1,DM1,HV1;
# Inquiry and Page scan
iscan enable; pscan enable;
# 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;
}
Normally, the file /etc/bluetooth/hcid.conf works well in the default state. If not, open it in your
preferred text editor and edit as appropriate as guided by by the comments.
1.4. Editing rfcomm.conf
Execute hcitool scan and identify MAC-Address used by phone
[stuart@nucleus ~]$ hcitool scan
Scanning ...
00:1B:59:3C:CE:D3 Mac.
Secondly, run sdptool browse
[stuart@nucleus ~]$ sdptool browse 00:1B:59:3C:CE:D3
Browsing 00:1B:59:3C:CE:D3 ...
Service Description: Sony Ericsson K750
Service RecHandle: 0x10000
Service Class ID List:
"PnP Information" (0x1200)
Service Name: Dial-up Networking
Service RecHandle: 0x10001
Service Class ID List:
"Dialup Networking" (0x1103)
"Generic Networking" (0x1201)
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 1
Profile Descriptor List:
"Dialup Networking" (0x1103)
Version: 0x0100
Service Name: Serial Port
Service RecHandle: 0x10002
Service Class ID List:
"Serial Port" (0x1101)
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 2
.....
Take note of the serial channel and/or Dial-up channel
Uncomment by removing the hushes(#) that precede the configurations in the rfcomm.conf file which
by default appears as shown below and resides in the directory /etc/bluetooth.
[stuart@nucleus ~]$ cat /etc/bluetooth/rfcomm.conf
#
# RFCOMM configuration file.
#
#rfcomm0 {
# # Automatically bind the device at startup
# bind no;
#
# # Bluetooth address of the device
# device 11:22:33:44:55:66;
#
# # RFCOMM channel for the connection
# channel 1;
#
# # Description of the connection
# comment "Example Bluetooth device";
#}
Edit the file above so that file above appears as shown below. Note all comments have been removed
from the file below for easy readabiility.
[stuart@nucleus ~]$ cat /etc/bluetooth/rfcomm.conf
rfcomm0 {
bind no;
device 00:1B:59:3C:CE:D3;
channel 1;
comment "standard modem over bluetooth";
}
bind no;
device 00:1B:59:3C:CE:D3;
channel 2;
comment "serial port";
}
1.5. Connect PC to bluetooth modem
Finally, execute the command rfcomm connect
in the file rfcomm.conf e.g.
“rfcomm connect 0” means connect using configuration rfcomm0 in the
file /etc/bluetooth/rfcomm.conf
This should produce an output such as:
[stuart@nucleus ~]$ rfcomm connect 0
Connected /dev/rfcomm0 to 00:1B:59:3C:CE:D3 on channel 1
Press CTRL-C for hangup
On execution the above command produces a /dev/rfcomm[number]. Where number is the device number
used in creating the connection.
2. Network Configuration for modem(Gnome Desktop)
i. On the gnome desktop taskbar, click on System>Administration>Network
ii. On the widgets on the System-config-network click on new
iii. In the list menu on the left, choose Modem connection
iv. In the device section input /dev/rfcomm[number]
v. Input the connection name, username and password
vi. Apply the settings and save
vii. Activate the connection from the widgets on the System-config-network by clicking on activate.
Alternatively, the connection can be activated from the command line by the commands,
/sbin/ifup ppp[number] where number is the modem number as referenced in System-config-network.