Git Product home page Git Product logo

Comments (3)

protist avatar protist commented on September 27, 2024 1

Thank you @jrouleau for the detailed explanation.

Sorry, I should have mentioned that I had subsequently gotten my system working. I previously had the kernel parameter btusb.enable_autosuspend=n, but after changing the =n to =0, it now works as expected. I think I had previously found advice to use =n somewhere, but this didn't seem to work. Now, even without bluetooth-autoconnect, it seems to autoconnect fine in KDE Plasma.

Thanks again.

from bluetooth-autoconnect.

protist avatar protist commented on September 27, 2024

Does this currently not work with pipewire at all? I'm on Arch Linux using pipewire, pipewire-pulse, and wireplumber, and it doesn't seem to work for me. I installed the package, enabled and started bluetooth-autoconnect.service, then tried the following, but it didn't seem to work.

$ systemctl --user enable --now pulseaudio-bluetooth-autoconnect
Unit /usr/lib/systemd/user/pulseaudio-bluetooth-autoconnect.service is added as a dependency to a non-existent unit pulseaudio.service.

My Bluetooth headset didn't automatically connect next time I tried.

I then tested modifying the pulseaudio-bluetooth-autoconnect.service, changing all references of pulseaudio.service to pipewire.service. I started the service, but it immediately completed.

$ systemctl --user status pulseaudio-bluetooth-autoconnect
β—‹ pulseaudio-bluetooth-autoconnect.service - Bluetooth autoconnect service for pipewire
     Loaded: loaded (/usr/lib/systemd/user/pulseaudio-bluetooth-autoconnect.service; enabled; preset: enabled)
     Active: inactive (dead) since Mon 2022-08-15 15:23:06 AEST; 20h ago
   Duration: 85ms
    Process: 3262118 ExecStart=/usr/bin/bluetooth-autoconnect (code=exited, status=0/SUCCESS)
   Main PID: 3262118 (code=exited, status=0/SUCCESS)
        CPU: 77ms

Aug 15 15:23:06 my-hostname systemd[1098]: Started Bluetooth autoconnect service for pipewire.

The service file contains the following:

ExecStart=/usr/bin/bluetooth-autoconnect

So I tested running this manually. Again it just completes immediately. I'm not really sure if this is the command we should be running, so I tested bluetooth-autoconnect -d instead. This indeed stayed open… but my headset didn't automatically connect next time I tried.

On further testing, I should note that bluetooth-autoconnect and bluetooth-autoconnect -d do work if have recently used Bluetooth. However, after not using Bluetooth for a while, the latter does not work at least. Perhaps relevant, I do have Bluetooth's auto-suspend disabled.

$ cat /proc/cmdline
BOOT_IMAGE=/vmlinuz-linux root=UUID=<redacted> rw loglevel=3 cryptdevice=UUID=<redacted>:cryptroot:allow-discards root=/dev/mapper/cryptroot btusb.enable_autosuspend=n

from bluetooth-autoconnect.

jrouleau avatar jrouleau commented on September 27, 2024

@protist

This script is effectively the same as runnning bluetoothctl connect <device_mac> for every paired+trusted device either as a oneshot with bluetooth-autoconnect or whenever an adapter powers on with bluetooth-autoconnect -d. This will not magically connect devices that do not announce themselves or are brought in from out of range. Oneshot attempts can be triggered manually whenever you like with bluetooth-autoconnect (e.g. I have the bluetooth icon on my bar trigger bluetooth-autoconnect when clicked for manual "scanning"). The daemon mode is used to connect when an adapter is powered on: pimarily during boot or when resuming from sleep/hibernation.

The pulseaudio-bluetooth-autoconnect service is intended to be a oneshot script that triggers a connection attempt after pulseaudio is started as headsets fail to connect prior to the audio system running and is only relevant during boot. A similar oneshot service would likely be needed for pipewire to autoconnect during boot. I do not have any systems running pipewire so I am unable to test this at this time.

Again, this script is effectively just a wrapper around bluetoothctl connect <device_mac>. Other than providing a convenience service to run itself after pulseaudio starts (manually running bluetooth-autoconnect once after boot would have the same effect), it has nothing to do with which audio system you use. Issues connecting to your devices (i.e. bluetooth-autoconnect says connecting to device ... but the connection fails) are outside the scope of what we can support here. If a connection attempt is not made, ensure that the device is both paired and trusted and that the adapter is connected and powered on.

from bluetooth-autoconnect.

Related Issues (19)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.