#17

fix(ios): unlock a phone that does not report its backlight state

Openyaoqiangyaowants to merge intofrom

An iPhone 18 Pro Max on iOS 27.2 leaves the backlight state out of its display info, so screenAwake failed with "unknown backlight state" and unlocking from the computer stopped before the passcode pad.

What changes

  • screenAwake wraps a new errUnknownBacklight.
  • reachPad wakes the phone with the new wakeForPad: when the backlight state is unknown and the phone is locked, it presses Home (unless wakeUp already did) and waits wakeWait for the screen. On the lock screen Home only lights the screen. An unlocked phone is left alone, since Home would send the app in front away.
  • wake outside unlocking is unchanged: it still reports the unknown state.

Tests

go vet and go test ./internal/driver/ios/ pass, and so does go test ./... on Windows. New cases in TestUnlock: no backlight state with the pad on the first swipe, with the pad on the second swipe, and with the phone already unlocked. TestWake checks that wake still returns errUnknownBacklight and presses nothing.

Suggested release notes

CHANGELOG.md:

  • Unlocking an iPhone from the computer now works when the phone doesn't say whether its screen is on, as some iPhones on iOS 27 do.

CHANGELOG.zh-CN.md:

  • 有些 iOS 27 的 iPhone 不报告屏幕是否亮着,现在从电脑也能解锁这类 iPhone。

Refs #15

🤖 Generated with Claude Code

Activity

2
DIYgod9h ago

Thanks for this! #14, merged shortly before this PR was opened, fixed the same "unknown backlight state" failure on iOS 27.2 at its source: iOS 27.2 moved backlightState from the main display's entry to the top of the getdisplayinfo reply, and Pinky now reads it from there too. Your change was probably written before #14 landed. Could you try release 2026.1109.1, which includes #14, on your iPhone 18 Pro Max? If unlocking works, this PR isn't needed and we can close it. If it still fails with an empty backlight state, please attach the raw getdisplayinfo reply (with any identifiers removed) so we can see where the state is, or whether it's missing. We'd rather read it from the right place than press Home without knowing whether the screen is on.