Ksares
Posts: 1
Joined: Wed Aug 21, 2019 9:46 am

Power On just one bluetooth device

Wed Aug 21, 2019 9:53 am

Good morning,

I have a Raspberry Pi to which a bluetooth dongle is connected. First of all, I know it doesn't make sense. Now, I have noticed that the Rpasberry defaults to the dongle as its bluetooth device. I want to programatically turn on the Raspberry's own device before the dongle, preferrably using a script to do so.

This following script is as far as I've gotten, but with not much success.

Code: Select all

service bluetooth start

coproc bluetoothproc {
        bluetoothctl
}
result=$(echo 'power on' >&"${bluetoothproc[1]}")

read line <&"${bluetoothproc[0]}"

while read -t 1 -u "${bluetoothproc[0]}" line; do
    echo "$line"
done

result=$(echo 'discoverable on' >&"${bluetoothproc[1]}")

while read -t 1 -u "${bluetoothproc[0]}" line; do
    echo "$line"
done

Thank you very much

Return to “Troubleshooting”