about summary refs log tree commit diff
path: root/modules
diff options
context:
space:
mode:
authoraszlig <aszlig@redmoonstudios.org>2016-08-10 00:27:02 +0200
committeraszlig <aszlig@redmoonstudios.org>2016-08-10 00:27:02 +0200
commit235b37909b62f90b93c433338df6ab50ee65c886 (patch)
tree50ed272d26a12b7d7d665ef2e658af9ba912f0f1 /modules
parent979d733c078366919141204fb768c339ef8f3bd6 (diff)
hardware/t100ha: Fix vblank issue early at initrd
Using xset for DPMS control only works as soon as we have an X session,
but we want to work around the issue as early as possible so let's set
it in preDeviceCommands.

The program here directly uses the ioctls to blank/unblank the current
console without enums/constants (14 is blank and 4 is unblank) because
it's just a workaround and supposed to go away in the near future.

If we'd wanted to use the constants from tiocl.h, we'd have to add
dependencies on Linux headers, but I'm lazy right now ;-)

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Diffstat (limited to 'modules')
-rw-r--r--modules/hardware/t100ha/default.nix15
1 files changed, 12 insertions, 3 deletions
diff --git a/modules/hardware/t100ha/default.nix b/modules/hardware/t100ha/default.nix
index 303c56ab..87f5011d 100644
--- a/modules/hardware/t100ha/default.nix
+++ b/modules/hardware/t100ha/default.nix
@@ -114,9 +114,18 @@ in {
     #
     # I know this is very ugly, but another mitigation would be to disable power
     # management entirely, which I think is even uglier.
-    services.xserver.displayManager.sessionCommands = ''
-      ${pkgs.xorg.xset}/bin/xset dpms force standby
-      ${pkgs.xorg.xset}/bin/xset dpms force on
+    boot.initrd.preDeviceCommands = "fix-vblank";
+    boot.initrd.extraUtilsCommands = ''
+      cc -Wall -o "$out/bin/fix-vblank" "${pkgs.writeText "fix-vblank.c" ''
+        #include <sys/ioctl.h>
+
+        int main(void) {
+          char cmd = 14;
+          ioctl(0, TIOCLINUX, &cmd);
+          cmd = 4;
+          ioctl(0, TIOCLINUX, &cmd);
+        }
+      ''}"
     '';
   };
 }