NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.86k stars 13.93k forks source link

kodi blanks display after a few minutes idle #61719

Open spiderbit opened 5 years ago

spiderbit commented 5 years ago

Issue description

Just updated from 17.09 to 19.03 and now after no action for a while the screen goes dark, as a side issue I can't "wake it up" with my xbox controller, but with a keyboard I can.

But the real question is why does it fall asleep at all. I find nothing in kodi settings and I even added logind ignore behaviour:

services.logind.extraConfig = "IdleAction=ignore";

logind.conf

[Login]
KillUserProcesses=no
HandleLidSwitch=suspend
HandleLidSwitchDocked=ignore
HandleLidSwitchExternalPower=suspend
IdleAction=ignore

ok just tested it without my ".kodi" directory and the same result, so it must be something nixos / xorg related, after 10 minutes the screen goes blank.

Technical details

aanderse commented 5 years ago

Does your xbox controller work with kodi at all? Which desktop environment are you running? We might need your configuration.nix to better troubleshoot.

spiderbit commented 5 years ago

Funny enough it does not only work (controller) but I could even kick out all xboxdrv code, which I tested after I wrote this bug report so the removal did not cause that problem just to be clear.

The desktop environment is xserver or do you mean the desktop manager? that would be kodi that should be the relevant parts of the config:

  environment.systemPackages = with pkgs; [
      nmap python3 youtube-dl libvdpau-va-gl vaapiVdpau glxinfo
      vdpauinfo certbot openssl retroarch kodiPlugins.advanced-launcher
      kodiPlugins.pdfreader zsnes dmidecode nixops
  ];

  # Enable the X11 windowing system.
  services.xserver = {
    enable = true;
    layout = "dvorak";
    xkbOptions = "eurosign:e";
    displayManager.lightdm.autoLogin = {
      user = "my-user";
      enable = true;
    };
    desktopManager.default = "kodi";
    desktopManager.kodi.enable = true;
  };  

  services.logind.extraConfig = "IdleAction=ignore";
  nixpkgs.config.KodiPlugin = {
    advanced-launcher = true;
    enablePeripheralJoystick = true;
    # enableControllers = true; # might not be needed  
  };

  nixpkgs.config = {
    kodi = {
      enableJoystick = true;
    };
  };

  hardware.opengl.enable = true;
  hardware.opengl.extraPackages = [ pkgs.libvdpau-va-gl pkgs.vaapiVdpau pkgs.vaapiIntel];
spiderbit commented 5 years ago

I just switched to xfce and it also goes to sleep after 10 mins or so. os it's not a kodi problem, except that the controller don't wakes the display, but that it blanks the screen is the major problem.

Btw I see a cursor (a x) at the end of a video, when I don't use a mouse which also makes not much sense.

aanderse commented 5 years ago

With regards to your cursor issue I have added the unclutter-xfixes package to my dedicated htpc setups and then execute it on login. This hides the cursor when the mouse isn't being moved.

As far as blank display you might consider trying something like this.

spiderbit commented 5 years ago

That works as workaround:

    services.xserver.displayManager.setupCommands = ''
      /run/current-system/sw/bin/xset -dpms
      /run/current-system/sw/bin/xset s off
    '';

But I don't see that as a fix, while I could see a 10 min blank as a default that some people want, that the controller can't wake up the blankscreen is surely not a good default.

But I even wonder if that is a good default for kodi, it might make sense for xfce and gnome but for kodi?

aanderse commented 5 years ago

@spiderbit I definitely agree if the controller can't wake up the screen that is a problem. The controller works with kodi when the screen is on, right?

spiderbit commented 5 years ago

Yes

aanderse commented 5 years ago

@spiderbit If you find value in the above behaviour you could create a PR modifying https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/services/x11/desktop-managers/kodi.nix to add your snippet above.

As far as the controller goes... I assume you don't know if this was an issue with 17.09 because you didn't have the screen off issue?

Might we consider this issue resolved?

spiderbit commented 5 years ago

Well technically we could close this bug I guess but wouldn't you keep it open till such a PR was accepted?

But then we need a new bug for the not registered (to wake up) controller behavior, right?

How would you do include that code? disable power management completely in kodi generally? or give a boolean toggle for it? If you disable it hard coded then I guess this bug could be closed. I just wonder if some people could prefer the current behavior with the blanking?

Well I don't need it and till somebody finds a fix for the controller thing and wants that behavior it's probably better to deactivate the blanking (at least as default)

aanderse commented 5 years ago

Since you don't know if the controller would wake-up your screen in 17.09 I'm not entirely sure if this is a bug or just the way xboxdrv operates. I guess we should determine that first. Good point.

spiderbit commented 5 years ago

No, I don't use xboxdrv anymore at this moment, because apparently the normal evdev bits are enough to recognize my controller.

But the sleep bug was there before I changed that.

cpages commented 4 years ago

So I had the same issue using kore (the remote android app), and I could have sworn waking the screen worked in the past, but then I saw this post: https://forum.kodi.tv/showthread.php?tid=342934.

Long story short, I set xfce to never blank/shut the screen in the power saving options, and enabled it in kore (in power saving options as well), and now I can wake the screen.

I tested it also with my xbox controller, to ensure it was the same issue. Funny thing is moving up/down does not unlock the screen, but pressing a button does, so I hope this does the trick for you.

stale[bot] commented 4 years ago

Hello, I'm a bot and I thank you in the name of the community for opening this issue.

To help our human contributors focus on the most-relevant reports, I check up on old issues to see if they're still relevant. This issue has had no activity for 180 days, and so I marked it as stale, but you can rest assured it will never be closed by a non-human.

The community would appreciate your effort in checking if the issue is still valid. If it isn't, please close it.

If the issue persists, and you'd like to remove the stale label, you simply need to leave a comment. Your comment can be as simple as "still important to me". If you'd like it to get more attention, you can ask for help by searching for maintainers and people that previously touched related code and @ mention them in a comment. You can use Git blame or GitHub's web interface on the relevant files to find them.

Lastly, you can always ask for help at our Discourse Forum or at #nixos' IRC channel.