## Description: fix the false positive in detection of dock state ## Origin/Author: Alexei Colin, BDenis (LP ID: borenko) ## Bug: https://bugs.launchpad.net/ubuntu/+source/upower/+bug/854404 ## Bug: https://bugs.freedesktop.org/show_bug.cgi?id=36818 === modified file '/src/linux/up-dock.c' Index: upower-0.9.13/src/linux/up-dock.c =================================================================== --- upower-0.9.13.orig/src/linux/up-dock.c 2012-01-08 15:00:05.000000000 -0500 +++ upower-0.9.13/src/linux/up-dock.c 2012-01-08 15:06:18.000000000 -0500 @@ -48,6 +48,7 @@ up_dock_device_check (GUdevDevice *d) { const gchar *status; + const gchar *dpms; gboolean ret = FALSE; /* Get the boolean state from the kernel -- note that ideally @@ -56,11 +57,19 @@ status = g_udev_device_get_sysfs_attr (d, "status"); if (status == NULL) goto out; - ret = (g_strcmp0 (status, "connected") == 0); + if (g_strcmp0 (status, "connected") == 0) + { + ret = TRUE; + dpms = g_udev_device_get_sysfs_attr (d, "dpms"); + if (dpms == NULL) + goto out; + if (g_strcmp0 (dpms, "Off") == 0) + ret = FALSE; + } +out: g_debug ("graphics device %s is %s", g_udev_device_get_sysfs_path (d), ret ? "on" : "off"); -out: return ret; }