Files
AirCard/Sources/device_discovery.h
Nino Meier 622ebb4dfa fix(device): stop requesting RemoteXPC so USB iPhones enumerate on macOS 27
device_helper asked AMDeviceNotificationSubscribeWithOptions for the RemoteXPC transport next to the USB mux. On macOS 27 (26A5388g) that replaces the mux transport instead of extending it: a cable-connected, paired iPhone fired no connected callback at all, only detach callbacks with a NULL device.

device_helper list therefore printed [], so the device check showed "No iPhone found. Please connect via USB." and the scanner reported "iPhone not found. Reconnect it via USB." A direct usbmuxd ListDevices call, ioreg and devicectl all listed the same device, and the same subscription without the option returned it immediately.

Move the options into Sources/device_discovery.h so the transport set is testable, and add tests/test_device_discovery.py, which fails if RemoteXPC is requested again.

Validated on macOS 27.0 (26A5388g) with an iPhone 16 Pro on iOS 27.0 (24A5370h): list, probe and syslog all reach the device. See docs/device-detection.md.
2026-09-29 16:02:09 +08:00

32 lines
1.4 KiB
Objective-C

#ifndef AIRCARD_DEVICE_DISCOVERY_H
#define AIRCARD_DEVICE_DISCOVERY_H
#import <Foundation/Foundation.h>
// Notification options for AMDeviceNotificationSubscribeWithOptions.
//
// `NotificationOptionEnableRemoteXPC` is deliberately absent. AirCard reaches
// devices over usbmuxd (AMDeviceConnect, AMDeviceSecureStartService), so the
// mux transport is the one that has to be requested. On macOS 27 (26A5388g)
// enabling RemoteXPC does not add to that transport, it replaces it: a
// cable-connected, paired iPhone fires no connected callback at all, only
// detach callbacks with a NULL device. Every enumeration then reported "No
// iPhone found" and the card scanner reported "iPhone not found", even though
// ioreg, usbmuxd and devicectl all listed the device. Removing the option
// returns the device immediately on the same machine.
//
// Wi-Fi paired devices stay covered: usbmuxd publishes those over the same mux
// transport, and `NotificationOptionSearchForWiFiPairableDevices` is off here
// because this helper never pairs a device over the network.
static NSDictionary *AirCardDeviceNotificationOptions(BOOL directConnectionsOnly) {
return @{
@"NotificationOptionSearchForPairedDevices": @YES,
@"NotificationOptionSearchForPairedDevicesViaDirectConnectionsOnly":
@(directConnectionsOnly),
@"NotificationOptionSearchForWiFiPairableDevices": @NO,
@"NotificationOptionEnableUSBMux": @YES,
};
}
#endif