Git Product home page Git Product logo

Comments (9)

wwwjfy avatar wwwjfy commented on August 15, 2024 2

[IOBluetoothDevice recentDevices] returns empty. I made the following change to make connecting by name work, in function get_device. could be a macOS bug (Intel only? I'm using Mac mini 2018 and MBP 2019). #58 #62 should be of the same cause.

diff --git blueutil.m blueutil.m
index 47aa91d..b5225d5 100644
--- blueutil.m
+++ blueutil.m
@@ -277,7 +277,7 @@ IOBluetoothDevice *get_device(char *id) {
       exit(EXIT_FAILURE);
     }
   } else {
-    NSArray *recentDevices = [IOBluetoothDevice recentDevices:0];
+    NSArray *recentDevices = [IOBluetoothDevice pairedDevices];

     if (!recentDevices) {
       eprintf("No recent devices to search for: %s\n", id);

from blueutil.

toy avatar toy commented on August 15, 2024 1

@fsonntag Sadly no, checking on the surface showed that methods are broken and I didn't yet have time to create environment to investigate deeply. For now I can suggest checking if blueutil --paired or blueutil --connected can be of help.

from blueutil.

toy avatar toy commented on August 15, 2024

Simplest way to check is by using a script in swift:

#!/usr/bin/env swift

import IOBluetooth

print(IOBluetoothDevice.favoriteDevices()!)
print(IOBluetoothDevice.recentDevices(3)!)

Can you check if it is related to permissions as in #60?

from blueutil.

friedrichweise avatar friedrichweise commented on August 15, 2024

The scripts returns two empty arrays:

$ ./test.swift
[]
[]

I've read Issue #60 and added the Terminal to the "Developer Tools" privacy section. This doesn’t affect the behaviour. Is there an elegant way to get the full system log using the Console.app or a similar tool?

from blueutil.

toy avatar toy commented on August 15, 2024

Can you try adding the Bluetooth privacy setting (and restart Terminal)?

For system log there is log command, but it may be tricky to filter for such case. For example everything on all levels containing case insensitive blue: log stream --level debug --color always --timeout 10s | grep -i blue.

from blueutil.

friedrichweise avatar friedrichweise commented on August 15, 2024

Alright. I added the Terminal (and also iTerm2 – my primary terminal) to the Bluetooth and the Developer Tools privacy settings. Then run blueutil --favorites. Given your log command I get the following output:

blueutil: (libsystem_info.dylib) Retrieve User by ID
bluetoothd: [com.apple.bluetooth:Server.Core] PowerManager power state is 1
bluetoothd: [com.apple.bluetooth:Server.Core] PowerManager power state is 1
bluetoothd: [com.apple.bluetooth:Server.A2DP] No corresponding device for DF963AC9 found in fA2dpHandleToDeviceMap (0 devices)
bluetoothd: [com.apple.bluetooth:Server.A2DP] isStreamingAudioToDevice: Unable to retrieve handle for device.
bluetoothd: [com.apple.bluetooth:Server.A2DP] No corresponding device for 994ABEEE found in fA2dpHandleToDeviceMap (0 devices)
bluetoothd: [com.apple.bluetooth:Server.A2DP] isStreamingAudioToDevice: Unable to retrieve handle for device.
bluetoothd: [com.apple.bluetooth:Server.MacCoex] Posting Bluetooth Status Notification <private>
studentd: (ClassroomKit) [com.apple.classroom:Bluetooth] entered finishedRescanInterval
PerfPowerServices: (CoreBluetooth) [com.apple.bluetooth:CoreBluetooth] -[CBClassicManager retrievePairedPeersWithOptions:] <private>
PerfPowerServices: (CoreBluetooth) [com.apple.bluetooth:CoreBluetooth] -[CBClassicManager retrievePairedPeersWithOptions:] <private>
PerfPowerServices: (CoreBluetooth) [com.apple.bluetooth:CoreBluetooth] Sending synchronous XPC message <private>: <private>
bluetoothd: [com.apple.bluetooth:Server.XPC] Received XPC message "CBMsgIdRetrievePairedPeersWithOptions" from session "com.apple.PerfPowerServices-classic-164-17"
bluetoothd: (CoreFoundation) [com.apple.defaults:User Defaults] looked up value <private> for key [SOME MAC] in CFPrefsPlistSource<0x7fb00020d020> (Domain: com.apple.MobileBluetooth.devices, User: kCFPreferencesCurrentUser, ByHost: No, Container: /Library/Bluetooth, Contents Need Refresh: No) via CFPrefsSearchListSource<0x7fb000115150> (Domain: com.apple.MobileBluetooth.devices, Container: /Library/Bluetooth)
bluetoothd: [com.apple.bluetooth:Server.Core] TagSet's class is not an NSArray, returning error for  69422B50
bluetoothd: [com.apple.bluetooth:Server.Security] 69422B50 hasTS: 0, res: 1
bluetoothd: (CoreFoundation) [com.apple.defaults:User Defaults] looked up value <private> for key [SOME MAC] in CFPrefsPlistSource<0x7fb00020d020> (Domain: com.apple.MobileBluetooth.devices, User: kCFPreferencesCurrentUser, ByHost: No, Container: /Library/Bluetooth, Contents Need Refresh: No) via CFPrefsSearchListSource<0x7fb000115150> (Domain: com.apple.MobileBluetooth.devices, Container: /Library/Bluetooth)
bluetoothd: [com.apple.bluetooth:Server.Core] TagSet's class is not an NSArray, returning error for  683AA17B
…
bluetoothd: [com.apple.bluetooth:Server.Security] 9C6B4312 hasTS: 0, res: 1
bluetoothd: [com.apple.bluetooth:Server.LE] Already tracking address "<private>" as device "[SOME MAC]"
bluetoothd: [com.apple.bluetooth:Server.Core] Get SDP record data from SDP attributes for device 69422B50
bluetoothd: [com.apple.bluetooth:Server.Core] SDP record cache size 1200 with 12 services
bluetoothd: [com.apple.bluetooth:Server.Core] Returning sdp record NSData: <private>
bluetoothd: [com.apple.bluetooth:Server.XPC] bluetoothd sending sdp data: <private>
bluetoothd: [com.apple.bluetooth:Server.LE] Already tracking address "<private>" as device "[SOME MAC]"
bluetoothd: [com.apple.bluetooth:Server.Core] Get SDP record data from SDP attributes for device 683AA17B
bluetoothd: [com.apple.bluetooth:Server.Core] sdp attributes is empty

from blueutil.

fsonntag avatar fsonntag commented on August 15, 2024

@toy Any updates on that? :)

from blueutil.

friedrichweise avatar friedrichweise commented on August 15, 2024

blueutil --paired and blueutil --connected work like a charm…

@fsonntag are you able to reproduce the bug? What device are you using? My speculation is that this bug only affects Intel based devices that run macOS 12.

from blueutil.

fsonntag avatar fsonntag commented on August 15, 2024

@friedrichweise
Sorry for the late reply, somehow missed this :/

Anyway, both commands run without an issue, no error output.

from blueutil.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.