From 518b0ce716fe963f4215a1898a5279dc45f9dc1c Mon Sep 17 00:00:00 2001 From: Jeroen Hofstee Date: Thu, 6 Feb 2025 10:23:12 +0100 Subject: [PATCH] udev: bluetooth: make sure btmgmt has a stdin btmgmt can hang when run from udev. Commit 21a5b427de44092b38c "udev: bluetooth: start bt-config in a shell" tried to solve that by starting a proper shell for the script, but that prevents the script from blocking since it is not executed in the first place, since an absolute path needs to be given for udev to correctly run it. So instead pipe yes into btmgmt. btmgmt doesn't actually read from stdin though, but without it, it can hang indefinitely. For completeness, this is introduced somewhere after bluez version v5.55, that version works without this workaround. --- meta-venus/recipes-core/udev/files/bt-config | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/meta-venus/recipes-core/udev/files/bt-config b/meta-venus/recipes-core/udev/files/bt-config index db31ec306..1cc6e9b9b 100644 --- a/meta-venus/recipes-core/udev/files/bt-config +++ b/meta-venus/recipes-core/udev/files/bt-config @@ -34,8 +34,9 @@ if hciconfig $HCI | grep -qw RAW; then usleep 200000 fi -btmgmt -i $HCI le on -btmgmt -i $HCI bredr off +# btmgmt can hang when started by udev. Piping with yes prevents that. +yes | btmgmt -i $HCI le on +yes | btmgmt -i $HCI bredr off # start services, or restart them if already running services="/service/dbus-ble-sensors /service/vesmart-server"