Skip to content

Commit

Permalink
udev: bluetooth: make sure btmgmt has a stdin
Browse files Browse the repository at this point in the history
btmgmt can hang when run from udev. Commit 21a5b42
"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.
  • Loading branch information
jhofstee committed Feb 6, 2025
1 parent f21987f commit 518b0ce
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions meta-venus/recipes-core/udev/files/bt-config
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 518b0ce

Please sign in to comment.