displaylink: 1.1.62 -> 1.3.52

This commit is contained in:
Nikolay Amiantov 2017-05-01 15:23:41 +03:00
parent 8e7c7af3b8
commit e17744067a
3 changed files with 42 additions and 52 deletions

View File

@ -1,4 +1,4 @@
{ config, lib, ... }:
{ config, lib, pkgs, ... }:
with lib;
@ -6,7 +6,11 @@ let
enabled = elem "displaylink" config.services.xserver.videoDrivers;
displaylink = config.boot.kernelPackages.displaylink;
evdi = config.boot.kernelPackages.evdi;
displaylink = pkgs.displaylink.override {
inherit evdi;
};
in
@ -14,15 +18,11 @@ in
config = mkIf enabled {
boot.extraModulePackages = [ displaylink ];
boot.kernelModules = [ "evdi" ];
boot.extraModulePackages = [ evdi ];
# Those are taken from displaylink-installer.sh and from Arch Linux AUR package.
services.udev.extraRules = ''
ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="17e9", ATTR{bNumInterfaces}=="*5", TAG+="uaccess"
'';
services.udev.packages = [ displaylink ];
powerManagement.powerDownCommands = ''
#flush any bytes in pipe
@ -32,7 +32,10 @@ in
echo "S" > /tmp/PmMessagesPort_in
#wait until suspend of DisplayLinkManager finish
read -n 1 -t 10 SUSPEND_RESULT < /tmp/PmMessagesPort_out
if [ -f /tmp/PmMessagesPort_out ]; then
#wait until suspend of DisplayLinkManager finish
read -n 1 -t 10 SUSPEND_RESULT < /tmp/PmMessagesPort_out
fi
'';
powerManagement.resumeCommands = ''
@ -40,10 +43,11 @@ in
echo "R" > /tmp/PmMessagesPort_in
'';
systemd.services.displaylink = {
systemd.services.dlm = {
description = "DisplayLink Manager Service";
after = [ "display-manager.service" ];
wantedBy = [ "graphical.target" ];
conflicts = [ "getty@tty7.service" ];
path = [ pkgs.kmod ];
serviceConfig = {
ExecStart = "${displaylink}/bin/DisplayLinkManager";
@ -53,6 +57,7 @@ in
preStart = ''
mkdir -p /var/log/displaylink
modprobe evdi
'';
};

View File

@ -1,64 +1,47 @@
{ stdenv, lib, fetchurl, fetchFromGitHub, unzip, kernel, utillinux, libdrm, libusb1, makeWrapper }:
{ stdenv, lib, fetchurl, unzip, utillinux, libusb1, evdi, systemd, makeWrapper }:
let
arch =
if stdenv.system == "x86_64-linux" then "x64"
else if stdenv.system == "i686-linux" then "x86"
else throw "Unsupported architecture";
libPath = lib.makeLibraryPath [ stdenv.cc.cc utillinux libusb1 ];
bins = "${arch}-ubuntu-1604";
libPath = lib.makeLibraryPath [ stdenv.cc.cc utillinux libusb1 evdi ];
in stdenv.mkDerivation rec {
name = "displaylink-${version}";
version = "1.1.62";
version = "1.3.52";
src = fetchFromGitHub {
owner = "DisplayLink";
repo = "evdi";
rev = "fe779940ff9fc7b512019619e24a5b22e4070f6a";
sha256 = "02hw83f6lscms8hssjzf30hl9zly3b28qcxwmxvnqwfhx1q491z9";
};
daemon = fetchurl {
src = fetchurl {
name = "displaylink.zip";
url = "http://www.displaylink.com/downloads/file?id=607";
sha256 = "0jky3xk4dfzbzg386qya9l9952i4m8zhf55fdl06pi9r82k2iijx";
url = "http://www.displaylink.com/downloads/file?id=744";
sha256 = "0ridpsxcf761vym0nlpq702qa46ynddzci17bjmyax2pph7khr0k";
};
nativeBuildInputs = [ unzip makeWrapper ];
buildInputs = [ kernel libdrm ];
buildCommand = ''
unpackPhase
cd $sourceRoot
unzip $daemon
unzip $src
chmod +x displaylink-driver-${version}.run
./displaylink-driver-${version}.run --target daemon --noexec
./displaylink-driver-${version}.run --target . --noexec
( cd module
export makeFlags="$makeFlags KVER=${kernel.modDirVersion} KDIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
export hardeningDisable="pic format"
buildPhase
install -Dm755 evdi.ko $out/lib/modules/${kernel.modDirVersion}/kernel/drivers/gpu/drm/evdi/evdi.ko
sed -i "s,/opt/displaylink/udev.sh,$out/lib/udev/displaylink.sh,g" udev-installer.sh
( source udev-installer.sh
mkdir -p $out/lib/udev/rules.d
main systemd "$out/lib/udev/rules.d/99-displaylink.rules" "$out/lib/udev/displaylink.sh"
)
sed -i '2iPATH=${systemd}/bin:$PATH' $out/lib/udev/displaylink.sh
( cd library
buildPhase
install -Dm755 libevdi.so $out/lib/libevdi.so
)
install -Dt $out/lib/displaylink *.spkg
install -Dm755 ${bins}/DisplayLinkManager $out/bin/DisplayLinkManager
patchelf \
--set-interpreter $(cat ${stdenv.cc}/nix-support/dynamic-linker) \
--set-rpath ${libPath} \
$out/bin/DisplayLinkManager
wrapProgram $out/bin/DisplayLinkManager \
--run "cd $out/lib/displaylink"
fixupPhase
( cd daemon
install -Dt $out/lib/displaylink *.spkg
install -Dm755 ${arch}/DisplayLinkManager $out/bin/DisplayLinkManager
patchelf \
--set-interpreter $(cat ${stdenv.cc}/nix-support/dynamic-linker) \
--set-rpath $out/lib:${libPath} \
$out/bin/DisplayLinkManager
wrapProgram $out/bin/DisplayLinkManager \
--run "cd $out/lib/displaylink"
)
'';
meta = with stdenv.lib; {

View File

@ -11516,6 +11516,10 @@ with pkgs;
disk_indicator = callPackage ../os-specific/linux/disk-indicator { };
displaylink = callPackage ../os-specific/linux/displaylink {
inherit (linuxPackages) evdi;
};
dmidecode = callPackage ../os-specific/linux/dmidecode { };
dmtcp = callPackage ../os-specific/linux/dmtcp { };
@ -11878,8 +11882,6 @@ with pkgs;
cpupower = callPackage ../os-specific/linux/cpupower { };
displaylink = callPackage ../os-specific/linux/displaylink { };
dpdk = callPackage ../os-specific/linux/dpdk { };
exfat-nofuse = callPackage ../os-specific/linux/exfat { };