Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
godbout opened this issue Nov 26, 2021 · 20 comments · Fixed by #21
Open

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

godbout opened this issue Nov 26, 2021 · 20 comments · Fixed by #21

Comments

@godbout
Copy link

godbout commented Nov 26, 2021

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

@alphabitnz
Copy link

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

@CHigginbotham
Copy link

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

@alphabitnz
Copy link

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

@CHigginbotham
Copy link

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

@luckman212
Copy link
Contributor

luckman212 commented Dec 26, 2021

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

@lapfelix
Copy link
Owner

lapfelix commented Dec 29, 2021

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 lapfelix reopened this Dec 29, 2021
@lapfelix
Copy link
Owner

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).

@godbout
Copy link
Author

godbout commented Jan 31, 2022

in my case AirPods (Pro) yeah.

@alphabitnz
Copy link

for me it was Logitech Z337 speakers

@luckman212
Copy link
Contributor

luckman212 commented Jan 31, 2022

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

@lapfelix
Copy link
Owner

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

@alphabitnz
Copy link

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

@godbout
Copy link
Author

godbout commented May 7, 2022

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

@kaqijiang
Copy link

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

image
image

@srescio
Copy link

srescio commented Aug 27, 2022

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

@pjv
Copy link

pjv commented Oct 27, 2022

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

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

@jibminJung
Copy link

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

@godbout
Copy link
Author

godbout commented Dec 29, 2022

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

@orthand
Copy link

orthand commented Feb 21, 2023

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.

@lapfelix
Copy link
Owner

lapfelix commented Oct 6, 2023

I added a retry feature when disconnecting with 2.1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants