summaryrefslogtreecommitdiff
path: root/pm/sleep.d/98smart-kernel-video
diff options
context:
space:
mode:
authorVictor Lowther <victor.lowther@gmail.com>2008-05-16 21:12:47 -0500
committerVictor Lowther <victor.lowther@gmail.com>2008-05-16 21:12:47 -0500
commit8c366f223d8db7143ef7c458f0503655af5716b6 (patch)
treec39c20219628e80e35497c9c32bf8bf1f0ec12bb /pm/sleep.d/98smart-kernel-video
parent57d53b3bcb4aa218a63b48d14dc5ca0a1caad99a (diff)
Split smart kernel video driver handling to a different hook.
The new 98-smart-kernel-video hook just disables 99video outright if we are running a video driver that is spart enough to handle its own quirks.
Diffstat (limited to 'pm/sleep.d/98smart-kernel-video')
-rwxr-xr-xpm/sleep.d/98smart-kernel-video36
1 files changed, 36 insertions, 0 deletions
diff --git a/pm/sleep.d/98smart-kernel-video b/pm/sleep.d/98smart-kernel-video
new file mode 100755
index 0000000..d638bc4
--- /dev/null
+++ b/pm/sleep.d/98smart-kernel-video
@@ -0,0 +1,36 @@
+#!/bin/sh
+#
+# Copyright 2006-2007 Richard Hughes <richard@hughsie.com>
+# Copyright 2007 Peter Jones <pjones@redhat.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of version 2 of the GNU General Public License as
+# published by the Free Software Foundation.
+
+# Handle video quirks. If you are having suspend/resume issues,
+# troubleshooting using this hook is probably the best place to start.
+# If it weren't for video card quirks, suspend/resume on Linux would be
+# a whole lot more stable.
+
+. "${PM_FUNCTIONS}"
+
+
+# Test to see if the kernel has a video driver that is smart enough
+# to handle quirks without external assistance.
+smart_kernel_video()
+{
+ # If we are using an ATI or nVidia binary driver, do nothing.
+ [ -d /sys/module/nvidia -o -d /sys/module/fglrx ] && return 0;
+
+ local kernel_rev="$(uname -r |awk -F '[_-]' '{print $1}')"
+ # Intel can to the same thing, but only at or after kernel 2.6.26.
+ # FIXME: a more accurate way of testing this?
+ [ -d /sys/module/i915 ] && \
+ [ "$kernel_rev" >= "2.6.26" ] && return 0;
+ return 1
+}
+
+case $1 in
+ suspend|hibernate) smart_kernel_video && disablehook 99video ;;
+ *) exit 0 ;;
+esac \ No newline at end of file