Can't connect to the receiver by personal hotspot (on phone aka tethering)
Closed this issue · 4 comments
Server: iPhone (iOS 15.1)
Receiver: Windows with python 3.6
When making connections with local router or windows tethering everything is ok, while using personal hotspot from iPhone, the pairing process would be stopped after server received the reply from the second fairplay setup. I have no idea that whether two apple device could use AirPlay by personal hotspot, so if there's any solution (maybe NTP with legacy pairing), please tell me, thanks.
System logs of iPhone from one failed connection
Nov 12 16:30:09 mediaserverd(CoreUtils)[35] <Notice>: Pair-setup transient client done -- server authenticated
Nov 12 16:30:09 mediaserverd(CoreUtils)[35] <Notice>: [0x831E] Control pair-setup coreUtils success
Nov 12 16:30:09 mediaserverd(CoreUtils)[35] <Notice>: [0x6AAB] Created pairing client [0x831E]
Nov 12 16:30:09 mediaserverd(CoreUtils)[35] <Notice>: [0x6AAB] Created APKeyHolderCoreUtils [0x3990]
Nov 12 16:30:09 mediaserverd(libMobileGestalt.dylib)[35] <Notice>: elided platform fast path for key: re6Zb+zwFKJNlkQTUeT+/w
Nov 12 16:30:09 mediaserverd(CoreUtils)[35] <Notice>: Request start: CID 0xE4B10005, Peer NULL, TimeoutSecs 60
Nov 12 16:30:09 mediaserverd(CoreUtils)[35] <Notice>: Request written: CID 0xE4B10005, Header 196 bytes, Body 16 bytes
Nov 12 16:30:09 mediaserverd(CoreUtils)[35] <Notice>: Response received: CID 0xE4B10005, Header 73 bytes, Body 142 bytes, Status 200
Nov 12 16:30:09 mediaserverd(CoreUtils)[35] <Notice>: Request start: CID 0xE4B10006, Peer NULL, TimeoutSecs 60
Nov 12 16:30:09 mediaserverd(CoreUtils)[35] <Notice>: Request written: CID 0xE4B10006, Header 197 bytes, Body 164 bytes
Nov 12 16:30:09 mediaserverd(CoreUtils)[35] <Notice>: Response received: CID 0xE4B10006, Header 72 bytes, Body 32 bytes, Status 200
Nov 12 16:30:09 kernel(IOTimeSyncFamily)[0] <Notice>: IOTimeSyncClockManager::addgPTPServices adding services
Nov 12 16:30:09 mediaserverd(TimeSync)[35] <Notice>: Adding Client <private> to clock <private> clients <private>
Nov 12 16:30:09 mediaserverd(CoreMedia)[35] <Notice>: <<<< 8021ASClock >>>> CM8021ASClockCreate: clock <0x15d5278b0> initially locked to GM 0x68ef433b5a4e0008
Nov 12 16:30:09 mediaserverd(CoreUtils)[35] <Notice>: Setting PTP clock 0xA8D8 to update every 2000 ms
Nov 12 16:30:09 kernel(IOTimeSyncFamily)[0] <Notice>: IOTimeSyncClockManager::addgPTPServices adding services
Nov 12 16:30:09 mediaserverd(TimeSync)[35] <Notice>: Adding Client <private> to clock <private> clients <private>
Nov 12 16:30:09 mediaserverd(TimeSync)[35] <Notice>: Adding Client <private> to clock <private> clients <private>
Nov 12 16:30:09 mediaserverd(CoreMedia)[35] <Notice>: <<<< TimeSyncClock >>>> CMTimeSyncClockCreateForSystemDomainClockIdentifier: clock 0x15d580ce0 created
Nov 12 16:30:09 mediaserverd(CoreUtils)[35] <Notice>: [0xA8D8] GMID: 0x68ef433b5a4e0008 --> 0x68ef433b5a4e0008, GM peer is: 'NULL'
Nov 12 16:30:09 mediaserverd(CoreUtils)[35] <Notice>: [0xA8D8] Clock hub changed to NULL.
Nov 12 16:30:09 mediaserverd(CoreUtils)[35] <Notice>: [0xA8D8] <AirPlayClock> APSNetworkClock PTP started
Nov 12 16:30:09 mediaserverd(CoreUtils)[35] <Notice>: BootUUID 4D8D62FD-AC34-46D0-B96F-9DF8C333A1E0
Nov 12 16:30:09 mediaserverd(CoreUtils)[35] <Error>: clock_copyUsableInterface:422: false condition
Nov 12 16:30:09 mediaserverd(CoreUtils)[35] <Error>: APSNetworkClockDetermineAndSetOrUpdateLocalPeerInfo:782: got error -71974/0xFFFEE6DA
Nov 12 16:30:09 mediaserverd(CoreUtils)[35] <Error>: apsession_ensureSenderNetworkClockStarted:4356: got error -71974/0xFFFEE6DA
Nov 12 16:30:09 mediaserverd(CoreUtils)[35] <Error>: ### [0x6AAB] Failed to set up senderNetworkClock err = -71974/0xFFFEE6DA
Nov 12 16:30:09 mediaserverd(CoreUtils)[35] <Error>: ptpClock_removePeerInternal:1225: false condition
Nov 12 16:30:09 mediaserverd(CoreUtils)[35] <Notice>: ### Removing peer from PTP clock 0xA8D8 failed, err -72291/0xFFFEE59D
Nov 12 16:30:09 mediaserverd(CoreUtils)[35] <Error>: ### [0x6AAB] Failed to remove peer 172.20.10.3 from sender network clock
Nov 12 16:30:09 mediaserverd(CoreUtils)[35] <Notice>: [0xA8D8] <AirPlayClock> APSNetworkClock PTP stopped
Nov 12 16:30:09 mediaserverd(CoreUtils)[35] <Error>: apsession_ensureStartedInternalStage1StartTransaction:2136: got error -71974/0xFFFEE6DA
Nov 12 16:30:09 mediaserverd(CoreUtils)[35] <Notice>: [0x6AAB] Disconnecting from 'myap2-AP'
Nov 12 16:30:09 mediaserverd(CoreUtils)[35] <Error>: ### [0xF6A8] Received sender session failed notification.
Nov 12 16:30:09 wifid[52] <Notice>: __WiFiServerClientTerminationCallback: Client mediaserverd terminated, cleanup state
Nov 12 16:30:09 wifid(WiFiPolicy)[52] <Notice>: manager->wow.lpasSetting 1 CFSetGetCount(manager->wow.wowClients) 2 isWowActivityRegistered=0 manager->wow.overrideWoWState 0 manager->externalPower 1 manager->iokit.battery.chargeLevel 72
Nov 12 16:30:09 mediaserverd(CoreUtils)[35] <Notice>: [0x6AAB] APSenderSessionAirPlay disconnected
Nov 12 16:30:09 mediaserverd(CoreUtils)[35] <Error>: apsession_ensureStartedInternal:2069: got error -71974/0xFFFEE6DA
Nov 12 16:30:09 mediaserverd(CoreUtils)[35] <Error>: endpoint_activateInternal:3056: got error -71974/0xFFFEE6DA
Nov 12 16:30:09 mediaserverd(CoreUtils)[35] <Error>: [0xF6A8] Endpoint activation (seed 1) failed with error -71974/0xFFFEE6DA .
Nov 12 16:30:09 mediaserverd(CoreUtils)[35] <Notice>: [0xF6A8] Deactivating endpoint 'myap2' with reason 'FailedActivation'...
Nov 12 16:30:09 mediaserverd(CoreUtils)[35] <Notice>: [0xA98B] APTransportConnectionHTTP finalizing.
System logs of iPhone from one successful connection
Nov 12 16:24:10 mediaserverd(CoreUtils)[35] <Notice>: Pair-setup transient client done -- server authenticated
Nov 12 16:24:10 mediaserverd(CoreUtils)[35] <Notice>: [0x2489] Control pair-setup coreUtils success
Nov 12 16:24:10 mediaserverd(CoreUtils)[35] <Notice>: [0x86DB] Created pairing client [0x2489]
Nov 12 16:24:10 mediaserverd(CoreUtils)[35] <Notice>: [0x86DB] Created APKeyHolderCoreUtils [0xFE89]
Nov 12 16:24:10 mediaserverd(libMobileGestalt.dylib)[35] <Notice>: elided platform fast path for key: re6Zb+zwFKJNlkQTUeT+/w
Nov 12 16:24:10 mediaserverd(CoreUtils)[35] <Notice>: Request start: CID 0xB7E60005, Peer NULL, TimeoutSecs 60
Nov 12 16:24:10 mediaserverd(CoreUtils)[35] <Notice>: Request written: CID 0xB7E60005, Header 196 bytes, Body 16 bytes
Nov 12 16:24:10 mediaserverd(CoreUtils)[35] <Notice>: Response received: CID 0xB7E60005, Header 73 bytes, Body 142 bytes, Status 200
Nov 12 16:24:10 mediaserverd(CoreUtils)[35] <Notice>: Request start: CID 0xB7E60006, Peer NULL, TimeoutSecs 60
Nov 12 16:24:10 mediaserverd(CoreUtils)[35] <Notice>: Request written: CID 0xB7E60006, Header 197 bytes, Body 164 bytes
Nov 12 16:24:10 mediaserverd(CoreUtils)[35] <Notice>: Response received: CID 0xB7E60006, Header 72 bytes, Body 32 bytes, Status 200
Nov 12 16:24:10 kernel(IOTimeSyncFamily)[0] <Notice>: IOTimeSyncClockManager::addgPTPServices adding services
Nov 12 16:24:10 mediaserverd(TimeSync)[35] <Notice>: Adding Client <private> to clock <private> clients <private>
Nov 12 16:24:10 mediaserverd(CoreMedia)[35] <Notice>: <<<< 8021ASClock >>>> CM8021ASClockCreate: clock <0x15d43d1e0> initially locked to GM 0x68ef433b5a4e0008
Nov 12 16:24:10 mediaserverd(CoreUtils)[35] <Notice>: Setting PTP clock 0xA8D8 to update every 2000 ms
Nov 12 16:24:10 kernel(IOTimeSyncFamily)[0] <Notice>: IOTimeSyncClockManager::addgPTPServices adding services
Nov 12 16:24:10 mediaserverd(TimeSync)[35] <Notice>: Adding Client <private> to clock <private> clients <private>
Nov 12 16:24:10 mediaserverd(TimeSync)[35] <Notice>: Adding Client <private> to clock <private> clients <private>
Nov 12 16:24:10 mediaserverd(CoreMedia)[35] <Notice>: <<<< TimeSyncClock >>>> CMTimeSyncClockCreateForSystemDomainClockIdentifier: clock 0x15d535330 created
Nov 12 16:24:10 mediaserverd(CoreUtils)[35] <Notice>: [0xA8D8] GMID: 0x68ef433b5a4e0008 --> 0x68ef433b5a4e0008, GM peer is: 'NULL'
Nov 12 16:24:10 mediaserverd(CoreUtils)[35] <Notice>: [0xA8D8] Clock hub changed to NULL.
Nov 12 16:24:10 mediaserverd(CoreUtils)[35] <Notice>: [0xA8D8] <AirPlayClock> APSNetworkClock PTP started
Nov 12 16:24:10 mediaserverd(CoreUtils)[35] <Notice>: BootUUID 4D8D62FD-AC34-46D0-B96F-9DF8C333A1E0
Nov 12 16:24:10 mediaserverd(CoreUtils)[35] <Notice>: Setting local peer info for PTP clock 0xA8D8 to {
"ID" : "4D8D62FD-AC34-46D0-B96F-9DF8C333A1E0",
"Addresses" :
[
<APSNetworkAddress 0x15d52f830 '192.168.1.4'>,
<APSNetworkAddress 0x15d7c9a50 'fe80::4c3:18b7:7922:754e%en0'>,
<APSNetworkAddress 0x15d7c9a80 '240e:398:3eb:5570:1070:ba5a:8782:108'>
],
"DeviceType" : 0,
"InterfaceName" : "en0",
"SupportsClockPortMatchingOverride" : true,
}
Nov 12 16:24:10 mediaserverd(CoreUtils)[35] <Notice>: [0xA8D8] Number of legacy peers added to peer list: 0
The errors seem to centre around PTP - try to disable PTP using correct flags. But PTP was on in both cases, so it's difficult to say either way 🤷
OK - this looks directly related to PTP.
If I run
python3 ap2-receiver.py -n en0 --debug
the AP shows up but I cannot connect from the tethered iPhone.
If I run
python3 ap2-receiver.py -n en0 --debug -ftxor 41
on a tethered iPhone, the AP shows up and I can connect and stream. Audio does not work, because we're in buffered audio, NTP mode, which implies FP2 encryption (I think)..? I see no shk
exchanged...
BUT, if you run
python3 ap2-receiver.py -n en0 --debug -ftxor 41 40
then you get 'unbuffered' audio and ANNOUNCE, which works - I committed it a while ago.
Addendum: I'm not certain what iOS does not like about PTP, but it's iOS that causes the problem here.
Evidently, (some versions of) iOS cannot handle PTP and tethered clients (very well).
I've tried and it works, thanks. Using NTP with 'unbuffered' audio and ANNOUNCE rather than PTP is fine, but these are features from AirPlay 1. Hopefully the problem will be fixed in a future version.