Configuring Bluetooth in Ubuntu

Bluetooth is the short-range networking facility that allows various items of hardware to work with each other wirelessly. You can use Bluetooth for everything from file transfers between a mobile phone and computer to employing a wireless keyboard or mouse with your desktop computer.

For Bluetooth to work, both devices need to have Bluetooth support. Many mobile phones come with Bluetooth nowadays, as do an increasing number of notebook computers. It’s also possible to buy very inexpensive Bluetooth USB adapters.

Bluetooth support is built into Ubuntu and should activate automatically if Bluetooth hardware is present on your PC. You will know if this is the case because a Bluetooth icon will appear in the notification area. This is used to administer all Bluetooth devices that you might want to connect to your computer.

Pairing Bluetooth Devices

When two pieces of Bluetooth-compatible hardware need to communicate on a regular basis, they can get together, a process also known as pairing or bonding. This means that they trust each other, so you don’t need to authorize every attempt at communication between the devices. Indeed, some devices won’t communicate unless they’re paired in this way.

Pairing is simple in practice and works on the principle of a shared personal ID number (PIN). The first Bluetooth device generates the PIN and then asks the second Bluetooth device to confirm it. After the user has typed in the PIN, the devices are paired. Pairing is easily accomplished under Ubuntu and doesn’t require any additional software.

As an example, the following are the steps for bonding a mobile phone to an Ubuntu PC. Bonding for devices without a user interface, such as keyboards, is handled differently.

1. Ensure that the Ubuntu PC is visible, which is to say that other Bluetooth devices can detect it. Click the Bluetooth icon in the notification area, select Preferences, and make sure that theMake computer visible checkbox is selected. Click Close.

2. You can pair up two devices from either end, but we’re going to begin using Ubuntu. To do this, click the Bluetooth icon in the notification area and select “Set up new device.” This launches the Bluetooth New Device Setup. Click the Forward button.

3. The device setup probes the ether and finds any connectable devices. These will appear first as a series of numbers and then using their friendly names.

Screenshot from 2020-06-05 21-55-47

Figure  A pairing request is easily accomplished through the Bluetooth applet.

4. Select the device you want to connect to and click Forward. By default a random five-digit PIN code is created and transmitted, although if you want you can create a custom one by clicking PIN options. The setup window will display this number, and you should receive a prompt on the phone showing the same number and asking if you want to pair with this as a trusted device. Confirm that on your phone and click the Matches button in the Ubuntu setup (fairly soon or it will time out!). The two devices will now be paired.

Transferring Files Between Bluetooth Devices

If you own a Bluetooth-equipped camera phone, you might be used to transferring pictures to your computer using Bluetooth. It’s by far the easiest way of getting pictures off the phone and avoids the need for USB cables or card readers. To transfer files via Bluetooth, you can use the Bluetooth applet.

Browsing Files on a Remote Device

The easiest way to get files to or from a device is to use Nautilus:

1. Click the Bluetooth icon in the notification area and select Browse Files on Device.

2. Choose your phone (or other device) from the list and click Browse. You may need to confirm the action on your phone by selecting Yes.

3. The File Browser opens up with the folders available on the device. You can then navigate through these and copy files to your Desktop in the usual drag-and-drop fashion. You can also add files to the phone in the same way.

Screenshot from 2020-06-05 21-59-39

Figure. You can use the File Browser to access a Bluetooth device.

Sending Files from an Ubuntu PC to Another Device

There are two ways to send files to another Bluetooth device from your Ubuntu PC. The first is to use the Bluetooth applet. The second is to right-click the file in question and select Send To. The second method is useful if you want to send many files at once, and you will have the option of automatically zipping the files into a single archive (but bear in mind that the Bluetooth device receiving the file will need to be able to subsequently unarchive the file).

Using a Bluetooth Keyboard or Mouse

Your Bluetooth-equipped keyboard or mouse may work automatically under Ubuntu. However, if not, you may need to pair it to your PC, as follows:

1. Ensure that the Ubuntu PC is set to be discoverable. Click the Bluetooth icon in the notification area, click Preferences, and make sure that the “Make computer visible” check box is selected. Click Close.

2. Switch your keyboard or mouse to discoverable mode. Read the instructions for your device to find out how this is done. On an iGo Stowaway keyboard we used during testing, this required pressing the Ctrl+blue Fn+green Fn keys simultaneously.

3. While you’re reading the manual, find out whether the device has a default passkey. Mice almost certainly will (and it’s nearly always 0000), but keyboardsmight require you to type one manually when it comes to the pairing request.

4. Click the Bluetooth icon and select Preferences. Click the Set up new device button. Ubuntu will search for your input device. In you’re surrounded by multiple Bluetooth devices, you might find it useful to narrow down the search to input devices using the Device Type drop-down.

5. You should find that your keyboard or mouse is detected automatically and appears in the list below the Select Device heading (if not, ensure that it is still in discoverable mode and hasn’t switched itself off). Click the entry for the keyboard or mouse, and then click the Forward button.

6. A comment box should pop up on the Ubuntu computer, notifying you of a pairing request between Ubuntu and the keyboard or mouse. Click the Enter Passkey button.

7. What happens next depends on whether you’re trying to connect a keyboard or mouse. Bear in mind that the process of pairing quickly times out on the Ubuntu computer, so you need to complete the following steps without hesitation.

• In the case of a mouse, enter the passkey that you read earlier in the manual for the mouse. As mentioned, this is usually 0000. After you click OK, the mouse should be paired and should start working.

• Some keyboards also use a default passkey of 0000, and, if so, you can enter that, and the keyboard should be paired. However, some Bluetooth keyboards might require you to enter a passkey created on the computer. In the Authentication Request dialog box on the Ubuntu PC, type a random four-digit passkey—something like 1234 (although for security reasons, you might want to choose something that’s slightly less easy to guess). Click OK. On the Bluetooth keyboard, type the same number and press Enter. Following this, you should find that the keyboard is paired with the computer and will work.

8. Click Close in the Bluetooth Preferences dialog box.

If the keyboard or mouse does not work after a reboot, try turning it on and off again. If that doesn’t work, deactivate the Bluetooth functionality on the PC, perhaps by momentarily unplugging the Bluetooth dongle or, on a notebook, using the relevant keyboard combination to turn off and on again the Bluetooth system.