omarchy icon indicating copy to clipboard operation
omarchy copied to clipboard

Snapdragon cameras missing at login: omarchy-hw-wait-camera-access waits for media access but not for the sensors to bind

Open monkey1911 opened this issue 1 day ago • 1 comments

System

  • Microsoft Surface Pro 11 (Snapdragon X, x1e80100), aarch64
  • Omarchy 4.6.0rc2-1 (omarchy-settings 4.6.0rc2-1)
  • linux-omarchy 7.3.6-20, libcamera 0.7.2-4, WirePlumber 0.5.19-1
  • Sensors: OV13858 (rear), IMX681 (front), VD55G0 (IR), all on CAMSS via CCI

What happens

Some logins come up with no cameras in PipeWire: wpctl status lists only the raw Qualcomm Camera Subsystem [v4l2] nodes, with no Built-in Front/Back Camera. WirePlumber's libcamera log says:

INFO SimplePipeline simple.cpp:1911 No sensor found for /dev/media0

systemctl --user restart wireplumber brings both cameras back.

Expected

Both cameras are present after every login, without restarting WirePlumber.

Cause

/dev/media0 appears when CAMSS probes. The sensors bind to it later, and CAMSS creates their v4l-subdev nodes all at once, when the last sensor binds. libcamera reads the media graph once, when WirePlumber starts, and doesn't read it again when the subdevs appear afterwards.

omarchy-hw-wait-camera-access (the ExecStartPre in wireplumber.service.d/10-omarchy-camera-access.conf) waits only until the user can open /dev/media*. Access can arrive before the sensors bind, so WirePlumber can still start too early. The failing boot (journalctl -b -o short-monotonic):

[10.71]  qcom-camss acb7000.isp: ...                     <- /dev/media0 exists
[11.56]  systemd: Starting Multimedia Service Session Manager...
[12.01]  imx681 10-001a: detected model id 0x0681 (IMX681)
[12.02]  wireplumber: SimplePipeline: No sensor found for /dev/media0

Steps to reproduce

  1. Boot a Snapdragon laptop with CAMSS cameras (here a Surface Pro 11) and log in.
  2. Repeat until journalctl -b shows "Starting Multimedia Service Session Manager" before the sensor driver's probe line. Timing varies from boot to boot.
  3. wpctl status: there is no Built-in ... Camera, and the log shows No sensor found for /dev/media0.

Proposed fix

After the existing access wait, also wait for every camera that the devicetree places on a CCI bus (an I²C client under cci@ whose node has a port) to get its video4linux/v4l-subdev* node. It shares the same 5-second budget and keeps the existing omarchy-hw-aarch64-qualcomm gate. It doesn't list any sensor names, so it should work on any CAMSS machine.

@@ end of bin/omarchy-hw-wait-camera-access @@
+
+# The sensors bind a moment after the media device appears, and libcamera finds
+# no camera if it looks before they have. CAMSS gives every sensor its subdevice
+# node at once when the last one binds, so wait for those nodes to exist, for
+# the cameras the devicetree puts on the CCI buses, within the same budget.
+i2c_path=${OMARCHY_I2C_DEVICES_PATH:-/sys/bus/i2c/devices}
+
+sensors=()
+if omarchy-hw-aarch64-qualcomm; then
+  for client in "$i2c_path"/*-*; do
+    node=$(readlink -f "$client/of_node" 2>/dev/null) || continue
+    [[ $node == */cci@*/* && -d $node/port ]] && sensors+=("$client")
+  done
+fi
+
+for ((; try < tries; try++)); do
+  waiting=0
+  for sensor in "${sensors[@]}"; do
+    compgen -G "$sensor/video4linux/v4l-subdev*" >/dev/null || waiting=1
+  done
+  ((waiting)) || break
+  sleep 0.1
+done

Tested

  • Installed as a user override of 10-omarchy-camera-access.conf on the Surface Pro 11.
  • On a reboot where WirePlumber started before the sensor (Starting Multimedia... at 18.51 s, imx681 detected at 19.12 s), the hook held WirePlumber back. libcamera then added all three cameras at 19.59 s on its first scan, with no No sensor found and no restart.
  • With a fake sysfs tree (OMARCHY_I2C_DEVICES_PATH): a sensor that never binds stops waiting at the budget; one that binds after 0.5 s releases the wait at about 540 ms; one already bound returns in about 20 ms.
  • With the cameras already up, the hook returns in about 50 ms.

Not tested: other Snapdragon machines, or a machine where a sensor driver is missing. That machine would wait the full 5 s at every login, the same worst case the access wait already has. I haven't run ./test/all, and the change has no test in test/shell.d yet.

Drafted by Claude Opus 5.5 via Claude Code.

monkey1911 avatar Dec 02 '26 07:12 monkey1911

GPT-6.2 Sol High in Codex checked the boot trace against quattro. The WirePlumber startup hook can return as soon as /dev/media0 is accessible, while the CAMSS sensors are still binding. Opus 5.5 High and muse-wonder (high effort, via pi) reviewed the diagnosis and flagged that the fix only waits for camera clients present when its scan starts.

The linked #21271 passed the simulated late-sensor check on an x86_64 worker. The next step is to confirm that the front and rear cameras appear on the first scan after a cold boot on a Surface Pro 11 at commit c7cbf1f475b5874a2c0e508ebb489bf31f44ce1d. Hardware test instructions

omarchybot avatar Dec 02 '26 14:12 omarchybot