LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Ubuntu (https://www.linuxquestions.org/questions/ubuntu-63/)
-   -   Want to set up an automatic bluetooth connection (https://www.linuxquestions.org/questions/ubuntu-63/want-to-set-up-an-automatic-bluetooth-connection-4175563921/)

thethinker 01-14-2016 08:27 AM

Want to set up an automatic bluetooth connection
 
Running Xubuntu 14.03 on a MacBook Pro. In order to get my bluetooth speaker connected and working, I need to perform the following steps:

1) Turn on the speaker (it then appears in bluetooth device list, but not in sound device list)
2) Run the command

Code:

pactl load-module module-bluetooth-discover
3) Open bluetooth connections. It claims that the speaker is connected via "Headset Service", but it does not appear in the sound device list. If I disconnect this service, run the setup assistant, and choose A2DP Sink, the connection becomes active (now appears in sound device list).
4) Goto Volume Control, Output Devices, and set the bluetooth speaker as Fallback. (whatever this means exactly, there is a green check mark, currently on my internal speakers, which I then switch over to the bluetooth).
5) Now I click play on something (say Amazon streaming) and the sounds comes through the speaker. The volume controls on the keyboard work as well, which is cool.

The behavior I would like is to default to the bluetooth speaker whenever I turn it on. It seems like this might be possible, since it shows up in the bluetooth menu as soon as I turn the power on, but I need to load the module, manually make the connection, and also set it to default (fallback?). Anyone have a suggestion?

NOTE: I tried this question as the Ubuntu forums and they moved it over to "Mac Hardware" before I could get any useful advice. I don't see this as a hardware problem, since I *can* get it working via a software solution. I want to automate that solution!

jon lee 01-14-2016 01:07 PM

You can goto <preferences>, <Startup Applications>, <add>
name and comment whatever, but the command field to be:
Code:

bash -c "sleep 7; pactl load-module module-bluetooth-discover"
I put a fairly long sleep period in there because there's a bit of a race condition somewhere and occasionally it doesn't work like it should.

With that done, when the speaker is turned on (most of the time) it connects automatically. I still have to switch the default sink in the volume control to bluetooth manually though. So if anyone has a solution for that bit...

thethinker 01-15-2016 01:41 PM

Quote:

Originally Posted by jon lee (Post 5478187)
You can goto <preferences>, <Startup Applications>, <add>
name and comment whatever, but the command field to be:
Code:

bash -c "sleep 7; pactl load-module module-bluetooth-discover"

So that's a good solution to loading the module, but that doesn't make my speaker show up in the volume control panel - I still have to go into bluetooth connections, disconnect the headset service, run A2DP Sync, and click the green button in volume control.

jon lee 01-15-2016 05:05 PM

Quote:

Originally Posted by thethinker (Post 5478785)
So that's a good solution to loading the module, but that doesn't make my speaker show up in the volume control panel - I still have to go into bluetooth connections, disconnect the headset service, run A2DP Sync, and click the green button in volume control.

I use the MATE desktop which may be setup a little better. It uses Blueman Device Manager which enables for automatic connections (once paired and trusted). The only thing I have to do is select the sink in pasystray (Pulse Audio System Tray), to get my volume control. I don't know what your answer would be for the Unity desktop. I have a feeling there's not much of one, but I could most certainly be wrong.


All times are GMT -5. The time now is 08:10 AM.