Fix intel ipu7 camera package for sleep/wake
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
# Maintainer: Omarchy <packages@omarchy.org>
|
||||
|
||||
pkgname=intel-ipu7-camera
|
||||
pkgver=1.0.0
|
||||
pkgver=1.0.1
|
||||
pkgrel=1
|
||||
pkgdesc="Intel IPU7 MIPI camera stack for Hurrican/Performance (OV08X40 + hardware ISP)"
|
||||
arch=('x86_64')
|
||||
@@ -57,12 +57,13 @@ source=(
|
||||
"90-ipu7-psys.rules"
|
||||
"camera-tmpfiles.conf"
|
||||
"ov08x40.yaml"
|
||||
"camera-sleep-hook"
|
||||
)
|
||||
sha256sums=(
|
||||
'SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP'
|
||||
'SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP'
|
||||
'SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP'
|
||||
'SKIP'
|
||||
'SKIP' 'SKIP'
|
||||
)
|
||||
|
||||
prepare() {
|
||||
@@ -217,4 +218,8 @@ package() {
|
||||
"${pkgdir}/usr/lib/tmpfiles.d/camera.conf"
|
||||
install -Dm644 "${srcdir}/ov08x40.yaml" \
|
||||
"${pkgdir}/usr/share/libcamera/ipa/simple/ov08x40.yaml"
|
||||
|
||||
# Sleep hook to re-probe camera after suspend/hibernate
|
||||
install -Dm755 "${srcdir}/camera-sleep-hook" \
|
||||
"${pkgdir}/usr/lib/systemd/system-sleep/camera-sleep-hook"
|
||||
}
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Re-probe the IPU7 camera sensor after suspend/hibernate resume.
|
||||
#
|
||||
# The OV08X40 sensor connects through a USB-to-I2C bridge (usbio-bridge).
|
||||
# After resume the ipu_bridge software fwnode graph is gone, leaving the
|
||||
# sensor driver unable to bind. Removing and rescanning the IPU PCI device
|
||||
# triggers a fresh probe that recreates the fwnode graph.
|
||||
|
||||
IPU_PCI="0000:00:05.0"
|
||||
|
||||
case "$1" in
|
||||
post)
|
||||
(
|
||||
# Wait for the USB-I2C bridge to re-enumerate
|
||||
for i in $(seq 1 15); do
|
||||
if grep -q "OVTI08F4" /sys/bus/i2c/devices/*/name 2>/dev/null; then
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
sleep 1
|
||||
|
||||
# Unload sensor so the IPU device can be cleanly removed
|
||||
modprobe -r ov08x40 2>/dev/null || true
|
||||
|
||||
# Remove and rescan the IPU PCI device to trigger fresh ipu_bridge_init
|
||||
echo 1 > "/sys/bus/pci/devices/$IPU_PCI/remove" 2>/dev/null || true
|
||||
sleep 1
|
||||
echo 1 > /sys/bus/pci/rescan 2>/dev/null || true
|
||||
sleep 3
|
||||
|
||||
# Reload sensor driver
|
||||
modprobe intel_cvs 2>/dev/null || true
|
||||
sleep 2
|
||||
modprobe ov08x40 2>/dev/null || true
|
||||
|
||||
# Restart the camera feed service
|
||||
for uid_dir in /run/user/*; do
|
||||
uid=$(basename "$uid_dir")
|
||||
if [[ -S $uid_dir/bus ]]; then
|
||||
sudo -u "#$uid" env \
|
||||
XDG_RUNTIME_DIR="$uid_dir" \
|
||||
DBUS_SESSION_BUS_ADDRESS="unix:path=$uid_dir/bus" \
|
||||
systemctl --user restart camera-feed-watch.service 2>/dev/null || true
|
||||
fi
|
||||
done
|
||||
) &
|
||||
disown
|
||||
;;
|
||||
esac
|
||||
exit 0
|
||||
Reference in New Issue
Block a user