Skip to content

Let an AI model use a real iPhone with a $7 ESP32: AirPlay eyes, USB HID hands, any OpenAI-compatible vision model. No Mac, no developer account, no jailbreak.

docs+firmware: note iPhone-only AirPlay source; log no video received (#50)

shinjiyu43708fd5c6e6
diff --git a/README.md b/README.md
index bbe1adb..4cbaf21 100644
--- a/README.md
+++ b/README.md
@@ -144,6 +144,8 @@ Debugging without the phone app: `hardware/tools/board_test.py` plays the app ov
## Limitations
+- **AirPlay source must be an iPhone.** Screen Mirroring from macOS (and other non-iPhone clients) is not supported
+ yet: the handshake can look healthy while the board never receives video.
- BLE carries about 300-500 kbps, so the screen is mirrored small (480×1040, ≤5 fps); each step takes a few seconds,
most of it the model.
- iOS does not mirror some screens (passcode entry, Apple Pay, DRM video); the agent cannot see them. Mirroring stops
diff --git a/README.zh-CN.md b/README.zh-CN.md
index 48c2345..ed2556f 100644
--- a/README.zh-CN.md
+++ b/README.zh-CN.md
@@ -124,6 +124,7 @@ server/ 旧版 v0.1.0 的电脑端服务,新版不使用(见 server/READ
## 限制
+- **AirPlay 源必须是 iPhone。** 暂不支持从 macOS(及其他非 iPhone 客户端)屏幕镜像:握手看起来正常,但板子收不到视频。
- 蓝牙约 300-500 kbps,所以镜像画面很小(480×1040,≤5 fps);每一步要几秒,主要花在模型上。
- iOS 不镜像部分界面(输入密码、Apple Pay、DRM 视频),Agent 看不到。手机锁屏后镜像会停止。
- Agent 运行时,手机的 Wi-Fi 是板子的热点(没有外网),模型走蜂窝数据。
diff --git a/hardware/hid_bridge/src/airplay/mirror.c b/hardware/hid_bridge/src/airplay/mirror.c
index 1106bb3..f77ab84 100644
--- a/hardware/hid_bridge/src/airplay/mirror.c
+++ b/hardware/hid_bridge/src/airplay/mirror.c
@@ -27,6 +27,8 @@
static struct {
volatile bool run, done;
volatile int64_t last_data_us;
+ int64_t accepted_us;
+ bool got_codec, logged_no_video;
mbedtls_aes_context aes;
uint8_t iv[16], stream[16];
size_t off;
@@ -69,6 +71,7 @@ static void handle_codec(const uint8_t *p, size_t n) {
memcpy(cfg + 4 + sps, sc, 4);
memcpy(cfg + 8 + sps, p + sps + 11, pps);
ap_log("mirror: SPS %u + PPS %u bytes", (unsigned)sps, (unsigned)pps);
+ m.got_codec = true;
if (ap_cfg.on_config) ap_cfg.on_config(cfg, 8 + sps + pps);
}
@@ -109,6 +112,12 @@ static void mirror_task(void *arg) {
int fds[4] = {m.sfd >= 0 ? m.sfd : m.lfd, m.tfd, m.afd[0], m.afd[1]}, maxfd = -1;
for (int i = 0; i < 4; i++)
if (fds[i] >= 0) { FD_SET(fds[i], &rf); if (fds[i] > maxfd) maxfd = fds[i]; }
+ // Mac-as-source often completes RTSP/FairPlay then sends no H.264; surface that silence.
+ if (m.sfd >= 0 && !m.got_codec && !m.logged_no_video && m.accepted_us &&
+ esp_timer_get_time() - m.accepted_us >= 5000000) {
+ ap_log("mirror: no video received - AirPlay source must be an iPhone; macOS mirroring is not supported yet");
+ m.logged_no_video = true;
+ }
struct timeval tv = {0, 100000};
if (select(maxfd + 1, &rf, NULL, NULL, &tv) <= 0) continue;
if (m.tfd >= 0 && FD_ISSET(m.tfd, &rf)) {
@@ -121,6 +130,9 @@ static void mirror_task(void *arg) {
if (!FD_ISSET(m.lfd, &rf)) continue;
m.sfd = accept(m.lfd, NULL, NULL);
got = 0, need = 128, in_payload = false;
+ m.got_codec = false;
+ m.logged_no_video = false;
+ m.accepted_us = m.sfd >= 0 ? esp_timer_get_time() : 0;
ap_log("mirror: data connection %s", m.sfd >= 0 ? "accepted" : "failed");
continue;
}
@@ -179,6 +191,9 @@ bool ap_mirror_start(const uint8_t aeskey[16], uint64_t stream_id, uint32_t remo
m.remote_ip = remote_ip;
m.timing_rport = timing_rport;
m.last_data_us = 0;
+ m.accepted_us = 0;
+ m.got_codec = false;
+ m.logged_no_video = false;
m.lfd = bind_sock(SOCK_STREAM, AP_MIRROR_PORT);
m.tfd = bind_sock(SOCK_DGRAM, AP_TIMING_PORT);
m.afd[0] = bind_sock(SOCK_DGRAM, AP_AUDIO_DATA_PORT);