mirror of
https://github.com/Mak5er/AirCard
synced 2026-11-26 17:07:57 +08:00
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.
31 lines
1.1 KiB
Python
31 lines
1.1 KiB
Python
import subprocess
|
|
import sys
|
|
import tempfile
|
|
import unittest
|
|
from pathlib import Path
|
|
|
|
|
|
@unittest.skipUnless(sys.platform == "darwin", "The native discovery options require macOS")
|
|
class DeviceDiscoveryTests(unittest.TestCase):
|
|
@classmethod
|
|
def setUpClass(cls):
|
|
cls.temporary = tempfile.TemporaryDirectory()
|
|
cls.addClassCleanup(cls.temporary.cleanup)
|
|
cls.executable = Path(cls.temporary.name) / "test_device_discovery"
|
|
source = Path(__file__).with_name("test_device_discovery.m")
|
|
subprocess.run(
|
|
["xcrun", "clang", "-fobjc-arc", "-Wall", "-Wextra", "-Werror",
|
|
"-framework", "Foundation", str(source), "-o", str(cls.executable)],
|
|
check=True, capture_output=True, text=True,
|
|
)
|
|
|
|
def test_device_options_request_usb_mux_only(self):
|
|
result = subprocess.run(
|
|
[str(self.executable)], check=True, capture_output=True, text=True,
|
|
)
|
|
self.assertIn("USB mux-only device discovery options passed", result.stdout)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|