From 235b37909b62f90b93c433338df6ab50ee65c886 Mon Sep 17 00:00:00 2001 From: aszlig Date: Wed, 10 Aug 2016 00:27:02 +0200 Subject: 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 --- modules/hardware/t100ha/default.nix | 15 ++++++++++++--- 1 file 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 + + int main(void) { + char cmd = 14; + ioctl(0, TIOCLINUX, &cmd); + cmd = 4; + ioctl(0, TIOCLINUX, &cmd); + } + ''}" ''; }; } -- cgit 1.4.1