From 8e654849a088d7e2843233e90a0994829de638d0 Mon Sep 17 00:00:00 2001 From: Sébastien Dailly Date: Wed, 18 Jun 2025 09:45:56 +0200 Subject: Updated the scripts to use common fonctions --- board/bluetooth.sh | 59 ++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 53 insertions(+), 6 deletions(-) (limited to 'board/bluetooth.sh') diff --git a/board/bluetooth.sh b/board/bluetooth.sh index 960468a..c1af995 100644 --- a/board/bluetooth.sh +++ b/board/bluetooth.sh @@ -16,7 +16,10 @@ PairableTimeout = 0 AutoEnable=true __EOF__ +# Accept any code from any connexion +echo "* *" > "${TARGET_DIR}/etc/bluetooth/pins" +# Run the Bluetooth agent cat << __EOF__ > "${TARGET_DIR}/etc/systemd/system/bt-agent.service" [Unit] Description=Bluetooth Agent @@ -26,18 +29,62 @@ Requires=bluetooth.service [Service] Type=simple ExecStartPre=bt-adapter --set Discoverable 1 -# see https://github.com/RPi-Distro/repo/issues/291 #ExecStart=bt-agent -c NoInputNoOutput -ExecStart=/bin/sh -c '/usr/bin/yes | /usr/bin/bt-agent --capability=DisplayOnly' -# Restart the service each 60s -WatchdogSec=60 -RestartSec=60 -Restart=always +ExecStart=bt-agent -p /etc/bluetooth/pins +## Restart the service each 60s +#WatchdogSec=60 +#RestartSec=60 +#Restart=always [Install] WantedBy=multi-user.target __EOF__ +enable_service "bt-agent.service" + +create_missing_dir "/etc/dbus-1/system.d/" +cat << __EOF__ > "${TARGET_DIR}/etc/dbus-1/system.d/bluetooth.conf" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +__EOF__ + +# Set permission to 755 in the directory /var/lib/bluetooth/ (prevent a +# permission error) +sed --in-place "s/0555/0755/" ${TARGET_DIR}/usr/lib/systemd/system/bluetooth.service + ## The same for the bluetooth, as bluetoothd keep a track for each paired device create_missing_dir "/var/lib/bluetooth/" #if ! grep -qE '/var/lib/bluetooth' "${TARGET_DIR}/etc/fstab"; then -- cgit v1.2.3