toy / blueutil

CLI for bluetooth on OSX: power, discoverable state, list, inquire devices, connect, info, …
https://github.com/toy/blueutil
Other
1.01k stars 53 forks source link

blueutil -p 1 returns Failed to switch bluetooth power on in 10 seconds #78

Closed aleixsr closed 1 year ago

aleixsr commented 1 year ago

On Ventura 13.3 i got this error : "Failed to switch bluetooth power on in 10 seconds" when running "blueutil -p 1". I need to run it after sleep because BT doesn't wake up.

Running this script works fine, but it needs sudo:

pgrep bluetooth | xargs sudo kill sudo launchctl list | grep -i blue | awk '{ print $3 }' | xargs sudo launchctl stop sudo launchctl list | grep -i blue | awk '{ print $3 }' | xargs sudo launchctl start

toy commented 1 year ago

Could you please clarify what do you mean by «BT doesn't wake up»? Was it on before sleep and is off on wake up?

aleixsr commented 1 year ago

Yes exactly, it was on before sleep, then I close the lid of my laptop, it sleeps and later, when I open the lid, it wakes up but bluetooth is off and I cannot enable it neither blueutil nor System Preferences > Bluetooth > Turn Bluetooth On/Off.

UPDATE: Also, having BT working finw and if I try to run "blueutil -p 0 && sleep 10 && blueutil -p 1" I got "Failed to switch bluetooth power on in 10 seconds".

Thanks for your help.

toy commented 1 year ago

Original issue feels like related to bluetooth internals, so not sure if blueutil would be able to do something. Are you able to switch power from the menu bar or preference pane after sleep? Same question for when blueutil -p 0 && sleep 10 && blueutil -p 1 fails

aleixsr commented 1 year ago

You're right, it is not blueutil related, I cannot turn on BT using switcher from preference pane, sorry about that.