summaryrefslogtreecommitdiff
path: root/lib/igt_sysfs.c
diff options
context:
space:
mode:
authorVille Syrjälä <ville.syrjala@linux.intel.com>2018-03-04 04:17:54 +0200
committerVille Syrjälä <ville.syrjala@linux.intel.com>2018-03-05 21:02:56 +0200
commit987f58240c7841abc090a84ce8fa7ebfe8fd4985 (patch)
tree0b2f72ec53be4a9f2e4c60e28498d4b845cfc91b /lib/igt_sysfs.c
parent23f7da18a92059610792299cfdb03d2c922a9948 (diff)
lib/sysfs: Fix fbcon unbind, again
Looks like unbinding the dummy con doesn't work on all machines. Instead we have to bind fbcon (which is what we used to do before commit d18fca7f6cf3 ("lib/sysfs: Fix fbcon rebind")). Since some machines need the bind and others need the unbind let's do both. The most obvious difference I observed between two machines that behave differently was the order in which the console drivers were listed in sysfs. Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'lib/igt_sysfs.c')
-rw-r--r--lib/igt_sysfs.c34
1 files changed, 23 insertions, 11 deletions
diff --git a/lib/igt_sysfs.c b/lib/igt_sysfs.c
index f8aae9d5..3b830811 100644
--- a/lib/igt_sysfs.c
+++ b/lib/igt_sysfs.c
@@ -503,14 +503,7 @@ bool igt_sysfs_set_boolean(int dir, const char *attr, bool value)
return igt_sysfs_printf(dir, attr, "%d", value) == 1;
}
-/**
- * kick_fbcon:
- * @enable: boolean value
- *
- * This functions enables/disables the text console running on top of the
- * framebuffer device.
- */
-void kick_fbcon(bool enable)
+static void bind_con(const char *name, bool enable)
{
const char *path = "/sys/class/vtconsole";
DIR *dir;
@@ -538,21 +531,40 @@ void kick_fbcon(bool enable)
if (len >= 0)
buf[len] = '\0';
- if (!strstr(buf, enable ? "dummy device" :
- "frame buffer device"))
+ if (!strstr(buf, name))
continue;
sprintf(buf, "%s/%s/bind", path, de->d_name);
fd = open(buf, O_WRONLY);
if (fd != -1) {
- igt_ignore_warn(write(fd, "0\n", 2));
+ igt_ignore_warn(write(fd, enable ? "1\n" : "0\n", 2));
close(fd);
}
+ break;
}
closedir(dir);
}
/**
+ * kick_fbcon:
+ * @enable: boolean value
+ *
+ * This functions enables/disables the text console running on top of the
+ * framebuffer device.
+ */
+void kick_fbcon(bool enable)
+{
+ /*
+ * The vtcon bind interface seems somewhat broken. Possibly
+ * depending on the order the console drivers have been
+ * registered you either have to unbind the old driver,
+ * or bind the new driver. Let's do both.
+ */
+ bind_con("dummy device", !enable);
+ bind_con("frame buffer device", enable);
+}
+
+/**
* kick_snd_hda_intel:
*
* This functions unbinds the snd_hda_intel driver so the module cand be