If you’re new to Bluetooth, then please read through the Bluetooth Primer tutorial before attempting this. It could save you a lot of headache later on
Installing and using Bluetooth has been wrought with problems for me, even during my Windows days. There were always special drivers to install and problems with the Bluetooth stack. Though overcoming these issues was a hassle, the benefits are worthwhile. Having wireless access to a variety of devices and gadgets reduces the need for carrying special cables, adapters, and dongles.
When I started using Ubuntu full-time, getting this technology to work was of paramount concern. I believed the configuration would be difficult and very technical, and i am happy to say it is not.
Installing the Adapter:
In order to get the entire thing working, I suggest you install the following applications and utilities..
sudo apt-get install bluez-utils bluez-pin bluetooth bluez-gnome gnome-bluetooth bluez-passkey-gnome
If you want to use a PCMCIA Bluetooth adaptor, you will also need to install..
sudo apt-get install bluez-pcmcia-support
Command line users:
If you don’t want to install all the Gnome files then you will need to install the libopenobex1 package separately. This software allows you to transfer files from a Linux PC to most mobile devices. This normally gets installed at the same time as all the Gnome Bluetooth software, but a command line user will need to Install it by typing sudo apt-get install libopenobex1 into the terminal.
Unfortunately I can’t seem to trace any information on using libopenobex1 without the rest of the Gnome Bluetooth software. I would suggest you install everything, even if you aren’t using Gnome. I’ll try & find out what other software a command line user can use to transfer files soon, but no promises
You will also need to edit your hcid.conf file to enable other Bluetooth devices to connect to your computer; so in the terminal type..
sudo nano /etc/bluetooth/hcid.conf
Set the options up as the following (don’t copy & paste these)..
autoinit auto; – Automatically initialize new devices.
security auto; – Automatically allows incoming connections from Bluetooth devices with the correct security code.
passkey “1234“; – This will be the security code that you need to enter within your Bluetooth device before it will pair up with your computer. Make sure that you put the new code within the speech marks.
This set up will allow for easy connections from Bluetooth devices, while still being secure enough. You will have to keep your passkey/security code to yourself though, or anyone else could connect to it too.
Now it’s time to restart the Bluetooth service.
I have a PCMCIA Bluetooth adapter, and needed to reboot my machine in order for this to take effect. For some people using a USB Bluetooth adapter, this can be done with one of the following commands..
sudo /etc/init.d/bluetooth restart
sudo /etc/init.d/bluez-utils restart
If the first command does not work for you, simply try the second one.
Now plug in your USB Bluetooth adapter (if you have one) & your device should be recognized.
An icon will appear in the top right area of your screen if your using the Gnome GUI, but command line users will need to type hciconfig into the terminal to see if it was set up & recognized correctly.
The reply that you get from hciconfig should be something like this..
hci0: Type: USB
BD Address: 00:E0:98:CC:9E:A5 ACL MTU: 192:8 SCO MTU: 64:8
UP RUNNING PSCAN ISCAN
RX bytes:884 acl:0 sco:0 events:44 errors:0
TX bytes:414 acl:0 sco:0 commands:27 errors:0
The parts in bold are what you need to check for.
If for any reason the Bluetooth icon does not show up, or it’s not completely recognized from within the terminal, I would suggest leaving the Bluetooth adapter plugged in and rebooting your machine.
Congratulations! Bluetooth is now installed
Connecting to HIDD (Human interface) Devices:
In order to begin using other devices such as a mouse with your newly installed adapter, you will need to discover and pair them together.
The first step to making this connection is to place the human input device into discovery mode. This is slightly different for every device, so read your manual to determine how this is accomplished. Once the device is in discovery mode, a scan for nearby devices can be initiated with the following command..
sudo hidd –search
Which should (hopefully) display this..
Connecting to device aa:bb:cc:dd:ee:ff
If you’re lucky, the connection will automatically be made for you, as is the case above. If the device is not found, ensure it’s in discovery mode, and try again. For many devices the discovery mode disables itself after a few seconds. Eventually your system should find the device.
If the connection is not made automatically, and instead you are provided with the device’s mac address, you can manually make the connection with..
sudo hidd –connect aa:bb:cc:dd:ee:ff
Unfortunately.. if you reboot your computer the connection will not be remembered by default. To force Ubuntu to remember your device permanently, you will need to edit the Bluetooth configuration file..
sudo nano /etc/default/bluetooth (or sudo nano /etc/default/bluez-utils for some)
Look for the line labelled HIDD_ENABLED=0 and change it to..
If this does not work for you, you may also need to add the following to the HIDD_OPTIONS line..
HIDD_OPTIONS=”–connect aa:bb:cc:dd:ee:ff –server”
This command should ensure a permanent connection to any HIDD device.
Hopefully you have found this tutorial useful and informative. In the near future I will be adding a follow up tutorial with instructions on using your Bluetooth phone with Ubuntu.