Displaylink: Difference between revisions

add details for KDE and Gnome
Tags: Mobile edit Mobile web edit Visual edit
Sandro (talk | contribs)
 
(3 intermediate revisions by 2 users not shown)
Line 10: Line 10:
  displaylink
  displaylink
];
];
</syntaxhighlight>Then add the videoDrivers:<syntaxhighlight lang="nixos">services.xserver.videoDrivers = [ "displaylink" "modesetting" ];</syntaxhighlight>The module <code>nixos/modules/hardware/video/displaylink.nix</code> should also work for wlroots compositors.
</syntaxhighlight>Then add the videoDrivers:<syntaxhighlight lang="nix">services.xserver.videoDrivers = [ "displaylink" "modesetting" ];</syntaxhighlight>The module <code>nixos/modules/hardware/video/displaylink.nix</code> should also work for wlroots compositors.


====<big>Xserver</big>====
====<big>Xserver</big>====
Line 29: Line 29:


You probably will need the `evdi` module
You probably will need the `evdi` module
{{bc|<nowiki>
<syntaxhighlight lang="nix">
boot = {
boot = {
   extraModulePackages = [ config.boot.kernelPackages.evdi ];
   extraModulePackages = [ config.boot.kernelPackages.evdi ];
Line 39: Line 39:
   };
   };
};
};
</nowiki>}}
</syntaxhighlight>


====='''Gnome Wayland'''=====
====='''Gnome Wayland'''=====
Line 45: Line 45:
Install displayLink package
Install displayLink package


{{bc|<nowiki>
<syntaxhighlight lang="nix">
environment.systemPackages = with pkgs; [
environment.systemPackages = with pkgs; [
   displaylink
   displaylink
];
];
</nowiki>}}
</syntaxhighlight>


Define videoDrivers
Define videoDrivers
Line 57: Line 57:


Add dlm service
Add dlm service
{{bc|<nowiki>
<syntaxhighlight lang="nix">
systemd.services.dlm.wantedBy = [ "multi-user.target" ];
systemd.services.dlm.wantedBy = [ "multi-user.target" ];
</nowiki>}}
</syntaxhighlight>
====='''KDE Plasma'''=====
====='''KDE Plasma'''=====


Line 66: Line 66:
Esnure you properly enabled wayland session  
Esnure you properly enabled wayland session  


{{bc|<nowiki>
<syntaxhighlight lang="nix">
environment.variables = {
environment.variables = {
   KWIN_DRM_PREFER_COLOR_DEPTH = "24";
   KWIN_DRM_PREFER_COLOR_DEPTH = "24";
Line 84: Line 84:


};
};
</nowiki>}}
</syntaxhighlight>


Install displayLink package
Install displayLink package


{{bc|<nowiki>
<syntaxhighlight lang="nix">
environment.systemPackages = with pkgs; [
environment.systemPackages = with pkgs; [
   displaylink
   displaylink
];
];
</nowiki>}}
</syntaxhighlight>


Instead of dlm setup display-link server as follows:
Instead of dlm setup display-link server as follows:


{{bc|<nowiki>
<syntaxhighlight lang="nix">
# --- THIS IS THE CRUCIAL PART FOR ENABLING THE SERVICE ---
systemd.services.displaylink-server = {
systemd.services.displaylink-server = {
   enable = true;
   enable = true;
  # Ensure it starts after udev has done its work
   requires = [ "systemd-udevd.service" ];
   requires = [ "systemd-udevd.service" ];
   after = [ "systemd-udevd.service" ];
   after = [ "systemd-udevd.service" ];
   wantedBy = [ "multi-user.target" ]; # Start at boot
   wantedBy = [ "multi-user.target" ];
  # *** THIS IS THE CRITICAL 'serviceConfig' BLOCK ***
   serviceConfig = {
   serviceConfig = {
     Type = "simple"; # Or "forking" if it forks (simple is common for daemons)
     Type = "simple";
    # The ExecStart path points to the DisplayLinkManager binary provided by the package
     ExecStart = "${pkgs.displaylink}/bin/DisplayLinkManager";
     ExecStart = "${pkgs.displaylink}/bin/DisplayLinkManager";
    # User and Group to run the service as (root is common for this type of daemon)
     User = "root";
     User = "root";
     Group = "root";
     Group = "root";
    # Environment variables that the service itself might need
    # Environment = [ "DISPLAY=:0" ]; # Might be needed in some cases, but generally not for this
     Restart = "on-failure";
     Restart = "on-failure";
     RestartSec = 5; # Wait 5 seconds before restarting
     RestartSec = 5; # Wait 5 seconds before restarting
   };
   };
};
};
</nowiki>}}
</syntaxhighlight>
 


==Sway==
==Sway==
Line 155: Line 147:


[https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/1823#note_2146862 Source]
[https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/1823#note_2146862 Source]
== Troubleshooting ==
=== Suspend blocked by <code>pre-sleep.service</code> ===
As of NixOS 25.05, installing <code>pkgs.displaylink</code> inserts some directives into the script referenced by <code>pre-sleep.service</code>. If suspending does not work and causes the reboot and poweroff buttons to stop working, it may be a symptom of [[Power Management#Suspend blocked by pre-sleep.service|suspend being blocked by pre-sleep.service]].
The script in question:<syntaxhighlight lang="bash" line="1">
#!/nix/store/cfqbabpc7xwg8akbcchqbq3cai6qq2vs-bash-5.2p37/bin/bash
set -e
#flush any bytes in pipe
while read -n 1 -t 1 SUSPEND_RESULT < /tmp/PmMessagesPort_out; do : ; done;
#suspend DisplayLinkManager
echo "S" > /tmp/PmMessagesPort_in
#wait until suspend of DisplayLinkManager finish
if [ -f /tmp/PmMessagesPort_out ]; then
  #wait until suspend of DisplayLinkManager finish
  read -n 1 -t 10 SUSPEND_RESULT < /tmp/PmMessagesPort_out
fi
</syntaxhighlight>Because of a stray <code>/tmp/PmMessagesPort_out</code> caused by an unclean shutdown, the suspend action was blocked by this script trying to flush the port. A myriad of solutions can be used to unblock the script and restore suspend:
* Start <code>dlm.service</code> so that DisplayLinkManager can clear the ports and unblock the script
* Use <code>sudo DisplayLinkManager</code> to clear the ports and unblock the script
Untested solutions:
* Removing the file
* Killing the script


[[Category:Video]]
[[Category:Video]]