Hardware

RSS for tag

Delve into the physical components of Apple devices, including processors, memory, storage, and their interaction with the software.

Posts under Hardware subtopic

Post

Replies

Boosts

Views

Activity

AccessorySetupKit - Peripheral devices with 16 bit UUID are not found in the ASKSample app.
My test was conducted by changing the pink dice to have a 16 bit UUID using the ASKSampleAccessory app. Afterwards, I ran AccessorySetupKit Picker in the ASKSample app, but Pink dice was not found. We confirmed that Pink dice was searched well in other apps. Does AccessorySetupKit not support 16 bit UUID? AccessorySetupKit Sample code : https://developer.apple.com/documentation/AccessorySetupKit/authorizing-a-bluetooth-accessory-to-share-a-dice-roll
1
0
489
Dec ’24
Questions abou Performing Long-Term Actions in the Background
We are reaching out to discuss an issue we have encountered with our app's activation process while running in the background. Currently, we are employing an iBeacon-based activation scheme, but we have noticed that after the app is activated, it is unable to receive UUID data from the scan-response while in the background. We are considering the possibility of embedding the UUID data into the advertisement so that the app can receive it once activated by the iBeacon. Additionally, we are preparing to use both Core Bluetooth’s “Performing Long-Term Actions in the Background” feature and the iBeacon scheme simultaneously for app activation. We would like to know if these two methods can coexist without any mutual interference. Currently, we are utilizing a method of updating the beacon advertisement after connection and disconnection to enhance the app's activation capability. However, in some scenarios where the signal is weak, the app does not detect the vehicle after being activated and will not be reactivated by the same beacon after going into sleep mode. Our current approach is to update the beacon advertisement every 10 seconds to improve this capability. We have outlined our proposed changes and would appreciate your confirmation on whether they could lead to better optimization: 1.Embedding the UUID from the scan-response into the advertisement. 2.Updating the iBeacon advertisement content every 10 seconds. 3. Simultaneously using Core Bluetooth's "Performing Long-Term Actions in the Background" feature along with the iBeacon scheme for app activation. Additionally, we would like to know if these changes could potentially cause any other issues. Thank you for your assistance, and I look forward to your insights on this matter.
1
0
421
Nov ’24
BLE HID Gamepad on nRF52805: Not Recognized on iOS
I am working on a Bluetooth Low Energy (BLE) project using the nRF52840 Development Kit (DK), which has been reconfigured to simulate an nRF52805 chip. The firmware is based on Nordic Semiconductor's ble_app_hids_keyboard example, with modifications to implement a BLE HID Gamepad. I am using the S113 SoftDevice and have successfully tested the functionality with Android devices. The gamepad is recognized as a HID device, and it works as expected on Android, verified using the hardwareTester website. However, when I connect the gamepad to an iPhone via BLE, the same hardwareTester website does not respond as it does on Android, indicating that the iPhone does not recognize the device as a gamepad. The BLE connection is established successfully, but it seems iOS does not interpret the HID report descriptor or the BLE HID service correctly. I suspect there might be compatibility issues with the HID descriptor or the GATT attributes for iOS-specific BLE HID requirements. I would like to have some help.
1
0
324
Dec ’24
Bluetooth connectivity
I upgraded my iPhone 13 Pro Max last week, but I am unable to connect my Sony WH-1000XM5 headphones via Bluetooth. I'm not sure why everything else connects just fine except my headphones. Please send help.
1
0
301
Dec ’24
Serial port speed limited to 3 Mbps
Six months ago I wrote FB14122473, detailing how the built-in CDC (or FTDI) VCP serial port driver is limited to 3 Mbps or less. Thing is, there are some FTDI devices that can do 12 Mbps (maybe more), and I have devices I need to communicate with at 4 Mbps. I had to use the FTDI SDK to be able to communicate with these. I was hoping this post might help draw attention to that bug report.
1
0
455
Jan ’25
The impact of MicrophoneMode on my Mac application.
I have a 4-input, 4-output hardware device and an 8-input, 8-output virtual device, which I combine into an aggregate device. I am using the SimplyCoreAudio library to get the channel count. The code is as follows: aggregationDevice!.channels(scope: .input) =>> 12 aggregationDevice!.channels(scope: .output) =>> 12 When the program's MicrophoneMode is set to standard, the channel count is correct. However, when I set the MicrophoneMode to voiceIsolation, the channel count is incorrect: aggregationDevice!.channels(scope: .input) =>> 4 aggregationDevice!.channels(scope: .output) =>> 12 Below is the code for creating the aggregate device: func createAggregateDevice(mainDevice: AudioDevice, secondDevice: AudioDevice?, named name: String, uid: String) -> AudioDevice? { guard let mainDeviceUID = mainDevice.uid else { return nil } var deviceList: [[String: Any]] = [ [ kAudioSubDeviceUIDKey: mainDeviceUID, kAudioSubDeviceDriftCompensationKey:1 ] ] // make sure same device isn't added twice if let secondDeviceUID = secondDevice?.uid, secondDeviceUID != mainDeviceUID { deviceList.append([ kAudioSubDeviceUIDKey: secondDeviceUID, kAudioSubDeviceDriftCompensationKey:1, kAudioSubDeviceInputChannelsKey:8 ]) } let desc: [String: Any] = [ kAudioAggregateDeviceNameKey: name, kAudioAggregateDeviceUIDKey: uid, kAudioAggregateDeviceSubDeviceListKey: deviceList, kAudioAggregateDeviceMainSubDeviceKey: mainDeviceUID, kAudioAggregateDeviceIsPrivateKey:false, ] var deviceID: AudioDeviceID = 0 let error = AudioHardwareCreateAggregateDevice(desc as CFDictionary, &deviceID) guard error == noErr else { return nil } return AudioDevice.lookup(by: deviceID) } I hope someone can tell me the reason Thank you!
1
0
465
May ’25
Regarding the use of external storage USB-C within the application, after inserting the USB-C storage device into IOS, the app program can directly read and write files
Hello! We currently require the development of an iOS system for encrypting and authorizing photos, videos, voice memos, or other files stored on our devices to a connected USB-C storage. The encrypted files can be accessed through authorization. We have already encrypted and authorized the files to be stored on the app's mobile storage, and cannot directly store them to USB-C (this requirement is based on the Apple camera RroRes, which uses external storage for direct storage). We are seeking technical support from Apple.
1
0
518
Jan ’25
Bluetooth device name unknown, but it shows up in the iOS settings fine.
why is it that this code doesn't show the bluetooth device name but in the iOS settings it is displayed correctly. Thank you. import UIKit import CoreBluetooth import CoreLocation class BluetoothViewController: UIViewController, CBCentralManagerDelegate, CLLocationManagerDelegate { var centralManager: CBCentralManager! var locationManager: CLLocationManager! override func viewDidLoad() { super.viewDidLoad() // Initialize central manager centralManager = CBCentralManager(delegate: self, queue: nil) // Initialize location manager to request location access locationManager = CLLocationManager() locationManager.delegate = self } // CBCentralManagerDelegate Methods func centralManagerDidUpdateState(_ central: CBCentralManager) { switch central.state { case .poweredOn: // Bluetooth is powered on, request location permission if needed if CLLocationManager.locationServicesEnabled() { locationManager.requestWhenInUseAuthorization() } startScanning() case .poweredOff: print("Bluetooth is powered off.") case .resetting: print("Bluetooth is resetting.") case .unauthorized: print("Bluetooth is unauthorized.") case .unknown: print("Bluetooth state is unknown.") case .unsupported: print("Bluetooth is unsupported on this device.") @unknown default: fatalError("Unknown Bluetooth state.") } } func startScanning() { // Start scanning for devices (you can add service UUIDs to filter specific devices) centralManager.scanForPeripherals(withServices: nil, options: [CBScanOptionAllowDuplicatesKey: true]) print("Scanning for Bluetooth devices...") } func centralManager(_ central: CBCentralManager, didDiscover peripheral: CBPeripheral, advertisementData: [String : Any], rssi: NSNumber) { // This method is called when a peripheral is discovered let deviceName = peripheral.name ?? "Unknown" let deviceAddress = peripheral.identifier.uuidString print("Found device: \(deviceName), \(deviceAddress)") // Optionally, you can stop scanning after discovering a device // centralManager.stopScan() } func centralManager(_ central: CBCentralManager, didConnect peripheral: CBPeripheral) { print("Connected to peripheral: \(peripheral.name ?? "Unknown")") } // CLLocationManagerDelegate Methods (for location services) func locationManager(_ manager: CLLocationManager, didChangeAuthorization status: CLAuthorizationStatus) { if status == .authorizedWhenInUse { // Permission granted, now start scanning startScanning() } else { print("Location permission is required for Bluetooth scanning.") } } // Optionally handle when scanning stops or any errors occur func centralManager(_ central: CBCentralManager, didFailToConnect peripheral: CBPeripheral, error: Error?) { print("Failed to connect to peripheral: \(error?.localizedDescription ?? "Unknown error")") } func centralManager(_ central: CBCentralManager, didDisconnectPeripheral peripheral: CBPeripheral, error: Error?) { print("Disconnected from peripheral: \(peripheral.name ?? "Unknown")") } }
1
0
341
Jan ’25
AccessorySetupKit Remove paired accessory from app
Current if we use the removeAccessory(_:completionHandler:) method in ASAccessorySession, it removes the accessory from the system and all apps that have previously paired also lose access. Is there a way to remove the paired accessory only from the app from where the removeAccessory() call is being made? This would be useful in cases where one or more accessories are shared across apps and we need to manage them.
1
0
341
Jan ’25
Identify Apple Watch with non-Apple BLE
We would like to be able to distinguish between iPhones and Apple Watches when scanning for devices using a Laird BLE module. We know that we can identify an Apple device from the manufacturer data returned in the scan report. 0x004C is the registered identifier for Apple. In the remaining data returned is it possible identify the device type? We note that empirically, 4C001005 seems to correlate to an Apple Watch. How reliable is this? It is useful for us, because it means we do not need to connect to this device to see if it is advertising a service that we own. Connecting over BLE is of course an expensive operation. Here is a simple snippet of a Swift App doing a similar thing, to illustrate the question: func centralManager(_ central: CBCentralManager, didDiscover peripheral: CBPeripheral, advertisementData: [String : Any], rssi RSSI: NSNumber) { guard let manufData: Data = advertisementData[CBAdvertisementDataManufacturerDataKey] as? Data else { return } let hexEncodedManufData: String = manufData.map { String(format: "%02hhx", $0) }.joined() print("Manufacturer Data: \(hexEncodedManufData): ") // Manufacturer Data: 4c001007351ff9f9036238: Apple device // Manufacturer Data: 4c001006331ec0640f88: Apple device // Manufacturer Data: 4c0010052b18804eb1: Apple watch? // Manufacturer Data: 4c0010052b18804eb1: Apple watch? }
1
0
315
Jan ’25
Core motion attitude reference frame
I am working on an iOS application that relies on CoreMotion Attitude, and I need clarification regarding the behavior of reference frames. According to the documentation, when setting the attitude reference frame to CMAttitudeReferenceFrameXTrueNorthZVertical: The Z-axis of the reference frame is vertical (aligned with gravity). The X-axis of the reference frame points to the geographic North Pole (True North). When a device’s orientation matches this reference frame, the roll, pitch, and yaw values reported by CMAttitude should be (0,0,0). However, in my testing: When I align the device’s position with the CMAttitudeReferenceFrameXTrueNorthZVertical reference frame by orienting the screen (device Z-axis) upward and the right side (device X-axis) toward north, the yaw value reported by CMAttitude is 90 degrees instead of the expected 0 degrees. To have CMAttitude report yaw as 0, I must instead orient the top side (device Y-axis) toward north. This seems to contradict my understanding that the X-axis of the device should be aligned with True North, to have the device match the attitude reference frame and have roll, pitch, and yaw values reported by CMAttitude should be (0,0,0). What I'm missing? Thank you for your time and assistance.
1
0
397
Jan ’25
MFi - ATS iAP2 Session Test Crash
We just updated our ATS to the latest 8.3.0 version and tried to run the iAP2 Session Test via BPA100 Bluetooth Analyzer and we are experiencing this EXC_BAD_INSTRUCTION. This same test still seems to work on ATS version 6. Please advise. Process: ATS [1782] Path: /private/var/folders/*/ATS.app/Contents/MacOS/ATS Identifier: com.apple.ATSMacApp Version: 8.3.0 (1826) Build Info: ATSMacApp-1826000000000000~2 (1A613) Code Type: X86-64 (Native) Parent Process: launchd [1] User ID: 501 Date/Time: 2025-01-27 11:05:21.1334 -0800 OS Version: macOS 15.2 (24C101) Report Version: 12 Bridge OS Version: 9.2 (22P2093) Anonymous UUID: 098E2BB5-CB98-CA1C-CEFE-188AF6EFE8CF Time Awake Since Boot: 9700 seconds System Integrity Protection: enabled Crashed Thread: 2 com.apple.ATSMacApp.FrontlineFrameworkInterface Exception Type: EXC_BAD_INSTRUCTION (SIGILL) Exception Codes: 0x0000000000000001, 0x0000000000000000 Termination Reason: Namespace SIGNAL, Code 4 Illegal instruction: 4 Terminating Process: exc handler [1782]
1
0
440
Mar ’25
CHHapticAdvancedPatternPlayer not working with GCController
Hello everyone, I want send haptics to ps4 controller. CHHapticPatternPlayer and CHHapticAdvancedPatternPlayer good work with iPhone. On PS4 controller If I use CHHapticPatternPlayer all work good, but if I use CHHapticAdvancedPatternPlayer I get error. I want use CHHapticAdvancedPatternPlayer to use additional settings. I don't found any information how to fix it - CHHapticEngine.mm:624 -[CHHapticEngine finishInit:]_block_invoke: ERROR: Server connection broke with error 'Не удалось завершить операцию. (com.apple.CoreHaptics, ошибка -4811)' The engine stopped because a system error occurred. AVHapticClient.mm:1228 -[AVHapticClient getSyncDelegateForMethod:errorHandler:]_block_invoke: ERROR: Sync XPC call for 'loadAndPrepareHapticSequenceFromEvents:reply:' (client ID 0x21) failed: Не удалось установить связь с приложением-помощником. Не удалось создать или воспроизвести паттерн: Error Domain=NSCocoaErrorDomain Code=4097 "connection to service with pid 5087 named com.apple.GameController.gamecontrollerd.haptics" UserInfo={NSDebugDescription=connection to service with pid 5087 named com.apple.GameController.gamecontrollerd.haptics} My Haptic class - import Foundation import CoreHaptics import GameController protocol HapticsControllerDelegate: AnyObject { func didConnectController() func didDisconnectController() func enginePlayerStart(value: Bool) } final class HapticsControllerManager { static let shared = HapticsControllerManager() private var isSetup = false private var hapticEngine: CHHapticEngine? private var hapticPlayer: CHHapticAdvancedPatternPlayer? weak var delegate: HapticsControllerDelegate? { didSet { if delegate != nil { startObserving() } } } deinit { NotificationCenter.default.removeObserver(self) } private func startObserving() { guard !isSetup else { return } NotificationCenter.default.addObserver( self, selector: #selector(controllerDidConnect), name: .GCControllerDidConnect, object: nil ) NotificationCenter.default.addObserver( self, selector: #selector(controllerDidDisconnect), name: .GCControllerDidDisconnect, object: nil ) isSetup = true } @objc private func controllerDidConnect(notification: Notification) { delegate?.didConnectController() self.createAndStartHapticEngine() } @objc private func controllerDidDisconnect(notification: Notification) { delegate?.didDisconnectController() hapticEngine = nil hapticPlayer = nil } private func createAndStartHapticEngine() { guard let controller = GCController.controllers().first else { print("No controller connected") return } guard controller.haptics != nil else { print("Haptics not supported on this controller") return } hapticEngine = createEngine(for: controller, locality: .default) hapticEngine?.playsHapticsOnly = true do { try hapticEngine?.start() } catch { print("Не удалось запустить движок тактильной обратной связи: \(error)") } } private func createEngine(for controller: GCController, locality: GCHapticsLocality) -> CHHapticEngine? { guard let engine = controller.haptics?.createEngine(withLocality: locality) else { print("Failed to create engine.") return nil } print("Successfully created engine.") engine.stoppedHandler = { reason in print("The engine stopped because \(reason.message)") } engine.resetHandler = { print("The engine reset --> Restarting now!") do { try engine.start() } catch { print("Failed to restart the engine: \(error)") } } return engine } func startHapticFeedback(haptics: [CHHapticEvent]) { do { let pattern = try CHHapticPattern(events: haptics, parameters: []) hapticPlayer = try hapticEngine?.makeAdvancedPlayer(with: pattern) hapticPlayer?.loopEnabled = true try hapticPlayer?.start(atTime: 0) self.delegate?.enginePlayerStart(value: true) } catch { self.delegate?.enginePlayerStart(value: false) print("Не удалось создать или воспроизвести паттерн: \(error)") } } func stopHapticFeedback() { do { try hapticPlayer?.stop(atTime: 0) self.delegate?.enginePlayerStart(value: false) } catch { self.delegate?.enginePlayerStart(value: true) print("Не удалось остановить воспроизведение вибрации: \(error)") } } } extension CHHapticEngine.StoppedReason { var message: String { switch self { case .audioSessionInterrupt: return "the audio session was interrupted." case .applicationSuspended: return "the application was suspended." case .idleTimeout: return "an idle timeout occurred." case .systemError: return "a system error occurred." case .notifyWhenFinished: return "playback finished." case .engineDestroyed: return "the engine was destroyed." case .gameControllerDisconnect: return "the game controller disconnected." @unknown default: return "an unknown error occurred." } } } custom haptic events - static func changeVibrationPower(power: HapricPower) -> [CHHapticEvent] { let continuousEvent = CHHapticEvent(eventType: .hapticContinuous, parameters: [ CHHapticEventParameter(parameterID: .hapticSharpness, value: 1.0), CHHapticEventParameter(parameterID: .hapticIntensity, value: power.value) ], relativeTime: 0, duration: 0.5) return [continuousEvent] }
1
0
369
Feb ’25
Unable to connect to any HID device using Core HID
Hello, I am currently working on a USB HID-class device and I wanted to test communications between various OSes and the device. I was able to communicate through standard USB with the device on other OSes such as Windows and Linux, through their integrated kernel modules and generic HID drivers. As a last test, I wanted to test macOS as well. This is my code, running in a Swift-based command line utility: import Foundation import CoreHID let matchingCriteria = HIDDeviceManager.DeviceMatchingCriteria(vendorID: 0x1234, productID: 0x0006) // This is the VID/PID combination that the device is actually listed under let manager = HIDDeviceManager() for try await notification in await manager.monitorNotifications(matchingCriteria: [matchingCriteria]) { switch notification { case .deviceMatched(let deviceReference): print("Device Matched!") guard let client = HIDDeviceClient(deviceReference: deviceReference) else { fatalError("Unable to create client. Exiting.") // crash on purpose } let report = try await client.dispatchGetReportRequest(type: .input) print("Get report data: [\(report.map { String(format: "%02x", $0) }.joined(separator: " "))]") case .deviceRemoved(_): print("A device was removed.") default: continue } } The client.dispatchGetReportRequest(...) line always fails, and if I turn the try expression into a force-unwrapped one (try!) then the code, unsurprisingly, crashes. The line raises a CoreHID.HIDDeviceError.unknown() exception with a seemingly meaningless IOReturn code (last time I tried I got an IOReturn code with the value of -536870211). The first instinct is to blame my own custom USB device for not working properly, but it doesn't cooperate with with ANY USB device currently connected: not a keyboard (with permissions granted), not a controller, nothing. I did make sure to enable USB device access in the entitlements (when I tried to run this code in a simple Cocoa app) as well. ...What am I doing wrong here? What does the IOReturn code mean? Thanks in advance for anybody willing to help out!
1
0
411
Feb ’25