Bluetooth auto connect linux

Autoconnect to a bluetooth speaker in Ubuntu 16.04

BT is enabled at startup. This is nice. But it will not autopair/connect to a device, even if it is once paired and get status «trusted». I can connect to a Speaker with the tool by selecting device, and «connect to audio output». How can this done automatically on boot? I can do this also with «bluetoothctl» and than «connect «, but this is interactive, seems not scriptable. And second step is, that BT becomes default audio sink.
Isn’t that all an ordinary use case? (I found some pages here, most are outdated.) Autoconnecting Bluetooth Devices: load-module module-switch-on-connect doesn’t work for me. I also installed bt-autoconnect. But several issues: — it didn’t foun the BT-Adapter — Button Audio-Setting does just nothing — Save and quit doesn’t just nothing

Agreed this would be very nice. This discussion looks relevant. I’m testing the solution for pulseaudio>1.0. Looking at your answer, I guess you’ve already seen it.

7 Answers 7

If you then enter help , you’ll see the commands to be used.

  • ‘list’ (devices)
  • ‘trust 78:44:aa:bb:cc:dd’ (MAC address of device)
  • ‘info 78:44:aa:bb:cc:dd’ (MAC address of device)
  • ‘paired-devices’

It didn’t work for me. I successfuly trusted the device, but it doesn’t connect to it automatically. When I run info one of the lines I see: Paired: yes, Trusted: yes, Connected: no

For automatic connect to Audio Sink you can add the following line in /etc/rc.local :

(sleep 6; echo "connect AA:BB:CC:DD:EE:FF\nquit" | bluetoothctl) & 

Update the address. You can verify from command line by:

echo -e "devices\nquit" | bluetoothctl 

In my case sleep 6 is enough — but maybe on your computer it has to be increased to allow other bluetooth connection steps to be fully completed.

Generally with & sign at the end you will start process which will be executed in 6sec not blocking next processes starting normal bluetooth connection functions. If the rc.local is not existing (it was in my case) you can create it or to initiate at startup with other file.

For the second part (auto switch to BT speaker as a sink) I found a solution. Has been already posted here:

# /etc/pulse/default.pa .ifexists module-bluetooth-discover.so load-module module-bluetooth-discover load-module module-switch-on-connect # this is new! .endif 

BUT: How can the BT server automatically pair with the speaker, as soon as it is available? HELP!

Читайте также:  Alpine cde 9882ri есть блютуз

Edit: found a (not the best imho) solution for the first question:

echo "connect AA:BB:CC:DD:EE:FF" | bluetoothctl 

BUT: Even better would be that this works without this MAC for all ever devices that has been connected and trusted.

I wrote a simple script that will keep reconnecting the device when you reboot your PC or when the device toggles bluetooth status or lose a signal for a while.

#!/bin/bash MAC="E0:CC:F8:E8:87:5D" powered() < echo "show" | bluetoothctl | grep "Powered" | cut -d " " -f 2 >connected() < echo "info $" | bluetoothctl | grep "Connected" | cut -d " " -f 2 > while true do sleep 1 if [ $(powered) = yes ] && [ $(connected) = no ]; then echo "connect $" | bluetoothctl sleep 5 fi done 
  1. Update MAC variable with your device’s MAC address. (speaker, smartphone. )
    echo «devices» | bluetoothctl | grep Device
  2. Save the script for example as a ~/.bt-autoconnect.sh
  3. Make it executable chmod +x ~/.bt-autoconnect.sh
  4. Run it at login echo «~/.bt-autoconnect.sh &» >> «~/.xprofile»

In Ubuntu sound-problems are due to installed drivers. If this speaker is the newest and most trendiest hardware, you have no good chances and would have to wait 2 to 8 months until driver is present at Linux Community. But you could try to install following packages in terminal :

sudo apt-get install amarok rhythmbox

reboot

Then switch on bluetooth and see if your speaker is supported :

  • Open the Activities overview and start typing Bluetooth.
  • Click on Bluetooth to open the panel.
  • Set the switch at the top to ON.

Good luck or be patient for at maximum 8 months.

His Q was nothing to do with drivers or sound «problems». It was to do with configuring auto-connect. Suggesting waiting for an arbitrary few months hardly the stuff of Stack Exchange.

In my case this Script works (I tried all setting but not work for me,Step 5 from Here)

Python script on GitHub called bluetooth-autoconnect. It’s a python script that automatically connects to all paired and trusted Bluetooth devices. However, the script is not available to install directly on Flatpak or Apt repository. Hence, we need to manually download and configure the service.

download the zip file from GitHub or use the following command to clone the repository to your home directory.

git clone https://github.com/jrouleau/bluetooth-autoconnect.git 

Now that we have the repository downloaded we need to move the service and scripts to their respective location before we start the service. In systemd architecture:-

sudo cp bluetooth-autoconnect/bluetooth-autoconnect.service /etc/systemd/system/ sudo cp bluetooth-autoconnect/bluetooth-autoconnect /usr/bin/ 

Once, we have successfully copied the service to the respective directories, let’s enable and start the service. To do that, use the following command.

sudo systemctl enable bluetooth-autoconnect.service sudo systemctl start bluetooth-autoconnect.service 

Now remove and reconnect and Done.

The only caveat with this method is that you won’t be able to pair your Bluetooth device with other systems without switching off your Linux machine’s Bluetooth.

Источник

Читайте также:  Беспроводная клавиатура блютуз майкрософт

Автоподключение bluetooth-устройств

Столкнулся с проблемой. Суть в том, что подключенное bluetooth-устройство после перезапуска компьютера не подключается само. Требуется снова подключить его вручную. Похоже, что проблема общая для всего семейства Ubuntu 18.04 и дистрибутивов на его основе. Работоспособность решения проверена в Elementary OS Juno Beta 2.

Обновлено! Обратите внимание, что данная проблема была решена на уровне самой системы. Когда я ставил релиз Elementary OS Juno, то всё работало сразу из коробки. Я не знаю точно, была ли это проблема Ubuntu или Elementary OS. Данное руководство решил оставить, т.к. здесь показан ручной способ работы с устройством Bluetooth. Это может пригодиться.

Bluetooth-устройство пока не подключаем. Далее приведённые команды вводим в консоли. Права root не нужны.

Запускаем программу для работы с bluetooth:

Консоль не трогаем. Подключаем нужное bluetooth-устройство стандартными средствами. Я делаю это в Elementary OS через верхнее меню. За результатом наблюдаем в консоли:

[CHG] Device 00:1F:20:E1:B3:B7 Connected: yes [CHG] Device 00:1F:20:E1:B3:B7 ServicesResolved: yes

Так отображается успешное подключение. Нам важно было получить код устройства. Теперь мы просто добавим это устройство в число доверенных:

И пробовать перезапускать компьютер.

d1mon@d1monNB:~$ bluetoothctl Agent registered [CHG] Device 00:1F:20:E1:B3:B7 Connected: yes [CHG] Device 00:1F:20:E1:B3:B7 ServicesResolved: yes [Bluetooth Mouse M557]# trust 00:1F:20:E1:B3:B7 [CHG] Device 00:1F:20:E1:B3:B7 Trusted: yes Changing 00:1F:20:E1:B3:B7 trust succeeded [Bluetooth Mouse M557]# exit

Может быть полезным обновить софт для bluetooth до последней версии:

sudo add-apt-repository ppa:bluetooth/bluez sudo apt update sudo apt upgrade bluez

Источник

arch linux bluetooth auto connect

How do I get my Bluetooth to connect automatically?

  1. Swipe down from the top of the screen.
  2. Make sure Bluetooth is turned on.
  3. Touch and hold Bluetooth .
  4. Tap Device name. .
  5. Enter a new name.
  6. Tap Rename.

How does Bluetooth Auto Connect work?

By default, the app will automatically connect to your devices when you activate Bluetooth on your Android device, but you can choose to connect when you unlock the screen, or even when you charge your phone. Bluetooth Auto Connect is a very useful app that makes it easier to connect and manage your Bluetooth devices.

How do I start bluetooth daemon in Linux?

  1. Start the bluetooth daemon. Go to your terminal and type : sudo /etc/init.d/bluetooth start.
  2. Reinstall packages. If this doesn’t work, go to your terminal and type : sudo apt-get purge blueman bluez-utils bluez bluetooth sudo apt-get install blueman bluez-utils bluez bluetooth.

What is bluetooth daemon?

Bluetooth is a short range wireless protocol that is used to connect to various low bandwidth I/O devices (like keyboards, mice, headsets). . The Bluetooth solution is composed of a userspace daemon, bluetoothd, that communicates through a management port in the kernel to the hardware drivers.

Читайте также:  Приложения для блютуз рулетки

Why won’t my Bluetooth connect automatically?

Sometimes apps will interfere with Bluetooth operation and clearing the cache can solve the problem. For Android phones, go to Settings > System > Advanced> Reset Options > Reset Wi-fi, mobile & Bluetooth.

Can someone connect to my Bluetooth without me knowing?

In most Bluetooth devices it is impossible to know that someone else connected to the device unless you are there and see it yourself. When you leave your device’s Bluetooth on, anyone around it can connect.

How do I stop my Bluetooth from automatically connecting to my car?

And I could simply turn off the Bluetooth..and it would stay off. Take a look under Settings > Connected devices > Connection preferences > Driving mode > Turn on automatically > Advanced to see if the Turn on Bluetooth automatically option is active.

How does auto connect work?

Auto Reconnect allows your VPN connection to automatically reconnect if there is any connection failure. If you have a preferred server location selected, then Auto Reconnect will attempt to reconnect you to that server.

How do I automatically connect to Bluetooth Windows 10?

  1. Press Windows Key + R Key.
  2. Type services. msc and scroll down to Bluetooth Support Service in the list.
  3. Right click on it and select Properties.
  4. Set up Start up type to Automatic from the dropdown list.

How do I connect a Bluetooth device to Linux?

To get a Bluetooth device working with Blueman, first click the Bluetooth icon in the system tray. Then, click the “search” button to search for a device. When a device appears, select it with the mouse, then click “setup”. The Blueman tool will take you through the pairing process.

How do I know if my Bluetooth is on Linux?

  1. Open a terminal.
  2. Type ‘dmesg | grep -i blue’ and hit Enter.
  3. If you see a return listing hardware, you have Bluetooth. If you don’t see a hardware listing, you don’t.

How do I use Bluetooth on Linux?

  1. Open the Activities overview and start typing Bluetooth.
  2. Click on Bluetooth to open the panel.
  3. Make sure Bluetooth is enabled: the switch at the top should be set to on. .
  4. Make the other Bluetooth device discoverable or visible and place it within 5-10 meters (about 16-33 feet) of your computer.

Best Gigabit Switches for Home Network

Switch

Top Ethernet switchesBest forModelNumber of gigabit portsOur pickLinksys SE30088Best valueTP-Link TL-SG1088Best gaming switchNETGEAR Nighthawk S80008B.

The 6 Best Linux File Recovery Software

Recovery

Which Linux is best for data recovery?Which recovery software is best?How recover data from hard drive in Linux?How do I install Ubuntu recovery softw.

How To Install Memcached on Ubuntu 20.04

Memcached

How do I install memcached?How install memcache in Linux?How do I install memcached using package manager?How do I enable Memcached in cPanel?How do I.

Latest news, practical advice, detailed reviews and guides. We have everything about the Linux operating system

Источник

Оцените статью
Adblock
detector