Home > Linux Commands, Linux Tips > Configure Bluetooth on Linux

Configure Bluetooth on Linux

Nowadays, buying a laptop, in almost all cases, find a bluetooth device, which surely will be very convenient to interact with your mobile phone or any device with Bluetooth. Otherwise, just buy a Bluetooth USB device.

On Windows, the installation and configuration is simple, but on Linux?

Let’s see how it makes it clear immediately that this process has been tested and is working on Debian, Ubuntu or other distros so on, with the proper caution, you should not have problems.

bluetooth on linux

Installation Packages

execute a shell:

$ apt-get install bluez-utils bluez-firmware bluez-hcdidump

Now we check that the dependencies between the demon is present installed bluetooth

Who uses KDE should install kdebluetooth, while those who use Gnome will install gnome-bluetooth nautilus-sendto, and bluez-gnome.

Configuration

We connect our USB device to the PC and open a shell. As root give:

$ hciconfig

and you get this result:

$ Hciconfig
hci0: Type: USB
BD Address: 00:0 B: **: 58: **: 9C ACL MTU: 377:10 SCO MTU: 64:8
RUNNING UP PSCAN
RX bytes: 157 acl: 0 sco: 0 events: 16 errors: 0
TX bytes: 62 acl: 0 sco: 0 commands: 16 errors: 0

the address indicated as BD Address: 00:0 B: **: 58: **: 9C, is the address to the Bluetooth adapter built into my laptop (for you could be the usb chavetta).

Now give the command:

$ Hcitool scan

and we note our phone (Bluetooth must be turned on of course:)) and we have this result:

Scanning ...
00:15: B9: 7F: 8B: E3 Systems Engineer

copy this address (of course your) I recommend it! Now with your edited, edit the file in

/etc/bluetooth/rfcomm.conf

to be like this:

#
# RFCOMM configuration file.
#
# {Rfcomm0
# # Automatically bind the device at startup
# Bind no;
#
# # Bluetooth address of the device
# # Device 11:22:33:44:55:66;
# Device 00:15: B9: 7F: 8B: E3;
# # RFCOMM channel for the connection
Channel # 10;
#
# # Description of the connection
# # Comment "Example Bluetooth device";
# Comment "Samsung SGH-E720";
#}

course instead of device 00:15: B9: 7F: 8B: E3, you must enter the address of your phone that you had done before and write instead of comment “Samsung SGH-E720″ comments “your phone”.

Now from the shell, execute this command:

$ Sdptool add - channel = 10 OPUSH

and an editor we will create a file that will contain our pin connections and save it in /etc/bluetooth.

the file is very simple and must be so:

#! /bin/bash
echo PIN: ****

where the **** are the numbers that you want to give him the pin. Now save the file and give the command:

$ Chmod 700/etc/bluetooth/nome_script.sh

Now edit /etc/bluetooth/hcid.conf

and below # Default PIN code for incoming connections passkey “1234″;

insert:

PIN #
pin_mio/etc/bluetooth/nome_script.sh
pin_mio #/usr/bin/bluez-pin;

Now save the file and give:

$ hcid -f/etc/bluetooth/hcid.conf

we are ready to use our bluetooth device.

A note for Gnome users: If you wish to send a file via bluetooth by right mouse clicking on the file and select Send to … go to edit with a text editor:

# /bin/sh
# Send file to bluetooth
filepath = $ NAUTILUS_SCRIPT_SELECTED_FILE_PATHS
obexftp-b 00:12: EE: F9: 15:20 p-filepath $

save the file in the dir/home/utente/.gnome2/nautilus-scripts and make it executable by the user.

We can now use our bluetooth device.

  1. No comments yet.
  1. No trackbacks yet.