This repository has been archived on 2026-10-07. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
omarchy-pkgs/pkgbuilds/intel-ipu7-camera/camera-sleep-hook
T
2026-05-12 16:59:50 +02:00

39 lines
1.3 KiB
Bash

#!/bin/bash
# Handle camera service around suspend/resume.
#
# On resume the IPU7 firmware re-authenticates (CSE authenticate_run),
# but the ov08x40 sensor is not re-bound to the media-controller graph.
# libcamhal then reports "No sensors available", icamerasrc fails to
# register properties, and /dev/video50 stays empty — the camera looks
# dead to every app until reboot.
#
# Workaround: after resume, unload + reload ov08x40 and intel_ipu7_isys
# so isys re-probes the sensor via ipu_bridge.
#
# DO NOT unload intel_ipu7_isys pre-suspend: s2idle wake requires the
# IPU7 driver to be attached, and unloading it before suspend hangs the
# machine on wake.
#
# The post-resume work runs via systemd-run so it doesn't block the
# lock-screen password prompt while modules settle.
case "$1" in
pre)
systemctl stop v4l2-relayd@ipu7.service 2>/dev/null || true
;;
post)
systemd-run --no-block --unit=camera-resume bash -c '
rmmod ov08x40 2>/dev/null || true
rmmod intel_ipu7_isys 2>/dev/null || true
sleep 1
modprobe intel_ipu7_isys 2>/dev/null
sleep 1
modprobe ov08x40 2>/dev/null
systemctl reset-failed v4l2-relayd@ipu7.service 2>/dev/null || true
systemctl start v4l2-relayd@ipu7.service 2>/dev/null || true
'
;;
esac
exit 0