On 17 Nov 2020, at 09:48, Hetz Ben Hamo <hetz(a)hetz.biz> wrote:
Ed, great idea and it works! Thanks a lot!
On Tue, Nov 17, 2020 at 11:43 AM Ed Greshko <ed.greshko(a)greshko.com
<mailto:ed.greshko@greshko.com>> wrote:
On 17/11/2020 17:32, Hetz Ben Hamo wrote:
> Hi,
>
> I have a sound bar which is using bluetooth. My problem is that while my machine
(Fedora 33) starts and bluetooth is starting, it doesn't auto pair and I have to click
"connect" manually each boot.
>
> So I'm trying to create a workaround. I've created a simple systemd file
which runs a script that uses bluetoothctl to pair between the two.
>
> My systemd file looks like this:
>
> [Unit]
> Description=Fix Pulse Audio
> After=bluetooth.target
> Requisite=bluetooth.target
>
> [Service]
> ExecStart=/usr/local/bin/fixaudio.sh
> User=hetz
> Type=Simple
>
> [Install]
> WantedBy=multi-user.target bluetooth.target
>
> My script (fixaudio.sh):
>
> #!/bin/bash
>
> sleep 3
> echo "Trying to pair...."
> rm -f /tmp/fix.log
> bluetoothctl connect C4:30:18:A0:2F:33 > /tmp/fix.log
>
> The problem: any time I try to restart the bluetooth service, it ignores this
systemd file (and yes, it's enabled and I ran systemctl daemon-reload)
>
> I tried to edit the bluetooth.service file and add BindsTo=fix.service (which is the
name of the systemd file), but as soon as I ran the systemctl daemon-reload - it restarted
the bluetooth in a loop.
>
>
A different approach would be to copy the /lib/systemd/system/bluetooth.service file to
/etc/systemd/system.
This provides an override to the system default file which may be overwritten on an
update.
Then add the ExecStartPost= directive to the Service section.
See
https://www.freedesktop.org/software/systemd/man/systemd.service.html
<
https://www.freedesktop.org/software/systemd/man/systemd.service.html> for details.
Its usually better to use this:
systemctl edit bluetooth.service
and then just add the lines that you need to override.
[Service]
ExecStartPost=/usr/local/bin/fixaudio.sh
this creates a drop in file that means that you do not have to worry about any
improvements
to bluetooth.service that could be updated by fedora.
Barry
---
The key to getting good answers is to ask good questions.
_______________________________________________
users mailing list -- users(a)lists.fedoraproject.org
<mailto:users@lists.fedoraproject.org>
To unsubscribe send an email to users-leave(a)lists.fedoraproject.org
<mailto:users-leave@lists.fedoraproject.org>
Fedora Code of Conduct:
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
<
https://docs.fedoraproject.org/en-US/project/code-of-conduct/>
List Guidelines:
https://fedoraproject.org/wiki/Mailing_list_guidelines
<
https://fedoraproject.org/wiki/Mailing_list_guidelines>
List Archives:
https://lists.fedoraproject.org/archives/list/users@lists.fedoraproject.org
<
https://lists.fedoraproject.org/archives/list/users@lists.fedoraproject.o...
_______________________________________________
users mailing list -- users(a)lists.fedoraproject.org
To unsubscribe send an email to users-leave(a)lists.fedoraproject.org
Fedora Code of Conduct:
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines:
https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives:
https://lists.fedoraproject.org/archives/list/users@lists.fedoraproject.org