I'm currently working on an iOS app which needs to pair to a custom external device (smart camera relying on a Raspberry Pi 3) to work correctly. The pairing mechanism is currently based on WebSockets, so the app and the camera needs to be on the same network to be discovered and work correctly.
For now, when both the app and the smart camera are on the same WiFi network, the pairing works, and everything work as expected. Nonetheless, the app needs to work even if it is not connected to an external WiFi network. So we thought we could use the iOS' Personal Hotspot to connect the smart camera to, so as to enable the pairing (since it would then be on the same network).
But, we're currently encountering a problem, after enabling Personal Hotspot from iOS, the camera either :
- does not "see" the WiFi Network, so it can't connect to it
- when the network is visible, it does not connect to the Personal Hotspot : it keeps trying to negotiate keys, and authenticating without success
When this problem occurs, we also tried to connect a Windows 7 laptop and a MacBookPro (running latest Sierra), but the WiFi connexion to iOS' Personal Hotspot could not been established either, with similar behaviors (wifi visibility, impossible to authenticate, connexion stabiliy...). So the problem does not seem to come with some network configuration on external devices, but more on the Personal Hotspot feature.
The logs on iOS are not very clear to me, so if someone could give a little insight it would be great:
par défaut 17:54:18.918592 +0200 sharingd Updated tethering support result = YES, wifiResult = YES, netRBResult = YES, firstUnlocked = YES
par défaut 17:54:18.918789 +0200 sharingd state = 1023, reason = 0
par défaut 17:54:18.918958 +0200 sharingd connected hosts = 1, only usb = NO, flipped switch on = NO, wifiClient = <WiFiManagerClient 0x101d2e630 [0x1b3994240]>, discovery state = YES, hostAPNetwork = YES, network timer = (null)
erreur 17:54:18.919786 +0200 locationd WifiMgr, error, bssid invalid, <private>, #CloneMe
erreur 17:54:18.920172 +0200 locationd WifiMgr, error, bssid invalid, <private>, #CloneMe
par défaut 17:54:18.920834 +0200 CommCenter #I Calling _CTGetCellularDataIsEnabled()
par défaut 17:54:18.929647 +0200 analyticsd [<private>] no observers; dropped.
par défaut 17:54:18.932031 +0200 symptomsd SCDynamicStore config_callback: k: com.apple.MobileInternetSharing
par défaut 17:54:18.932686 +0200 symptomsd SCDynamicStore key: com.apple.MobileInternetSharing, interfaces: {}
par défaut 17:54:18.947974 +0200 hostapd STA d4:7b:b0:8:37:a associated
par défaut 17:54:18.951673 +0200 hostapd STA d4:7b:b0:08:37:0a event 1 notification
par défaut 17:54:18.957204 +0200 hostapd STA d4:7b:b0:08:37:0a start authentication
par défaut 17:54:18.959079 +0200 hostapd STA d4:7b:b0:8:37:a DEAUTHORIZED.
par défaut 17:54:18.961158 +0200 hostapd STA d4:7b:b0:08:37:0a sending 1/4 msg of 4-Way Handshake
par défaut 17:54:19.044584 +0200 CommCenter QMI: Svc=0x03(NAS) Ind MsgId=0x0051 Bin=['01 2A 00 80 03 05 04 C9 39 51 00 1E 00 11 08 00 83 05 00 00 96 FF FF FF 14 06 00 BF EF 92 FF 9E FF A2 01 00 32 A4 03 00 01 32 00']
par défaut 17:54:19.242918 +0200 hostapd STA d4:7b:b0:08:37:0a received EAPOL-Key frame (2/4 Pairwise)
par défaut 17:54:19.245172 +0200 hostapd STA d4:7b:b0:08:37:0a MIC OK
par défaut 17:54:19.248415 +0200 hostapd STA d4:7b:b0:08:37:0a sending 3/4 msg of 4-Way Handshake
par défaut 17:54:19.799258 +0200 CommCenter QMI: Svc=0xe2(BSP) Req MsgId=0xe002 Bin=[<private>]
par défaut 17:54:19.840969 +0200 CommCenter QMI: Svc=0xe2(BSP) Resp MsgId=0xe002 Bin=[<private>]
par défaut 17:54:20.049299 +0200 CommCenter QMI: Svc=0x03(NAS) Ind MsgId=0x0051 Bin=['01 2A 00 80 03 05 04 CA 39 51 00 1E 00 11 08 00 83 05 00 00 96 FF FF FF 14 06 00 BB EE 94 FF 7C FF A2 01 00 32 A4 03 00 01 32 00']
par défaut 17:54:21.042898 +0200 CommCenter QMI: Svc=0x03(NAS) Ind MsgId=0x0051 Bin=['01 2A 00 80 03 05 04 CB 39 51 00 1E 00 11 08 00 83 05 00 00 96 FF FF FF 14 06 00 B8 EC 94 FF B6 FF A2 01 00 32 A4 03 00 01 32 00']
par défaut 17:54:21.806955 +0200 CommCenter QMI: Svc=0xe2(BSP) Req MsgId=0xe002 Bin=[<private>]
par défaut 17:54:21.847338 +0200 CommCenter QMI: Svc=0xe2(BSP) Resp MsgId=0xe002 Bin=[<private>]
par défaut 17:54:22.041651 +0200 CommCenter QMI: Svc=0x03(NAS) Ind MsgId=0x0051 Bin=['01 2A 00 80 03 05 04 CC 39 51 00 1E 00 11 08 00 83 05 00 00 96 FF FF FF 14 06 00 B7 EC 96 FF C0 FF A2 01 00 32 A4 03 00 01 32 00']
par défaut 17:54:23.048387 +0200 CommCenter QMI: Svc=0x03(NAS) Ind MsgId=0x0051 Bin=['01 2A 00 80 03 05 04 CD 39 51 00 1E 00 11 08 00 83 05 00 00 96 FF FF FF 14 06 00 B4 ED 94 FF DA FF A2 01 00 32 A4 03 00 01 32 00']
par défaut 17:54:23.816292 +0200 CommCenter QMI: Svc=0xe2(BSP) Req MsgId=0xe002 Bin=[<private>]
par défaut 17:54:23.867039 +0200 CommCenter QMI: Svc=0xe2(BSP) Resp MsgId=0xe002 Bin=[<private>]
par défaut 17:54:24.048262 +0200 CommCenter QMI: Svc=0x03(NAS) Ind MsgId=0x0051 Bin=['01 2A 00 80 03 05 04 CE 39 51 00 1E 00 11 08 00 83 05 00 00 96 FF FF FF 14 06 00 BC EF 93 FF 86 FF A2 01 00 32 A4 03 00 01 32 00']
par défaut 17:54:24.935783 +0200 CommCenter #I Data usage threshold reached for tethering, bytes consumed: 110254 total consumed:: 730740
par défaut 17:54:24.940706 +0200 CommCenter #I Cumulative bytes at threshold: 61045158, Previous value: 59016742, Delta: 2028416
par défaut 17:54:24.942240 +0200 CommCenter Threshold reached when entity: (uuid: <private> euuid: <private> pid: 4120 epid: 4120 process: <private> bundle id: <private>) consumed: (889770 bytes) on source: (identifier: 0x101f64630)
par défaut 17:54:24.942995 +0200 CommCenter #I Data usage threshold reached for internet context
We've tried to test the Personal Hotspot on several iOS devices (iPhones 5, 5S, 6, 6+, 6S, SE, 7, 7+ both running latest iOS 10 version), and with no explanation, it only worked when the iPhone SE shared its connexion (?!?)...
We're quite stuck on this, since iOS does not give much settings/information on Personal Hotspot, and it is a user-level feature, with no API to control it. What we've come to with some WiFi tools, it seems that iOS uses WPA2 Personal algorithm for securing its Personal Hotspot, but any additional information might be useful for us...
For the moment, we have already tried :
- Rename iPhone to remove any space and/or special characters
- Use a very simple password with no spaces and/or special characters
- Encode WiFi name in a base64 string on the Raspberry 3 /etc/wpa_supplicant/wpa_supplicant.conf conforming to this post but with no success
My wpa_supplicant.conf file looks currently like this :
network = {
ssid=aVBob25lNg0K
psk="passphrase"
key_mgmt=WPA-PSK
}
When pairing fails on a Raspberry Pi 3, the following logs can be observed :
Trying to associate with 76:8d:08:74:3c:33 (SSID='iphone6' freq=2412 MHz)
CTRL-EVENT-ASSOC-REJECT status_code=16
CTRL-EVENT-SCAN-STARTED
CTRL-EVENT-SCAN-RESULT
Do you have an idea of what could mean CTRL-EVENT-ASSOC-REJECT status_code=16
Any help or similar problem/experience from others people will be much appreciated, because this feature is critical for us, and a core to our business. For information, when the hotpot is hosted by an Android phone, everything works fine.
Thanks in advance for your help,