IOBluetooth

RSS for tag

Gain user-space access to Bluetooth devices using IOBluetooth.

Posts under IOBluetooth tag

190 Posts

Post

Replies

Boosts

Views

Activity

MI Dual Mode Wireless Mouse side buttons not working via BT connection
I am using MI dual mode mouse on my MacBook Pro 2018, OS Ventura, but the side buttons don't work when using Bluetooth. The side buttons do work well via USB dongle but not Bluetooth. I did some research and found that, the Mouse/HID descriptor send invalid code for the 2 side buttons when using BT. Anyone who might know how I can solve this issue?
6
2
5.2k
Mar ’23
Announce notifications not working correctly
I have a pair of AirPod pros and a iPhone 12 Pro Max. When I first got them the announce notifications worked fine but now I am having a issue where it will pause my podcast or turn down my music as if it was gonna tell me the notification, and then say nothing. After a few seconds turns right back up. If I turn the announce notifications off I get nothing as if my phone is on silent. I have made sure that the tone volume in the accessibility settings is turned up and it is. Very odd and would like to find a solution.the only time I get a actual notification sound through them is if I unlocked using my phone and then at that point it will give me the regular notification sounds.
0
0
970
Mar ’23
How to keep a connection with a Bluetooth device in the background for more than 3 minutes
I need to establish a Bluetooth connection with the sensor and maintain the connection with the sensor even in the background mode to continuously receive data. When I actually enter the background mode, the connection works well for 2 minutes, but after 2 minutes the connection is automatically disconnected. I searched and found that iOS automatically disconnects the Bluetooth connection between 1 and 3 minutes for battery efficiency, but is there no way to maintain the connection for more than 3 minutes?
0
0
944
Mar ’23
Bluetooth Connection Issues with Multiple Devices
Greetings all :) We have a third party device designed to be paired with multiple iPads. It's designed for a class room setting, where all student will have their own iPad, and each student will have access to any number of third party bluetooth enabled devices. The device currently has a baked in limit of x5 devices being paired to it at any one time. This means for up to 5 'lessons / classes' everyone can pair with any device without issue. However on the sixth lesson, connecting to the bluetooth device then fails, and the only fix is to go into the Settings, unpair any previous connected bluetooth devices, and then start the process again. Is there any workaround to allow either 'disconnecting' or 'forgetting' devices (in the same session on the same device) to allow re-pairing? At present it is a really poor user experience expecting all users to 'forget' all bluetooth devices, before being able to continue. All help / advice much appreciated.
0
0
926
Mar ’23
Bluetooth hardware not found
Bluetooth not working, debug mode gives this report , unable to attach all of it due to file size restrictions. please help Bluetooth Explorer_2023-03-06-091822_Utsuks-MacBook-Pro.crash Bluetooth Explorer_2023-03-06-094223_Utsuks-MacBook-Pro.crash Bluetooth Explorer_2023-03-06-095634_Utsuks-MacBook-Pro.crash Bluetooth Explorer_2023-03-06-095634.crash mds_2023-03-06-143223.crash
0
0
1.7k
Mar ’23
Bluetooth connection busy
We have an application that uses flutter as a development framework, and on some newer devices with IOS 16.3.1 it is happening that the bluetooth connection is busy after a connection. Closing the app or disconnecting is not ending that connection, the only way to get it working again is to restart the iPhone. I would like to know if you have any suggestions of any cache memory that should be cleared or any other ideas to solve this problem?
0
0
593
Feb ’23
I Can Not Close Bluetooth With Using XCode
Hi, i've developing bluetooth off/on application for my IOT Device. When IoT publish "off" message, mac's bt should be close. Or the exact opposite. To make it, i decided to use "blueutil". So here is my function:     let task = Process()     task.launchPath = "/opt/homebrew/Cellar/blueutil/2.9.1/bin/blueutil"     task.arguments = ["power", "0"]     task.launch()     task.waitUntilExit()   } launchPath is blueutil's installed colation. But here is the problem. If i call the function, i get this error: *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'launch path not accessible' terminating with uncaught exception of type NSException How can i fix it? Is there any way to close or open bluetooth? Thanks a lot from now.
0
0
632
Feb ’23
How to customize additional Buttons for a bluetooth device by an APP?
Hi Guys, I need to customize several keys for a bluetooth device. Sometimes the functional of the bluetooth device keys need to change, like change functional from "pgup" to "left" key. So far to customize the key it must go to the Iphone Settings=>Accessibility=>Touch=>AssistiveTouch=>Devices=>"bluetooth device name"=>Customize Additional Buttons/ Above progress is too complicated for user. I want to built an APP to simplify above progress. Currently I found the apple only provide the DriverKit Extension or HIDDriveKit for MacOS or PadOS but no IOS. Is there any methods? Thanks for the help.
0
0
2.5k
Jan ’23
bluetooth l2cap connect response 0x04
I have a question about below two devices connect classic BT L2cap profile, device 1: iphone xs max IOS 15.3.1 device 2: BT 5.1 module I need to do SDP service search, so l2cap connect is necessary. when I use my BT module to send a l2cap request command to iphone, it sometimes get response with 0x04(no resources available). But this issue wouldn't happen on android phone. Can anyone teach me why iphone response 0x04, and hot to fix it? Thanks a lot. I got the btsnoop log on attaached image.
0
0
928
Dec ’22
Remote control for iPad from BLE device
I need to implement a remote control for a SwiftUI app running on iPad. I would need to handle 2 different events like Start / Stop. On software side, I plan to use .onReceive to listen to BLE device. So my questions: I need realtime reaction (a few 1/100 s max) can any BLE remote control do the job ? If anyone has tested some low cost remote, I am interested to know. Or should I look for Homekit solutions ? Or use an iPhone as remote controller ?
0
0
916
Dec ’22
SDP query callback runs on macOS Big Sur but not Ventura
I have the following Swift code to perform an SDP query on a remote device: import IOBluetooth class Callback: IOBluetoothDeviceAsyncCallbacks { func sdpQueryComplete(_ device: IOBluetoothDevice!, status: IOReturn) { print("Query complete") CFRunLoopStop(CFRunLoopGetCurrent()) } func connectionComplete(_ device: IOBluetoothDevice!, status: IOReturn) {} func remoteNameRequestComplete(_ device: IOBluetoothDevice!, status: IOReturn) {} } let callback = Callback() let device = IOBluetoothDevice(addressString: "3c:61:05:2a:ed:12") let uuid = IOBluetoothSDPUUID(uuid16: 0x0003) let result = device!.performSDPQuery(_: callback, uuids: [uuid!]) print("Query started, result \(result)") CFRunLoopRun() On my 2021 MacBook Pro (with Ventura 13.1), the code prints "Query started, result 0" and hangs indefinitely because the callback does not run to stop the loop. However, on a virtual machine with Big Sur 11.3, the code also prints "Query complete" and exits normally. I believe this issue is related to other Bluetooth issues that have existed since Monterey, which have been posted about before. Since I plan to use SDP queries in my own application, are there any solutions or workarounds to make the above code work on recent versions of macOS?
1
0
925
Dec ’22
BLE Performance issue after upgrading to iOS 16.1.0 and 16.2.
Our iOS App uses BLE to connect to embedded devices. It was all working fine till iOS 15. After upgrading to iOS 16 we started seeing slowness in our app.   So the scenario here is we download a metadata file after successful BLE connection to embedded device. Previously in iOS 15 this operation use to take max 7-8 seconds. But now it takes 28 seconds to download the same metadata file. And this is main cause of slowness.   On further investigation we found that ATT_MTU negotiation was not sent from iPhone to embedded device and hence embedded device used the default max MTU size for connection. Which is 250.   Till iOS 15: MTU was negotiated as 527 or something higher based on the iPhone or device type. As you can see in the image below. Here [localhost (sivaram...)] is our Apple device and [Apple_d4:86:e9] is the embedded device. And L2CAP is sent from iPhone to device, and which negotiate the MTU size as 527. iOS 16.1.1 and after that MTU negotiation is not happening and it is always constant at 250 as set by embedded devices. Here localhost () is our Apple device and SiliconL_ee:c5:97 is the embedded device. And here there in no L2CAP call from iPhone that is not been sent at all. Hence, we received 250 as the max MTU size from the embedded device and are using it. We want to know how we can sent the negotiated MTU size as was happening before in iOS 15 from our app. Reference of the similar Apple tickets are also mention below. https://developer.apple.com/forums/thread/716874 https://developer.apple.com/forums/thread/715646 https://developer.apple.com/forums/thread/713095 Your response to this ticket is highly appreciated.
0
0
2k
Dec ’22
MacOS Monterey Bluetooth Issues
Hi Apple developer experts, I am getting one critical issue related to Bluetooth on MacOS 12.0.1 and MacOS 12.1. Since we upgrade to MacOS 12.0.1 the bluetooth not working to the pair with device anymore with detail checking as below: The issue was not happened from MacOS 10.7 to 11.3 Big Sur. Only happened from macOS Monterey 12.0.1 + I got the console log with these message: [CoreBluetooth] No name or address and [CoreBluetooth] WARNING: Unknown error: 431. Sometime I also got this: [CoreBluetooth] WARNING: Unknown error: 10702 Checking with tool PacketLogger I saw the error message in HCI Event : Authentication Complete - PIN Or Key Missing and Command Complete [FD4E] - LE Update Extended Advertising Instance - Invalid HCI Command Parameters The code get IOBluetooth Local Services in macOS Catalina response the channel id is 2 or 3 for the hardware device depending on. While in macOS Monterey is response with channel id 1. (The valid RFComm channel from 1 to 30 - IOBluetooth library) The RFCOMMChannel in macOS Monterey is not opened and not response the notification. Everything works fine with older MacOS (I used PacketLogger to check). This maybe the main issue that the Pair device is not working anymore. Note that the status BT connected just keep around 5 seconds then disconnected. My code request RFCOMM include service name, L2Cap attribute, RFComm attributes, SDP attributes with uuid I am very appreciate If anyone knows what should be changed or fix. Many thanks. I tried a lot of cases but it still not working, include reset the bluetooth from my Mac machine. Our customer complaints a lot since they updated macOS Monterey and the bluetooth has been not working properly. Any help would be greatly appreciated. Thank you!
13
1
6.2k
Dec ’22
IOBluetooth replyUserConfirmation hangs in MacOS Ventura
When trying to send a true to a "devicePairingUserConfirmationRequest" (in IOBluetoothDevicePairDelegate), there is no command sent via the HCI controller, i.e. when running PacketLogger there is no User Confirmation Request Reply. This causes a timeout and the a Simple Pairing Complete and Authentication Failure. This within itself is a strange behaviour (since the replyUserConfirmation function is being called), but if I send a replyPINCode, it magically works. This is behaviour was seen using both swift and objective-c cli and a simple swift APP. Also, if I connect to the device from the bluetooth settings page, the device pair without any problem (although when capturing system logs using Instruments, the pairing logic is completely different, using its own functions and API calls).
0
1
774
Nov ’22
Monterey/Ventura - Unable to use Bluetooth in PC/SC IFD Handler plugin from within platform binary
I am having a problem similar to this post, https://developer.apple.com/forums/thread/668231 , which is a follow up to https://developer.apple.com/forums/thread/710998?page=1#724376022 . As I am continuing to troubleshoot the problem with Bluetooth not working with 3rd party software in logged out/locked out state, I checked the TCC logs and found the application is being refused for bluetooth as shown below: 2022-10-25 12:15:31.433032+0300 localhost tccd[146]: [com.apple.TCC:access] REQUEST: tccd_uid=0, sender_pid=102, sender_uid=0, sender_auid=-1, function=TCCAccessRequest, msgID=102.162 2022-10-25 12:15:31.433223+0300 localhost tccd[146]: [com.apple.TCC:access] PrivilegedHelperTool: ***Helper[138]: /Library/PrivilegedHelperTools/***Helper 2022-10-25 12:15:31.433280+0300 localhost tccd[146]: [com.apple.TCC:access] PrivilegedHelperTool: ***Helper[138] -- failed to create helperInfoDict for: /Library/PrivilegedHelperTools/***Helper 2022-10-25 12:15:31.433323+0300 localhost tccd[146]: [com.apple.TCC:access] <TCCDProcess: identifier=com.apple.mds, pid=102, auid=0, euid=0, binary_path=/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/Metadata.framework/Versions/A/Support/mds> attempted to call TCCAccessRequest for kTCCServiceReminders without the recommended com.apple.private.tcc.manager.check-by-audit-token entitlement 2022-10-25 12:15:31.433469+0300 localhost tccd[146]: [com.apple.TCC:access] PrivilegedHelperTool: ***Helper[138]: /Library/PrivilegedHelperTools/***Helper 2022-10-25 12:15:31.433515+0300 localhost tccd[146]: [com.apple.TCC:access] PrivilegedHelperTool: ***Helper[138] -- failed to create helperInfoDict for: /Library/PrivilegedHelperTools/***Helper 2022-10-25 12:15:31.433538+0300 localhost tccd[146]: [com.apple.TCC:access] AUTHREQ_CTX: msgID=102.162, function=<private>, service=kTCCServiceReminders, preflight=yes, query=1, 2022-10-25 12:15:31.433550+0300 localhost tccd[146]: [com.apple.TCC:access] AUTHREQ_ATTRIBUTION: msgID=102.162, attribution={accessing={<TCCDProcess: identifier=***Helper, pid=138, auid=0, euid=0, binary_path=/Library/PrivilegedHelperTools/***Helper>}, requesting={<TCCDProcess: identifier=com.apple.mds, pid=102, auid=0, euid=0, binary_path=/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/Metadata.framework/Versions/A/Support/mds>}, }, 2022-10-25 12:15:31.433934+0300 localhost tccd[146]: [com.apple.TCC:access] AUTHREQ_SUBJECT: msgID=102.162, subject=/Library/PrivilegedHelperTools/***Helper, 2022-10-25 12:15:31.433963+0300 localhost tccd[146]: [com.apple.TCC:access] Refusing TCCAccessRequest for service kTCCServiceReminders from client Sub:{/Library/PrivilegedHelperTools/***Helper}Resp:{<TCCDProcess: identifier=***Helper, pid=138, auid=0, euid=0, binary_path=/Library/PrivilegedHelperTools/***Helper>} in background session 2022-10-25 12:15:31.433967+0300 localhost tccd[146]: [com.apple.TCC:access] AUTHREQ_RESULT: msgID=102.162, authValue=0, authReason=5, authVersion=1, error=(null), 2022-10-25 12:15:31.433998+0300 localhost tccd[146]: [com.apple.TCC:access] REPLY: (0) function=TCCAccessRequest, msgID=102.162 2022-10-25 12:15:34.580329+0300 localhost ***Helper[138]: (TCC) [com.apple.TCC:access] send_message_with_reply(): user tccd unavailable, sending 0x6000014e22e0 to system tccd 2022-10-25 12:15:34.580712+0300 localhost tccd[146]: [com.apple.TCC:access] REQUEST: tccd_uid=0, sender_pid=138, sender_uid=0, sender_auid=-1, function=TCCAccessRequest, msgID=138.1
0
0
1.2k
Nov ’22
In iOS 16 getting MTU size very low (20)
Hello Team, My project based on the CAN2BLE protocol. Here we are communicating with devices using Protobuf framework (https://github.com/apple/swift-protobuf). While communicating with device below having some observation Below iOS 16 MTU Size (iOS 12...15.6.1) MTU Size Without Response: 244 In iOS 16 MTU Size MTU Size Without Response: 20 Observation : First time in iOS 16 getting MTU Size Without Response 244, but in second time it will give size 20, but after restarting the device. First time it will gives MTU size 244 from next time MTU size 20. This will happen again and again. Due to this issue my app not geeting data form BLE device. Please let me know, if you need more data on the same.
6
3
4.4k
Oct ’22
Airpods actual audio latency is differ from AVAudioengine.session prediction and changes over time
Hi, I am building a realtime drum practise tool which listens to the players' practice and provides visual feedback on their accuracy. I use AVAudioSourceNode and AVAudioSinkNode for playing audio and for listening to player practise. Precious timing is the most important part of our app. To optimise audio latency I set PreferredIOBufferDuration to 64/48000sec (~1.33ms). My preferences work fine with builtin or wired audio devices. In these cases we can easily estimate the actual audio latency. However we would like to support Apple airPods (or other bluetooth earbuds) as well, but it seems to be impossible to predict the actual audio latency. let bufferSize: UInt32 = 64 let sampleRate: Double = 48000 let bufferDuration = TimeInterval(Double(bufferSize) / sampleRate) try? session.setCategory(AVAudioSession.Category.playAndRecord, options: [.defaultToSpeaker, .mixWithOthers, .allowBluetoothA2DP])     try? session.setPreferredSampleRate(Double(sampleRate))     try? session.setPreferredIOBufferDuration(bufferDuration)     try? session.setActive(true, options: .notifyOthersOnDeactivation) I use iPhone 12 mini and airPods 2 for testing. (Input always have to be the phone's builtin mic) let input = session.inputLatency // 2.438ms let output = session.outputLatency // 160.667ms let buffer = session.ioBufferDuration // 1.333ms let estimated = input + output + buffer * 2 // 165.771 session.outputLatency returns ca 160ms for my airPods. With the basic calculation above I can estimate a latency of 165.771ms, but when I measure the actual latency (time difference between heard and played sound ) I get significantly different values. If I connect my airPods and start playing immediately, the actual measured latency is ca 215-220ms at first, but it is continuously decreasing over time. After about 20-30mins of measuring the actual latency is around 155-160ms (just like the value that the session returns). However if I am using my airPods for a while before I start the measurement, the actual latency starts from ca 180ms (and decreasing over time the same way). On older iOS devices these differences are even larger. It feels like bluetooth connection needs to "warm up" or something. My questions would be: Is there any way to have a relatively constant audio latency with bluetooth devices? I thought maybe it depends on the actual bandwidth but I couldn't find anything on this topic. Can bandwidth change over time? Can I control it? I guess airPods support AAC codec. Is there any way to force them to use SBC? Does SBC codec work with lower latency? What is the best audioengine setting to support bluetooth devices with the lowest latency? Any other suggestion? Thank you
3
0
8.4k
Oct ’22
Change from Bluetooth to iPhone speaker
is it possible to change from Bluetooth to iPhone speaker in iOS 14? All I want is real-time control of where the audio comes from
Replies
1
Boosts
0
Views
1.4k
Activity
Mar ’23
MI Dual Mode Wireless Mouse side buttons not working via BT connection
I am using MI dual mode mouse on my MacBook Pro 2018, OS Ventura, but the side buttons don't work when using Bluetooth. The side buttons do work well via USB dongle but not Bluetooth. I did some research and found that, the Mouse/HID descriptor send invalid code for the 2 side buttons when using BT. Anyone who might know how I can solve this issue?
Replies
6
Boosts
2
Views
5.2k
Activity
Mar ’23
Announce notifications not working correctly
I have a pair of AirPod pros and a iPhone 12 Pro Max. When I first got them the announce notifications worked fine but now I am having a issue where it will pause my podcast or turn down my music as if it was gonna tell me the notification, and then say nothing. After a few seconds turns right back up. If I turn the announce notifications off I get nothing as if my phone is on silent. I have made sure that the tone volume in the accessibility settings is turned up and it is. Very odd and would like to find a solution.the only time I get a actual notification sound through them is if I unlocked using my phone and then at that point it will give me the regular notification sounds.
Replies
0
Boosts
0
Views
970
Activity
Mar ’23
How to keep a connection with a Bluetooth device in the background for more than 3 minutes
I need to establish a Bluetooth connection with the sensor and maintain the connection with the sensor even in the background mode to continuously receive data. When I actually enter the background mode, the connection works well for 2 minutes, but after 2 minutes the connection is automatically disconnected. I searched and found that iOS automatically disconnects the Bluetooth connection between 1 and 3 minutes for battery efficiency, but is there no way to maintain the connection for more than 3 minutes?
Replies
0
Boosts
0
Views
944
Activity
Mar ’23
Bluetooth Connection Issues with Multiple Devices
Greetings all :) We have a third party device designed to be paired with multiple iPads. It's designed for a class room setting, where all student will have their own iPad, and each student will have access to any number of third party bluetooth enabled devices. The device currently has a baked in limit of x5 devices being paired to it at any one time. This means for up to 5 'lessons / classes' everyone can pair with any device without issue. However on the sixth lesson, connecting to the bluetooth device then fails, and the only fix is to go into the Settings, unpair any previous connected bluetooth devices, and then start the process again. Is there any workaround to allow either 'disconnecting' or 'forgetting' devices (in the same session on the same device) to allow re-pairing? At present it is a really poor user experience expecting all users to 'forget' all bluetooth devices, before being able to continue. All help / advice much appreciated.
Replies
0
Boosts
0
Views
926
Activity
Mar ’23
Bluetooth hardware not found
Bluetooth not working, debug mode gives this report , unable to attach all of it due to file size restrictions. please help Bluetooth Explorer_2023-03-06-091822_Utsuks-MacBook-Pro.crash Bluetooth Explorer_2023-03-06-094223_Utsuks-MacBook-Pro.crash Bluetooth Explorer_2023-03-06-095634_Utsuks-MacBook-Pro.crash Bluetooth Explorer_2023-03-06-095634.crash mds_2023-03-06-143223.crash
Replies
0
Boosts
0
Views
1.7k
Activity
Mar ’23
Bluetooth connection busy
We have an application that uses flutter as a development framework, and on some newer devices with IOS 16.3.1 it is happening that the bluetooth connection is busy after a connection. Closing the app or disconnecting is not ending that connection, the only way to get it working again is to restart the iPhone. I would like to know if you have any suggestions of any cache memory that should be cleared or any other ideas to solve this problem?
Replies
0
Boosts
0
Views
593
Activity
Feb ’23
I Can Not Close Bluetooth With Using XCode
Hi, i've developing bluetooth off/on application for my IOT Device. When IoT publish "off" message, mac's bt should be close. Or the exact opposite. To make it, i decided to use "blueutil". So here is my function:     let task = Process()     task.launchPath = "/opt/homebrew/Cellar/blueutil/2.9.1/bin/blueutil"     task.arguments = ["power", "0"]     task.launch()     task.waitUntilExit()   } launchPath is blueutil's installed colation. But here is the problem. If i call the function, i get this error: *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'launch path not accessible' terminating with uncaught exception of type NSException How can i fix it? Is there any way to close or open bluetooth? Thanks a lot from now.
Replies
0
Boosts
0
Views
632
Activity
Feb ’23
bluebooth for cars
How does the app identify the car Bluetooth? Is there iOS framework support?
Replies
1
Boosts
0
Views
1.4k
Activity
Feb ’23
How to customize additional Buttons for a bluetooth device by an APP?
Hi Guys, I need to customize several keys for a bluetooth device. Sometimes the functional of the bluetooth device keys need to change, like change functional from "pgup" to "left" key. So far to customize the key it must go to the Iphone Settings=>Accessibility=>Touch=>AssistiveTouch=>Devices=>"bluetooth device name"=>Customize Additional Buttons/ Above progress is too complicated for user. I want to built an APP to simplify above progress. Currently I found the apple only provide the DriverKit Extension or HIDDriveKit for MacOS or PadOS but no IOS. Is there any methods? Thanks for the help.
Replies
0
Boosts
0
Views
2.5k
Activity
Jan ’23
bluetooth l2cap connect response 0x04
I have a question about below two devices connect classic BT L2cap profile, device 1: iphone xs max IOS 15.3.1 device 2: BT 5.1 module I need to do SDP service search, so l2cap connect is necessary. when I use my BT module to send a l2cap request command to iphone, it sometimes get response with 0x04(no resources available). But this issue wouldn't happen on android phone. Can anyone teach me why iphone response 0x04, and hot to fix it? Thanks a lot. I got the btsnoop log on attaached image.
Replies
0
Boosts
0
Views
928
Activity
Dec ’22
Remote control for iPad from BLE device
I need to implement a remote control for a SwiftUI app running on iPad. I would need to handle 2 different events like Start / Stop. On software side, I plan to use .onReceive to listen to BLE device. So my questions: I need realtime reaction (a few 1/100 s max) can any BLE remote control do the job ? If anyone has tested some low cost remote, I am interested to know. Or should I look for Homekit solutions ? Or use an iPhone as remote controller ?
Replies
0
Boosts
0
Views
916
Activity
Dec ’22
SDP query callback runs on macOS Big Sur but not Ventura
I have the following Swift code to perform an SDP query on a remote device: import IOBluetooth class Callback: IOBluetoothDeviceAsyncCallbacks { func sdpQueryComplete(_ device: IOBluetoothDevice!, status: IOReturn) { print("Query complete") CFRunLoopStop(CFRunLoopGetCurrent()) } func connectionComplete(_ device: IOBluetoothDevice!, status: IOReturn) {} func remoteNameRequestComplete(_ device: IOBluetoothDevice!, status: IOReturn) {} } let callback = Callback() let device = IOBluetoothDevice(addressString: "3c:61:05:2a:ed:12") let uuid = IOBluetoothSDPUUID(uuid16: 0x0003) let result = device!.performSDPQuery(_: callback, uuids: [uuid!]) print("Query started, result \(result)") CFRunLoopRun() On my 2021 MacBook Pro (with Ventura 13.1), the code prints "Query started, result 0" and hangs indefinitely because the callback does not run to stop the loop. However, on a virtual machine with Big Sur 11.3, the code also prints "Query complete" and exits normally. I believe this issue is related to other Bluetooth issues that have existed since Monterey, which have been posted about before. Since I plan to use SDP queries in my own application, are there any solutions or workarounds to make the above code work on recent versions of macOS?
Replies
1
Boosts
0
Views
925
Activity
Dec ’22
BLE Performance issue after upgrading to iOS 16.1.0 and 16.2.
Our iOS App uses BLE to connect to embedded devices. It was all working fine till iOS 15. After upgrading to iOS 16 we started seeing slowness in our app.   So the scenario here is we download a metadata file after successful BLE connection to embedded device. Previously in iOS 15 this operation use to take max 7-8 seconds. But now it takes 28 seconds to download the same metadata file. And this is main cause of slowness.   On further investigation we found that ATT_MTU negotiation was not sent from iPhone to embedded device and hence embedded device used the default max MTU size for connection. Which is 250.   Till iOS 15: MTU was negotiated as 527 or something higher based on the iPhone or device type. As you can see in the image below. Here [localhost (sivaram...)] is our Apple device and [Apple_d4:86:e9] is the embedded device. And L2CAP is sent from iPhone to device, and which negotiate the MTU size as 527. iOS 16.1.1 and after that MTU negotiation is not happening and it is always constant at 250 as set by embedded devices. Here localhost () is our Apple device and SiliconL_ee:c5:97 is the embedded device. And here there in no L2CAP call from iPhone that is not been sent at all. Hence, we received 250 as the max MTU size from the embedded device and are using it. We want to know how we can sent the negotiated MTU size as was happening before in iOS 15 from our app. Reference of the similar Apple tickets are also mention below. https://developer.apple.com/forums/thread/716874 https://developer.apple.com/forums/thread/715646 https://developer.apple.com/forums/thread/713095 Your response to this ticket is highly appreciated.
Replies
0
Boosts
0
Views
2k
Activity
Dec ’22
MacOS Monterey Bluetooth Issues
Hi Apple developer experts, I am getting one critical issue related to Bluetooth on MacOS 12.0.1 and MacOS 12.1. Since we upgrade to MacOS 12.0.1 the bluetooth not working to the pair with device anymore with detail checking as below: The issue was not happened from MacOS 10.7 to 11.3 Big Sur. Only happened from macOS Monterey 12.0.1 + I got the console log with these message: [CoreBluetooth] No name or address and [CoreBluetooth] WARNING: Unknown error: 431. Sometime I also got this: [CoreBluetooth] WARNING: Unknown error: 10702 Checking with tool PacketLogger I saw the error message in HCI Event : Authentication Complete - PIN Or Key Missing and Command Complete [FD4E] - LE Update Extended Advertising Instance - Invalid HCI Command Parameters The code get IOBluetooth Local Services in macOS Catalina response the channel id is 2 or 3 for the hardware device depending on. While in macOS Monterey is response with channel id 1. (The valid RFComm channel from 1 to 30 - IOBluetooth library) The RFCOMMChannel in macOS Monterey is not opened and not response the notification. Everything works fine with older MacOS (I used PacketLogger to check). This maybe the main issue that the Pair device is not working anymore. Note that the status BT connected just keep around 5 seconds then disconnected. My code request RFCOMM include service name, L2Cap attribute, RFComm attributes, SDP attributes with uuid I am very appreciate If anyone knows what should be changed or fix. Many thanks. I tried a lot of cases but it still not working, include reset the bluetooth from my Mac machine. Our customer complaints a lot since they updated macOS Monterey and the bluetooth has been not working properly. Any help would be greatly appreciated. Thank you!
Replies
13
Boosts
1
Views
6.2k
Activity
Dec ’22
IOBluetooth replyUserConfirmation hangs in MacOS Ventura
When trying to send a true to a "devicePairingUserConfirmationRequest" (in IOBluetoothDevicePairDelegate), there is no command sent via the HCI controller, i.e. when running PacketLogger there is no User Confirmation Request Reply. This causes a timeout and the a Simple Pairing Complete and Authentication Failure. This within itself is a strange behaviour (since the replyUserConfirmation function is being called), but if I send a replyPINCode, it magically works. This is behaviour was seen using both swift and objective-c cli and a simple swift APP. Also, if I connect to the device from the bluetooth settings page, the device pair without any problem (although when capturing system logs using Instruments, the pairing logic is completely different, using its own functions and API calls).
Replies
0
Boosts
1
Views
774
Activity
Nov ’22
Monterey/Ventura - Unable to use Bluetooth in PC/SC IFD Handler plugin from within platform binary
I am having a problem similar to this post, https://developer.apple.com/forums/thread/668231 , which is a follow up to https://developer.apple.com/forums/thread/710998?page=1#724376022 . As I am continuing to troubleshoot the problem with Bluetooth not working with 3rd party software in logged out/locked out state, I checked the TCC logs and found the application is being refused for bluetooth as shown below: 2022-10-25 12:15:31.433032+0300 localhost tccd[146]: [com.apple.TCC:access] REQUEST: tccd_uid=0, sender_pid=102, sender_uid=0, sender_auid=-1, function=TCCAccessRequest, msgID=102.162 2022-10-25 12:15:31.433223+0300 localhost tccd[146]: [com.apple.TCC:access] PrivilegedHelperTool: ***Helper[138]: /Library/PrivilegedHelperTools/***Helper 2022-10-25 12:15:31.433280+0300 localhost tccd[146]: [com.apple.TCC:access] PrivilegedHelperTool: ***Helper[138] -- failed to create helperInfoDict for: /Library/PrivilegedHelperTools/***Helper 2022-10-25 12:15:31.433323+0300 localhost tccd[146]: [com.apple.TCC:access] <TCCDProcess: identifier=com.apple.mds, pid=102, auid=0, euid=0, binary_path=/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/Metadata.framework/Versions/A/Support/mds> attempted to call TCCAccessRequest for kTCCServiceReminders without the recommended com.apple.private.tcc.manager.check-by-audit-token entitlement 2022-10-25 12:15:31.433469+0300 localhost tccd[146]: [com.apple.TCC:access] PrivilegedHelperTool: ***Helper[138]: /Library/PrivilegedHelperTools/***Helper 2022-10-25 12:15:31.433515+0300 localhost tccd[146]: [com.apple.TCC:access] PrivilegedHelperTool: ***Helper[138] -- failed to create helperInfoDict for: /Library/PrivilegedHelperTools/***Helper 2022-10-25 12:15:31.433538+0300 localhost tccd[146]: [com.apple.TCC:access] AUTHREQ_CTX: msgID=102.162, function=<private>, service=kTCCServiceReminders, preflight=yes, query=1, 2022-10-25 12:15:31.433550+0300 localhost tccd[146]: [com.apple.TCC:access] AUTHREQ_ATTRIBUTION: msgID=102.162, attribution={accessing={<TCCDProcess: identifier=***Helper, pid=138, auid=0, euid=0, binary_path=/Library/PrivilegedHelperTools/***Helper>}, requesting={<TCCDProcess: identifier=com.apple.mds, pid=102, auid=0, euid=0, binary_path=/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/Metadata.framework/Versions/A/Support/mds>}, }, 2022-10-25 12:15:31.433934+0300 localhost tccd[146]: [com.apple.TCC:access] AUTHREQ_SUBJECT: msgID=102.162, subject=/Library/PrivilegedHelperTools/***Helper, 2022-10-25 12:15:31.433963+0300 localhost tccd[146]: [com.apple.TCC:access] Refusing TCCAccessRequest for service kTCCServiceReminders from client Sub:{/Library/PrivilegedHelperTools/***Helper}Resp:{<TCCDProcess: identifier=***Helper, pid=138, auid=0, euid=0, binary_path=/Library/PrivilegedHelperTools/***Helper>} in background session 2022-10-25 12:15:31.433967+0300 localhost tccd[146]: [com.apple.TCC:access] AUTHREQ_RESULT: msgID=102.162, authValue=0, authReason=5, authVersion=1, error=(null), 2022-10-25 12:15:31.433998+0300 localhost tccd[146]: [com.apple.TCC:access] REPLY: (0) function=TCCAccessRequest, msgID=102.162 2022-10-25 12:15:34.580329+0300 localhost ***Helper[138]: (TCC) [com.apple.TCC:access] send_message_with_reply(): user tccd unavailable, sending 0x6000014e22e0 to system tccd 2022-10-25 12:15:34.580712+0300 localhost tccd[146]: [com.apple.TCC:access] REQUEST: tccd_uid=0, sender_pid=138, sender_uid=0, sender_auid=-1, function=TCCAccessRequest, msgID=138.1
Replies
0
Boosts
0
Views
1.2k
Activity
Nov ’22
In iOS 16 getting MTU size very low (20)
Hello Team, My project based on the CAN2BLE protocol. Here we are communicating with devices using Protobuf framework (https://github.com/apple/swift-protobuf). While communicating with device below having some observation Below iOS 16 MTU Size (iOS 12...15.6.1) MTU Size Without Response: 244 In iOS 16 MTU Size MTU Size Without Response: 20 Observation : First time in iOS 16 getting MTU Size Without Response 244, but in second time it will give size 20, but after restarting the device. First time it will gives MTU size 244 from next time MTU size 20. This will happen again and again. Due to this issue my app not geeting data form BLE device. Please let me know, if you need more data on the same.
Replies
6
Boosts
3
Views
4.4k
Activity
Oct ’22
Airpods actual audio latency is differ from AVAudioengine.session prediction and changes over time
Hi, I am building a realtime drum practise tool which listens to the players' practice and provides visual feedback on their accuracy. I use AVAudioSourceNode and AVAudioSinkNode for playing audio and for listening to player practise. Precious timing is the most important part of our app. To optimise audio latency I set PreferredIOBufferDuration to 64/48000sec (~1.33ms). My preferences work fine with builtin or wired audio devices. In these cases we can easily estimate the actual audio latency. However we would like to support Apple airPods (or other bluetooth earbuds) as well, but it seems to be impossible to predict the actual audio latency. let bufferSize: UInt32 = 64 let sampleRate: Double = 48000 let bufferDuration = TimeInterval(Double(bufferSize) / sampleRate) try? session.setCategory(AVAudioSession.Category.playAndRecord, options: [.defaultToSpeaker, .mixWithOthers, .allowBluetoothA2DP])     try? session.setPreferredSampleRate(Double(sampleRate))     try? session.setPreferredIOBufferDuration(bufferDuration)     try? session.setActive(true, options: .notifyOthersOnDeactivation) I use iPhone 12 mini and airPods 2 for testing. (Input always have to be the phone's builtin mic) let input = session.inputLatency // 2.438ms let output = session.outputLatency // 160.667ms let buffer = session.ioBufferDuration // 1.333ms let estimated = input + output + buffer * 2 // 165.771 session.outputLatency returns ca 160ms for my airPods. With the basic calculation above I can estimate a latency of 165.771ms, but when I measure the actual latency (time difference between heard and played sound ) I get significantly different values. If I connect my airPods and start playing immediately, the actual measured latency is ca 215-220ms at first, but it is continuously decreasing over time. After about 20-30mins of measuring the actual latency is around 155-160ms (just like the value that the session returns). However if I am using my airPods for a while before I start the measurement, the actual latency starts from ca 180ms (and decreasing over time the same way). On older iOS devices these differences are even larger. It feels like bluetooth connection needs to "warm up" or something. My questions would be: Is there any way to have a relatively constant audio latency with bluetooth devices? I thought maybe it depends on the actual bandwidth but I couldn't find anything on this topic. Can bandwidth change over time? Can I control it? I guess airPods support AAC codec. Is there any way to force them to use SBC? Does SBC codec work with lower latency? What is the best audioengine setting to support bluetooth devices with the lowest latency? Any other suggestion? Thank you
Replies
3
Boosts
0
Views
8.4k
Activity
Oct ’22
Bluetooth device(MFI) are getting duplicate in bluetooth page
Bluetooth device(MFI) are getting duplicate in Bluetooth Page Name changing or name duplicating are not seen with the following IOS versions Not reproduce in. i) iOS 14.0 – iPhone X. ii) iOS 15.1 – iPad & iPod iii) iOS 15.6.0 - iPod Reproduce in i). iOS 15.6.1 – iPhone 13 pro ii.) iOS 16.0.3 – iPhone 13 pro
Replies
0
Boosts
0
Views
1k
Activity
Oct ’22