Files
zenbook/docs/adaptation-plan-ux8406m.md
T
2026-09-26 17:37:13 +02:00

4.9 KiB

Zenbook Duo UX8406M — Adaptation Plan

Machine: ASUS Zenbook Duo UX8406MA (UX8406M family)
OS: Ubuntu, GNOME on Wayland
Date: 2026-09-18

This document captures the audit and implementation plan so work can be resumed if a session is interrupted.


Goal

When the detachable keyboard is off the pogo pins (connected via Bluetooth or standalone USB), enable the second screen (eDP-2). When docked on the pins (USB HID bus 0003), disable the second screen.


Machine inventory (verified)

Item Value
Model ASUS Zenbook Duo UX8406MA_UX8406MA
Desktop ubuntu:GNOME, Wayland
Primary display eDP-1 — backlight intel_backlight
Secondary display eDP-2 — backlight card1-eDP-2-backlight
ScreenPad WMI asus_screenpad (exists; code uses eDP-2 backlight)
Touch top i2c-ELAN9008:00 → eDP-1
Touch bottom i2c-ELAN9009:00 → eDP-2
Keyboard (BT) HID_ID=0005:0B05:1B2D, name ASUS Zenbook Duo Keyboard
Display control gdctl via mutter-common-bin
User groups input group already present

Hardware paths match codebase expectations (duo.rs, touchscreen.rs, sysfs.rs, probe.rs).


Root causes of install failure

  1. Missing build dependencies — libglib2.0-dev, libgtk-3-dev, libwebkit2gtk-4.1-dev, etc. All Rust binaries share the Tauri crate, so even daemons need GTK dev packages.

  2. Wrong install order — install.sh runs setup-gnome.sh → install-rust-runtime.sh (cargo build) before install-ui.sh installs build prerequisites.

  3. Runtime removed — /usr/local/libexec/zenbook-duo/ missing; systemd units gone; no ~/.config/zenbook-duo/settings.json.

  4. Historical runtime errors (when previously installed):

    • Session agent socket missing → display-mode policy failed
    • Touchscreen unbind No such device (os error 19) on resume (race)
  5. Minor test bug — check.sh greps for single-line --version hook; zenbook-duo-session-agent.rs uses multiline call.


Dock / undock logic (code)

  • ConnectionType::Usb (HID_ID=0003:…) → keyboard_attached = true → disable eDP-2
  • ConnectionType::Bluetooth (HID_ID=0005:…) → keyboard_attached = false → enable eDP-2
  • Detection: hardware/sysfs.rs → detect_connection_type() via /sys/class/hidraw/*/device/uevent

Key files:

  • runtime/probe.rs — keyboard_attached()
  • runtime/policy.rs — display/Wi-Fi/BT transitions
  • runtime/session_agent.rs — apply_dock_mode() via gdctl

Implementation checklist

Phase 1 — Build environment

sudo apt update
sudo apt install -y \
  build-essential pkg-config libssl-dev \
  libglib2.0-dev libgtk-3-dev libwebkit2gtk-4.1-dev librsvg2-dev \
  libayatana-appindicator3-dev \
  usbutils iio-sensor-proxy systemd mutter-common-bin

Phase 2 — Codebase fixes (this session)

  • Install build prereqs from setup-common.sh before install-rust-runtime.sh
  • Fix check.sh smoke test for multiline --version hooks
  • Document product ID 1B2D in README (alongside 1B2C)
  • Harden touchscreen restore with retry on lifecycle resume
  • Optional later: asus_screenpad fallback if eDP-2 backlight insufficient
  • Optional later: split runtime crate from Tauri (daemon builds without GTK)

Blocked on sudo: package install and ./install.sh require an interactive terminal password. There is also a broken sudoers line on this machine (work ALL=NOPASSWD:/usr/bin/tee /sys/class/backlight/*/brightness — wildcards not allowed).

Phase 3 — Install and verify

cd /home/andrea/Documents/repo/zenbook
./install.sh
# Recommended: scale 1.25, USB media remap Yes

systemctl status zenbook-duo-rust-daemon.service
systemctl --user status zenbook-duo-session-agent.service
journalctl -u zenbook-duo-rust-daemon.service -f

After install, log out/in once if session agent fails to start.

Phase 4 — Validation tests

Test Expected
BT keyboard, undocked 2 logical monitors in gdctl show
Keyboard on pogo pins (USB 0003:) 1 logical monitor
Attach/detach transition Toggle within ~1s; journal shows status transition
Suspend/resume Layout restored; no repeated touchscreen errors

Resume commands (if session lost)

cd /home/andrea/Documents/repo/zenbook
cat docs/adaptation-plan-ux8406m.md
./check.sh all
./install.sh

If build still fails on GTK:

sudo apt install -y libglib2.0-dev libgtk-3-dev libwebkit2gtk-4.1-dev librsvg2-dev libssl-dev build-essential pkg-config
./setup-gnome.sh

Files touched in this adaptation

  • setup-common.sh — build deps before Rust runtime
  • tests/install-stdin-test.sh — relaxed --version grep
  • README.md — product ID note
  • ui-tauri-react/src-tauri/src/runtime/daemon.rs — touchscreen restore retry
  • docs/adaptation-plan-ux8406m.md — this file