The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 906 - File: showthread.php PHP 7.2.34 (Linux)
File Line Function
/showthread.php 906 errorHandler->error



Thank you for your donation!


Cloudsmith graciously provides open-source package management and distribution for our project.


Auto-trust bluetooth devices
#1
Note: This was originally posted to the moode Git repo issue tracker by user @aero31aero but I though I'd move it here in case anyone has interest. Refer to https://github.com/moode-player/moode/issues/614

============

Hi, I'm not sure if you're already aware of this, but apparently Linux's bluetooth stack itself doesn't play well with 'untrusted' devices. 

This has been my experience back with my old laptop as well as now with Moode.

Without trusting the devices, my phones aren't able to reliably connect to Moode's bluetooth despite having been successfully paired. I didn't dig deep into the logs so I don't know what the exact errors are, but on the phone end, there are no error messages; they just fail to connect.

I've been using a particular fix for ~2 years now which I've now had to redeploy on my new installation too, so I thought I'd share:

Code:
$ tail -n +1 auto-trust*
==> auto-trust.service <==
[Unit]
Description=Auto trusts all paired bluetooth devices.
Wants=auto-trust.timer

[Service]
Type=oneshot
ExecStart=/home/pi/auto-trust.sh

[Install]
WantedBy=multi-user.target

==> auto-trust.sh <==
#! /usr/bin/env bash
for mac in $(sudo bluetoothctl devices | awk '/^Device/ {print $2}'); do sudo bluetoothctl trust $mac;done

==> auto-trust.timer <==
[Unit]
Description=Auto trust bluetooth devices.
Requires=auto-trust.service

[Timer]
Unit=auto-trust.service
OnUnitInactiveSec=10s
OnBootSec=10s

[Install]
WantedBy=timers.target

My solution is definitely a hack, but I figure you folks would be able to implement something cleaner with this info. Much thanks!
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply


Messages In This Thread
Auto-trust bluetooth devices - by Tim Curtis - 06-22-2023, 11:55 AM
RE: Auto-trust bluetooth devices - by Tim Curtis - 06-22-2023, 06:11 PM

Forum Jump: