22
May
2020
Enabling Bluetooth on Linux
19:12

Enabling Bluetooth on Linux

22 May 2020 19:12

In order to transfer files from a smartphone to a personal computer or output sound from a PC to a Bluetooth speaker or headphones, you need to connect the Bluetooth USB adapter to the computer, turn on and configure Bluetooth. This article is about how to enable Bluetooth in Linux.

First of all, you need to connect the USB Bluetooth adapter to the computer, which I did before turning on the computer.

Then, installed the necessary packages:

sudo apt-get install blueman bluez pulseaudio-module-bluetooth

Started the service in Ubuntu:

sudo /etc/init.d/bluetooth start

To start a service, you can also use the service command

sudo service bluetooth start

Answer:
[ ok ] Starting bluetooth (via systemctl): bluetooth.service.

In the program menu I found "Bluetooth Manager":

  • "Bluetooth must be turned on for the device manager to work"
  • pressed "Enable Bluetooth"

After which the Bluetooth icon appeared in the system tray (next to the clock and keyboard switch).
(If the Bluetooth icon does not appear, in the session startup options, enable "blueman-applet", end the session and log in again.)

If you click on the icon, a menu will open.

bluetooth

I launch the submenu "Adapters...".

The “Adapters not found” window may appear (even though the adapter was connected previously).

The same thing happens if you pull out the adapter and insert it back. Team hcitool dev

does not find the device.

Solution:

    1. Removed and reconnected the adapter to USB.bluetooth adapter after about 15 seconds, the Bt icon appeared in the tray.
  1. If the icon has a red cross, simply turn on Bluetooth in the context menu.
    ON

  2. Launched the Bluetooth Manager program


In the "Bluetooth Manager" (the leftmost icon in the system tray) item
System tray -Bluetooth - Adapters....

  • Enabled item "Always visible."
  • Pressed the button Close to apply the changes.

Now everything is set up. From my smartphone I tried to transfer the file to my computer using Bluetooth (selected a picture and clicked "Share" or "Forward" - through Bluetooth).

On the computer, the green Bt icon turned on in the tray, and a dialog box appeared about receiving the file.
receive

Confirmed receipt of the file. After some time, about half a minute, a notification appeared indicating that the file had been successfully received.

What folder did the file fall into?
To your home folder, to a subdirectory "Downloads".

Here is the file received via Bt:
example


Installing the blueman package adds an applet for launching "Bluetooth Manager" to the startup/autostart of a Linux session, this applet is called blueman-applet.

The Bt icon will be displayed in the system tray the next time you log in or start the system.
autostart

The Bluetooth configuration program is called "Blueman-Manager" (from the blueman package):

blueman-manager

For it to work, two conditions must be met:

  1. Bluetooth adapter connected
  2. bluetooth service (BlueZ) is running.

Addition from 03/21/2023:

Output audio from computer to Bluetooth headphones

1) First, you need to turn off Bluetooth in your smartphone so that your headphones cannot connect to it.
2) Then turn on the earphone and insert it into your ear. You will hear a message indicating that you are ready to connect: “Pairing”.
3) On your PC, use the Bluetooth applet to search for nearby devices.
4) Select a device from the list - Bluetooth earphone and connect to it.
naushnik
To connect, double-click on the device name.
5) Reduce the level with the volume control to 50%.
6) Start playing, for example, an Internet radio station:

sudo apt install mpv
mpv https://hls-01-radiorecord.hostingradio.ru/record-eurodance/112/playlist.m3u8


Related publications