toy / blueutil

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

please remove the discoverable #3

Closed konqui closed 9 years ago

konqui commented 10 years ago

discoverable no longer works, so you can remove it! i don't know if Apple changed something with their bluetooth drivers or so.

toy commented 10 years ago

Just checked, for me it works. What OS X version are you using?

programmarchy commented 10 years ago

When targeting 10.8 or 10.9 in Xcode, the symbol is undefined.

toy commented 10 years ago

Could you please check output of nm -oj /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.?.sdk/System/Library/Frameworks/IOBluetooth.framework/Versions/A/IOBluetooth | egrep 'IOBluetoothPreference(sAvailable|((Get|Set)(ControllerPower|Discoverable)State))'? For me all functions are there in 10.6, 10.7, 10.8 and 10.9 SDKs.

programmarchy commented 10 years ago

Ah, yep, you're right. The symbols are indeed there. I was incorrectly linking IOBluetooth.framework -- re-adding IOBluetooth.framework in Build Phases and things are working now. Thanks!

toy commented 10 years ago

@programmarchy Great! @konqui Could you please check the same thing?

toy commented 9 years ago

@konqui Please reopen if needed.

vidavidorra commented 6 years ago

@toy I think I might have the same problem.

nm -oj /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/IOBluetooth.framework/Versions/A/IOBluetooth | egrep 'IOBluetoothPreference(sAvailable|((Get|Set)(ControllerPower|Discoverable)State))'
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/nm: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/IOBluetooth.framework/Versions/A/IOBluetooth: No such file or directory.

There is a file with the same name but .tbd extension, which contains those names in the grep. make doesn't seem to link properly on my machine since the discoverable does not change in my bluetooth preferences and it keeps discoverable by my phone.

XCode: Version 9.2 (9C40b) macOS: Version 10.13.3 (17D102)

vidavidorra commented 6 years ago

@toy Sorry for my previous message. I was checking it with the preference pane open, but didn't realise that that's also what turns discoverability on. I just tried it without the preference pane and that turns discoverability on when the pref pane is closed, so it works as expected.

Thanks for the great program!

toy commented 6 years ago

@vidavidorra It seems at some point binary was removed from the framework in xcode and is now available only in the system, so:

nm -oj /System/Library/Frameworks/IOBluetooth.framework/Versions/Current/IOBluetooth | egrep 'IOBluetoothPreference(sAvailable|((Get|Set)(ControllerPower|Discoverable)State))'

Also starting with some Mac OS X/OS X/macOS version there is no manual switching of discoverability, it is done automatically when Bluetooth preference pane is open and bluetooth is on.

And when checking after your comment if everything works, I've noticed that when discoverability is on due to preference pane been opened, it is not reported by IOBluetoothPreferenceGetDiscoverableState, though turning on/off discoverability using blueutil can be seen using Bluetooth menu item or through System report. Seems like there is another disconnected interface and it may be worth finding it.

vidavidorra commented 6 years ago

@toy Now you say it, I've indeed noticed that with the pref pane open it didn't get reported as 1 by blueutil -d. With the pref pane open I didn't see the discoverability change though. Will check again tomorrow and also in the system report this time. Shall I open a new ticket for these?

vidavidorra commented 6 years ago

@toy Just tested the discoverability in the pref pane and it kept showing discoverability is enabled, regardless of changing the setting using blueutil -d 0. To me, it seems that opening the pref pane always overrules the setting. And is not reported in the IOBluetoothPreferenceGetDiscoverableState however, the System Report does show the setting and is updated when opening the pref pane or using blueutil when the prefpane is closed. I think it is worth noting in the README that the pref pane always overrules the setting made using blueutil and that currently the stated reported by blueutil -d is faulty when the pref pane is open.

image

The framework seems to be moved indeed, the grep now successfully returns

| ~ @ Jeroens-MacBook-Pro (jdebruijn)
| => nm -oj /System/Library/Frameworks/IOBluetooth.framework/Versions/Current/IOBluetooth | egrep 'IOBluetoothPreference(sAvailable|((Get|Set)(ControllerPower|Discoverable)State))'
/System/Library/Frameworks/IOBluetooth.framework/Versions/Current/IOBluetooth: _IOBluetoothPreferenceGetControllerPowerState
/System/Library/Frameworks/IOBluetooth.framework/Versions/Current/IOBluetooth: _IOBluetoothPreferenceGetDiscoverableState
/System/Library/Frameworks/IOBluetooth.framework/Versions/Current/IOBluetooth: _IOBluetoothPreferenceSetControllerPowerState
/System/Library/Frameworks/IOBluetooth.framework/Versions/Current/IOBluetooth: _IOBluetoothPreferenceSetDiscoverableState
/System/Library/Frameworks/IOBluetooth.framework/Versions/Current/IOBluetooth: _IOBluetoothPreferencesAvailable