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

Not working on macOS High Sierra #58

Open
ziflex opened this issue Sep 28, 2017 · 15 comments
Open

Not working on macOS High Sierra #58

ziflex opened this issue Sep 28, 2017 · 15 comments

Comments

@ziflex
Copy link

ziflex commented Sep 28, 2017

Hi there,

I know that macOS High Sierra was released just few days ago, but just wanted to warn those of you who develop on Mac.
That's what I'm getting from the lib in console:

Unhandled event: xpc.Dict{"kCBMsgId":4, "kCBMsgArgs":xpc.Dict{"kCBMsgArgState":5}}
@Scapal
Copy link

Scapal commented Sep 29, 2017

Same here

@ziflex
Copy link
Author

ziflex commented Sep 29, 2017

Same in Noble

noble/noble#679

@ziflex
Copy link
Author

ziflex commented Sep 29, 2017

One of the reasons why it might fail is that Apple switched from com.apple.bluehd to com.apple.bluetoothd.

And here
https://github.com/currantlabs/ble/blob/master/darwin/device.go#L80

We explicitly connect to com.apple.bluehd.

@ziflex
Copy link
Author

ziflex commented Sep 29, 2017

And therefore state event changed from 6 to 4

https://github.com/currantlabs/ble/blob/master/darwin/device.go#L19

@ziflex
Copy link
Author

ziflex commented Sep 29, 2017

Ok, I made it work
Here are my changes:

evtStateChanged               = 4

https://github.com/currantlabs/ble/blob/master/darwin/device.go#L19

d.pm = xpc.XpcConnect("com.apple.bluetoothd", d)
d.cm = xpc.XpcConnect("com.apple.bluetoothd", d)

https://github.com/currantlabs/ble/blob/master/darwin/device.go#L80

I think we could come up with some kind of ConnectionProvider and EventCodesProvider which would be selected based on the version of macOS.

@bennesp
Copy link

bennesp commented Oct 10, 2017

I tried with that changes, with and without sudo, and it says

Scanning for 5s...
done

without showing any device (and there are ~320 devices BLE that I can see with the Apple Bluetooth Explorer)

What am I doing wrong?

@deadprogram
Copy link
Contributor

This PR from Noble appears to have added the new XPC API calls needed for High Sierra:

noble/noble#689

The https://github.com/go-ble/ble fork of ble seems like has some work in this area... @moogle19 can you please fill us in on what you are up to, and how we can help?

@deadprogram
Copy link
Contributor

I just submitted a PR go-ble#2 on the branch that @moogle19 has been working on. It should work on both High Sierra, as well as on El Capitan/Yosemite. Anyone who can help by testing on High Sierra would be most helpful.

@deadprogram
Copy link
Contributor

For anyone interested, please check out go-ble#3

@ziflex
Copy link
Author

ziflex commented Nov 15, 2017

@deadprogram I will try to test it this week.

@ziflex
Copy link
Author

ziflex commented Nov 29, 2017

@deadprogram did you guys change public API?

@ziflex
Copy link
Author

ziflex commented Nov 29, 2017

@deadprogram and btw, is go-ble is intended to be a proxy repo for fixes or a completely independent fork ? Wondering, maybe it's better to move to it.

@deadprogram
Copy link
Contributor

@moogle19 made a change to the API related to Addr or something like that. Relatively small change.

From what I can tell, it is a more active fork and hence why I have mostly moved to it. I guess it is the new "main" fork?

@ziflex
Copy link
Author

ziflex commented Nov 29, 2017

@deadprogram Ok, I will try to move to it and see how it works on High Sierra.

@ziflex
Copy link
Author

ziflex commented Nov 30, 2017

@deadprogram it works!

thomascriley pushed a commit to thomascriley/ble that referenced this issue Jul 9, 2020
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

No branches or pull requests

4 participants