Research: Stock Recovery strace Analysis — Display Init & Input Map

Stock Recovery strace Analysis

Source: /system/bin/recovery from firmware/na1-stock-recovery.img ramdisk, run in chroot on TWRP v2.5. Raw log: firmware/strace-stock-recovery.log (3268 lines).

Display Initialization — Authoritative Sequence

StepSyscallfdDetail
1openat("/dev/graphics/fb0", O_RDWR|O_CLOEXEC)0Main fb0 handle
2–3ioctl(FBIOGET_FSCREENINFO / VSCREENINFO)0Read screen params
4mmap(21209088, MAP_SHARED)0Full double-buffer (7552×2808)
5–8Open fb0 again → read geometry → close12ebc helper (geometry only)
9openat("/dev/ebc", O_RDWR)12EPDC control device
10mmap(10513152, MAP_SHARED)12ebc pixel buffer (7488×1404, pixel-exact)
11ioctl(12, 0x700c) EBC_SEND_UPDATE12Init/clear — BEFORE blank
12ioctl(0, FBIOBLANK, 4)0FB_BLANK_POWERDOWN
13ioctl(0, FBIOBLANK, 0)0FB_BLANK_UNBLANK
14–15ioctl(12, 0x700c) EBC_SEND_UPDATE ×212Content updates

What stock code does NOT do

  • FBIOPUT_VSCREENINFO — never called
  • FBIOPAN_DISPLAY — never called
  • Any sysfs writes to EPDC nodes
  • EBC_WAIT_UPDATE (0x700d) — not during init
  • EBC_CLEAR (0x700e) — never called

Critical Finding: Stock Binary Also Failed in TWRP Environment

When the stock recovery binary was run in a chroot inside TWRP (with TWRP process SIGSTOP’d), it completed its full display init sequence but produced no visible display change. This proved definitively that the display problem was NOT a userspace ioctl issue — the problem was in the kernel boot environment (missing waveform firmware file at /waveform/eink_waveform.wbf). See Research: A2 Waveform Mode for the root cause and fix.

Input Device Map

DeviceIdentityTWRP use
event0Power + Back button (KEY_POWER, KEY_BACK)Use
event1Capacitive touchscreen — MT type B (ABS_MT_SLOT, POSITION_X/Y, TRACKING_ID)Primary input
event2EMR Wacom stylus (ABS_X/Y/PRESSURE/DISTANCE, BTN_TOOL_RUBBER/BRUSH)Blacklist
event3USB/BT mouse (BTN_LEFT, BTN_RIGHT)Optional
event4Virtual keys / GPIO (KEY_ENTER, KEY_HOME, KEY_UP…)Ignore
event5Hall sensor (KEY_LEFTALT, KEY_POWER, KEY_WAKEUP)Blacklist
event6Volume up (KEY_VOLUMEUP)Ignore

Other Operations

  • Brightness: writes 127 to /sys/class/leds/lcd-backlight/brightness (LED class path, different from TWRP’s direct i2c path)
  • Zeros 2048 bytes of misc partition (clears BCB on every recovery boot)
  • Mounts /cache (ext4, /dev/block/mmcblk0p12)
  • Opens /dev/kmsg for dual logging
  • Spawns 3 threads: logging, property reader, screen update

More posts