BluetoothConnector icon indicating copy to clipboard operation
BluetoothConnector copied to clipboard

disconnecting doesn't seem to be working if not passing --notify under Monterey

Open godbout opened this issue 3 years ago • 20 comments

weird, i know. but it seems to be the case. whether passing the --disconnect flag or not. adding --notify fixes it, but, well, notification.

godbout avatar Nov 26 '21 15:11 godbout

disconnect not working for me either, even if i pass --notify. Monterey 12.1 Beta (21C5039b)

alphabitnz avatar Nov 30 '21 01:11 alphabitnz

I am also experiencing this issue. Adding notify simply makes it say that it was successful in disconnecting. when checking the devices in settings it becomes apparent this is not the case.

Works fine for connecting. However will not connect if bluetooth is disabled. Spawns error saying failed to enable bluetooth.

As a workaround in the meantime I am just completely disabling bluetooth. Not ideal, no but if you don't need it for other things, it works.

Here's what I use for disabling bluetooth: blueutil Link: https://github.com/toy/blueutil

(Disable): blueutil -p 0 (Enable): blueutil -p 1

--------Debug Info-------- Monterey 12.0.1 2018 MacBook Pro 15" Intel Core i7, 2.6 GHz 1 TB 16GB RAM

BluetoothConnector Version: 2.0.0

CHigginbotham avatar Dec 06 '21 04:12 CHigginbotham

As a workaround in the meantime I am just completely disabling bluetooth. Not ideal, no but if you don't need it for other things, it works.

Here's what I use for disabling bluetooth: blueutil Link: https://github.com/toy/blueutil

Good tip there about blueutil, also I found something for you on their issues page - instead of disabling bluetooth you can use their disconnect function which I can confirm is working if you use the following syntax (replace 24-d0-df-85-28-62 with your device's MAC):

blueutil --disconnect '24-d0-df-85-28-62' --wait-disconnect '24-d0-df-85-28-62'

Hopefully this info may assist BluetoothConnector devs with a workaround for their tool also

alphabitnz avatar Dec 07 '21 07:12 alphabitnz

Wow thanks for the tip! It works! I think I tried that a while back and must not have been doing it properly.

CHigginbotham avatar Dec 07 '21 19:12 CHigginbotham

Ouch, same issue here. Hope a fix is discovered - use this all the time in Alfred...

edit: I made a small patch to fix compilation error, #21 but even compiling with latest tools (using M1 Mac Mini on 12.1 / Xcode 13.2.1) did not fix this issue. I looked at the code and can't see anything obviously wrong, so maybe just a bug in IOBluetooth

luckman212 avatar Dec 26 '21 20:12 luckman212

Didn't mean to close this issue. I could reproduce. Not sure what's causing the problem here though. IOBluetoothDevice's closeConnection() just doesn't seem to do what it's supposed to do (and returns kIOReturnSuccess!)

lapfelix avatar Dec 29 '21 23:12 lapfelix

What Bluetooth devices are you folks having issues with? Is it AirPods? I just tried with macOS 12.3 (the first beta, build 21E5196i) and after disconnecting with BluetoothConnector my AirPods would often reconnect. Once I disabled the AirPods' automatic connection feature, --disconnect seems to work perfectly.

Might be because Apple fixed a but with Core Bluetooth in macOS 12.3, of it's an issue that only applies to AirPods and disabling the automatic connection fixes it (when "Connect to This Mac" is set to "When Last Connected to This Mac" in the Bluetooth settings).

lapfelix avatar Jan 31 '22 03:01 lapfelix

in my case AirPods (Pro) yeah.

godbout avatar Jan 31 '22 06:01 godbout

for me it was Logitech Z337 speakers

alphabitnz avatar Jan 31 '22 08:01 alphabitnz

@lapfelix I double checked, but already had my AirPods set to only reconnect when last connected. Just re-tested on 12.2.

luckman212 avatar Jan 31 '22 12:01 luckman212

Okay that's good news then, it means 12.3 probably fixes the issue everyone's been encountering with disconnections.

lapfelix avatar Jan 31 '22 21:01 lapfelix

I am now on 12.3 Beta (21E5196i) and blueutil was still experiencing the disconnect bug unless I passed the --wait-disconnect stuff as per the workaround, so possiblynot fixed by 12.3 as hoped.

I could test with bluetoothconnector but have run out of time for today

alphabitnz avatar Feb 01 '22 14:02 alphabitnz

some people seem to have the issue still on 12.3.1. anybody here? works fine for me.

godbout avatar May 07 '22 13:05 godbout

I used it to solve my problem blueutil Link: https://github.com/toy/blueutil

image image

kaqijiang avatar Aug 11 '22 06:08 kaqijiang

hi am on Monterey 12.5.1 (21G83) and needed the mentioned workaround or it wouldn't disconnect

srescio avatar Aug 27 '22 12:08 srescio

On 12.6.1 no disconnect whether passing --notify or not.

The blueutil --disconnect --wait-disconnect is working.

pjv avatar Oct 27 '22 09:10 pjv

image on ventura 13.0 still doesn't work. to toggle connection with bluetooth device i used automator, BluetoothConnector and blueutil. blueutil's disconnect works

jibminJung avatar Dec 28 '22 13:12 jibminJung

if i'm not wrong now in my case on 13.2 (but probably 13.1 too) nothing works anymore 😂️ connection or disconnection.

godbout avatar Dec 29 '22 03:12 godbout

if i'm not wrong now in my case on 13.2 (but probably 13.1 too) nothing works anymore 😂️ connection or disconnection.

Blueutil was updated in January and (dis-)connecting works for me on 13.2.1 in case anybody is still looking for a (currently working) solution.

orthand avatar Feb 21 '23 22:02 orthand

I added a retry feature when disconnecting with 2.1.0

lapfelix avatar Oct 06 '23 19:10 lapfelix