Ignore this. Use my patch instead idovitz/amdisp4#3
Last active
February 24, 2026 01:57
-
-
Save kinncj/c255ee6224d26c6a7758c92fc379f9a8 to your computer and use it in GitHub Desktop.
ARCH AMD ISP4 HOOK
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # /etc/modprobe.d/blacklist-amd-capture.conf | |
| # Prevent autoloading by udev/kernel (critical for resume stability) | |
| blacklist amd_capture | |
| # Prevent manual modprobe without --ignore-install | |
| install amd_capture /bin/false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| #/usr/local/bin/cam-off | |
| set -euo pipefail | |
| MODULE="${MODULE:-amd_capture}" | |
| # If any /dev/video* nodes are in use, show holders and refuse to unload | |
| if ls /dev/video* >/dev/null 2>&1; then | |
| if sudo fuser -v /dev/video* 2>/dev/null; then | |
| echo "Camera appears in use. Close the app(s) above and retry." >&2 | |
| exit 1 | |
| fi | |
| fi | |
| # Unload the module (and anything that depends on it if possible) | |
| sudo modprobe -r "$MODULE" || { | |
| echo "Failed to unload $MODULE (it may still be in use, or have dependents)." >&2 | |
| exit 1 | |
| } | |
| echo "Unloaded: $MODULE" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| #/usr/local/bin/cam-on | |
| set -euo pipefail | |
| MODULE="${MODULE:-amd_capture}" | |
| # --ignore-install bypasses "install amd_capture /bin/false" in modprobe.d | |
| sudo modprobe --ignore-install "$MODULE" | |
| echo "Loaded: $MODULE" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| #/usr/local/bin/cam-suspend-guard | |
| set -euo pipefail | |
| MODULE="${MODULE:-amd_capture}" | |
| HOOK_PATH="/usr/lib/systemd/system-sleep/amd-camera" | |
| usage() { | |
| cat <<USAGE | |
| Usage: | |
| sudo cam-suspend-guard install | |
| sudo cam-suspend-guard remove | |
| sudo cam-suspend-guard status | |
| Optional: | |
| MODULE=<name> sudo cam-suspend-guard install | |
| Notes: | |
| - "install" creates a system-sleep hook that unloads MODULE before suspend. | |
| - After resume the module stays unloaded (use cam-on to reload). | |
| USAGE | |
| } | |
| cmd="${1:-}" | |
| case "$cmd" in | |
| install) | |
| sudo tee "$HOOK_PATH" >/dev/null <<HOOK | |
| #!/usr/bin/env bash | |
| set -euo pipefail | |
| MODULE="${MODULE}" | |
| case "\$1/\$2" in | |
| pre/*) | |
| /usr/bin/logger -t amd-camera "hook \$1/\$2: unloading \$MODULE" | |
| /usr/bin/modprobe -r "\$MODULE" 2>/dev/null || true | |
| ;; | |
| post/*) | |
| /usr/bin/logger -t amd-camera "hook \$1/\$2: \$MODULE left unloaded (use cam-on to reload)" | |
| ;; | |
| esac | |
| HOOK | |
| sudo chmod +x "$HOOK_PATH" | |
| echo "Installed suspend guard: $HOOK_PATH (MODULE=$MODULE)" | |
| ;; | |
| remove) | |
| if [[ -f "$HOOK_PATH" ]]; then | |
| sudo rm -f "$HOOK_PATH" | |
| echo "Removed suspend guard: $HOOK_PATH" | |
| else | |
| echo "Suspend guard not present: $HOOK_PATH" | |
| fi | |
| ;; | |
| status) | |
| if [[ -f "$HOOK_PATH" ]]; then | |
| echo "Suspend guard present: $HOOK_PATH" | |
| echo "----" | |
| cat "$HOOK_PATH" | |
| else | |
| echo "Suspend guard not present: $HOOK_PATH" | |
| fi | |
| ;; | |
| *) | |
| usage | |
| exit 1 | |
| ;; | |
| esac |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Module: https://aur.archlinux.org/packages/amdisp4-dkms | |
| sudo chmod +x /usr/local/bin/cam-suspend-guard | |
| sudo chmod +x /usr/local/bin/cam-on | |
| sudo chmod +x /usr/local/bin/cam-off | |
| sudo cam-suspend-guard install | |
| sudo cam-suspend-guard status | |
| sudo cam-suspend-guard remove |
Comments are disabled for this gist.