Results 1 to 2 of 2

Thread: Setting defaults for bluetooth PatriotBTSpeaker

  1. #1
    Join Date
    Jun 2008
    Location
    Lalaland
    Beans
    1
    Distro
    Ubuntu 8.04 Hardy Heron

    Setting defaults for bluetooth PatriotBTSpeaker

    Have to reset the bluetooth connection every time I turn the speaker on. There is no Autodetect function like there is in Windows.
    Also need to set the sound settings manually every time and it doesn't always work.
    Is there a way to make Ubuntu auto detect the speaker and load the correct sound settings?

  2. #2
    Join Date
    Jun 2007
    Beans
    17,337

    Re: Setting defaults for bluetooth PatriotBTSpeaker

    bluetooth in linux & ubuntu is overall terrible, ubuntu ignored many bugs for some time. (there are some pulseaudio fixes now, xenial-proposed & in 17.10
    Here in 16.04 & 17.10 it works ok once connected, both can have issues connecting (pairing is fine), many times I have to remove & re-add the device, (bluetooth speaker) before it stays connected..

    I've found 1 way to auto connect with proper output device but it seems fragile & ymmv would be a huge understatement. Also it doesn't appear to stay working if I boot to another Os & connect or auto-connect to the speaker. In that case usually have to again remove & re-add the device to get going.
    In other words this could be useless to some, works ok here
    ..
    Also note: this is just useful in the case where speaker is on & then one boots up computer which is the most likely case for me. (log in could also work


    Edit:
    As of recent in 16.04 I no longer need the startup script, only the /etc/pulse/default.pa edit.
    With that now if already in a session & bluetooth speaker is then powered on it will pair & connect..

    Only on 16.04 or up
    Basically a script & a startup app.
    (- script here marked exec & in ~/.bin, startup .desktop is in ~/.config/autostart.

    The XX:XX.. is replaced by actual device id, can be seen in bluetooth settings on the device or run just bluetoothctl in a terminal, should show up.

    script.
    (- the 2nd set is because here many times the device connects then disconnects within 7 sec, the 2nd set then holds.
    Sleep times are what works here, 12 secs on 2nd run makes sure if device is going to disconnect it actually has disconnected, otherwise 2nd run has no affect either way.
    Code:
    #!/bin/bash
    bluetoothctl 
    sleep 10
    echo "connect XX:XX:XX:XX:XX:XX" | bluetoothctl
    sleep 12
    echo "connect XX:XX:XX:XX:XX:XX" | bluetoothctl
    exit
    The startup .desktop
    The Exec= is the name of the above script, here named auto1

    Code:
    [Desktop Entry]
    Type=Application
    Exec=auto1
    Hidden=false
    NoDisplay=false
    X-GNOME-Autostart-enabled=true
    Name=auto1
    X-GNOME-Autostart-Delay=5
    Comment=Starts Bluetooth speaker
    To get pulse audio to behave -
    Code:
    sudo -H gedit /etc/pulse/default.pa
    Add this under the .ifexists module-bluetooth-discover.so section, shown in screen
    Code:
    .ifexists module-switch-on-connect.so
    load-module module-switch-on-connect
    .endif
    So here to set up 16.04,
    Put the script in ~/bin, marked exec
    Create with gedit, ~/.config/autostart/auto1.desktop
    Edit default.pa
    Open bluetooth settings, removed the speaker, then added it back, reconnected
    Reboot
    Here in unity it's then just watch the panel icon for the script activities,,, then try player, ect.
    Attached Images Attached Images
    Last edited by mc4man; November 20th, 2017 at 03:36 AM. Reason: No need anymore for start up script

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •