Bluetooth on Linux
1. Introduction
Did you know that setting up a bluetooth connection with a PC on Linux is not at all difficult?
So, now we will create a connection to the phone \ PDA, mount the file system of the phone to it on the PC and create a GPRS \ EDGE connection.
The hardware I tested on is a laptop ASUS M51TR, mobile phones - Motorola L9, Motorola E398. All this on Kubuntu 8.10.
Required Packages:
- fuse-utils
- obexftp
- obexfs
- obextool
- bluez-utils
2. Find the phone.
To do this, we need to know the MAC address of the phone and the channel numbers of services that are not needed for us.
Using sdptool, we look for our phone in range:
sdptool browse
It will output something like this to the terminal: Where 00: 17: E4: 1B: D2: E3 is the poppy address. And then descriptions of the services that a cellphone provides, for example, for Dial-Up Networking will follow: I highlighted the key points in bold above. Service Name - the name of the service. Service Provider - in most cases - phone model (useful when many devices are found). Channel - the second required item after the MAC address. Itzem channel numbers for the necessary services (DUN, FTP) and register:
Inquiring ...
Browsing 00:17:E4:1B:D2:E3 ...
Service Name: Dial-up Networking Gateway
Service Description: Dial-up Networking Gateway
Service Provider: Motorola
Service RecHandle: 0x10001
Service Class ID List:
"Dialup Networking" (0x1103)
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 1
[сократил, так как много ненужной нам инфы]
sdptool add DUN
sdptool add FTP
3. Connect
We edit the file /etc/bluetooth/rfcomm.conf, adding connections: bind - automatically connect the device at system startup, device - MAC address, channel - channel. Each new service is added as rfcommN, where N is a number. Elementary, just insure;) We save and check the performance: We get the following on the exhaust: If so, then everything is OK, the devices are found and connected, if not, check rfcomm.conf
rfcomm0 {
bind yes;
device 00:17:E4:1B:D2:E3;
channel 1;
comment "Dialup Networking Gateway";
}
sudo rfcomm bind all
rfcomm
rfcomm0: 00:17:E4:1B:D2:E3 channel 1 clean
rfcomm1: 00:17:E4:1B:D2:E3 channel 9 clean
rfcomm2: 00:17:E4:1B:D2:E3 channel 8 clean
4. Mount
Need a service - OBEX FTP.
Create a mount point:
sudo mkdir -m777 /media/mobile
Add the user to the fuse group so that he can mount the FS:
sudo usermod -aG fuse username
Mount *:
obexfs -b00:17:E4:1B:D2:E3 -B9 /media/mobile
-b = MAC
-B = channel
or
obexfs -t /dev/rfcomm0 /media/mobile
Then: Voila: Unmount, everything is simple: * Perhaps the first time you connect the device will be asked to pair devices. Enter, for example, “1234” on the phone and then on the PC.
cd /media/mobile
ls
audio MMC(Removable) picture video
umount /media/mobile
5. GPRS \ EDGE
I need a service - DUN (Dial-Up Networking)
I have KDE, so we start kppp.
Configure -> Modems -> New -> Device ,
where the Modem device is your configured device \ channel for DUN (see /etc/bluetooth/rfcomm.conf)
Everything is there: go to the tab Modem-> Modem Commands
(further settings for Belarusian MTS, see the operator’s website):
Initialization String 1: AT + CGDCONT = 1, “IP”, “mts”
Initialization String 2: ATZ
To check, click Query Modem .
The modem is configured, we configure the connection:
The main settings window -> Accounts -> New -> Manual Setup
Specify a name, for example, MTS BY
Add a phone number: * 99 #or * 99 *** 1 # .
Done. We select a modem and a network in kppp!
(kppp-> use modem ->% configured modem% -> Connect)
Thank you for your attention!
UPD: renamed the topic, so as not to confuse;)