Merge lp:~kaihengfeng/unity-settings-daemon/lp1683445 into lp:unity-settings-daemon

Proposed by Kai-Heng Feng
Status: Merged
Merged at revision: 4182
Proposed branch: lp:~kaihengfeng/unity-settings-daemon/lp1683445
Merge into: lp:unity-settings-daemon
Diff against target: 53 lines (+35/-1)
1 file modified
plugins/power/gsd-backlight-linux.c (+35/-1)
To merge this branch: bzr merge lp:~kaihengfeng/unity-settings-daemon/lp1683445
Reviewer Review Type Date Requested Status
Robert Ancell Approve
Review via email: mp+323833@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Kai-Heng Feng (kaihengfeng) wrote :

Hi, this is still an issue for Unity users.
Can someone review this MP?

Revision history for this message
Kai-Heng Feng (kaihengfeng) wrote :

Another gentle ping...

Revision history for this message
Robert Ancell (robert-ancell) wrote :

I'm not familiar with this code but the patch makes sense to me.

review: Approve
Revision history for this message
Robert Ancell (robert-ancell) wrote :

Does this issue apply to gnome-settings-daemon i.e. for Ubuntu users in 18.04? The g-s-d code seems very different.

Revision history for this message
Kai-Heng Feng (kaihengfeng) wrote :

It's already fixed in GSD, and the fix was already back ported for 16.04.

The code should be the same as the GSD one [1].

In addition to Bionic, Xenial and Artful also need this fix.

[1] https://gitlab.gnome.org/GNOME/gnome-settings-daemon/commit/ed7c2744aca1ad0bdd5adb62a8f2b5bdc1eb94b4

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/power/gsd-backlight-linux.c'
2--- plugins/power/gsd-backlight-linux.c 2015-11-16 04:51:45 +0000
3+++ plugins/power/gsd-backlight-linux.c 2017-05-10 08:46:43 +0000
4@@ -41,6 +41,40 @@
5 }
6 return NULL;
7 }
8+
9+/*
10+ * Search for a raw backlight interface, raw backlight interfaces registered
11+ * by the drm driver will have the drm-connector as their parent, check the
12+ * drm-connector's enabled sysfs attribute so that we pick the right LCD-panel
13+ * connector on laptops with hybrid-gfx. Fall back to just picking the first
14+ * raw backlight interface if no enabled interface is found.
15+ */
16+static gchar *
17+gsd_backlight_helper_get_raw (GList *devices)
18+{
19+ GUdevDevice *parent;
20+ const gchar *attr;
21+ GList *d;
22+
23+ for (d = devices; d != NULL; d = d->next) {
24+ attr = g_udev_device_get_sysfs_attr (d->data, "type");
25+ if (g_strcmp0 (attr, "raw") != 0)
26+ continue;
27+
28+ parent = g_udev_device_get_parent (d->data);
29+ if (!parent)
30+ continue;
31+
32+ attr = g_udev_device_get_sysfs_attr (parent, "enabled");
33+ if (!attr || g_strcmp0 (attr, "enabled") != 0)
34+ continue;
35+
36+ return g_strdup (g_udev_device_get_sysfs_path (d->data));
37+ }
38+
39+ return gsd_backlight_helper_get_type (devices, "raw");
40+}
41+
42 #endif /* HAVE_GUDEV */
43
44 char *
45@@ -70,7 +104,7 @@
46 *type = GSD_BACKLIGHT_TYPE_PLATFORM;
47 goto out;
48 }
49- path = gsd_backlight_helper_get_type (devices, "raw");
50+ path = gsd_backlight_helper_get_raw (devices);
51 if (path != NULL) {
52 if (type)
53 *type = GSD_BACKLIGHT_TYPE_RAW;

Subscribers

People subscribed via source and target branches