xmm7360-pci: init at untable-20210802

Kernel module and tools, NixOS module coming soon.
master
Andreas Wiese 2021-09-16 23:47:15 +02:00
parent 5d36cfb94f
commit 7dc105d7af
5 changed files with 103 additions and 0 deletions

View File

@ -24,4 +24,10 @@ in rec {
vivaldi = callPackage ./pkgs/vivaldi { };
} // optionalAttrs (builtins.elem pkgs.system pkgs.lib.platforms.linux) rec {
xmm7360-pci = callPackage ./pkgs/xmm7360-pci { kernel = pkgs.linux; };
xmm7360-pci-tools = callPackage ./pkgs/xmm7360-pci/tools.nix { inherit xmm7360-pci; };
}

View File

@ -44,6 +44,11 @@
ryzen_smu
vivaldi
;
} // prev.lib.optionalAttrs (builtins.elem prev.system prev.lib.platforms.linux) rec {
inherit (localPkgs)
xmm7360-pci
xmm7360-pci-tools
;
};
};

View File

@ -0,0 +1,33 @@
{ lib, fetchFromGitHub, kernel }:
kernel.stdenv.mkDerivation rec {
pname = "xmm7360-pci";
version = "unstable-20210802";
src = fetchFromGitHub {
owner = "xmm7360";
repo = pname;
rev = "b28714b6fb73887ecd5c0c25ffc0613d6eab6533";
sha256 = "sha256-wNSQZvPL297pTAVT9Hj4IgcsHSc7KVNe7K0raS0bObg=";
};
nativeBuildInputs = kernel.moduleBuildDependencies;
patches = [ ./fix.patch ];
makeFlags = [
"KDIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
];
installPhase = ''
install -m0644 -D xmm7360.ko $out/lib/modules/${kernel.modDirVersion}/misc/xmm7360.ko
'';
meta = with lib; {
description = "PCI driver for Fibocom L850-GL modem base on Intel XMM7360 modem";
homepage = src.meta.homepage;
license = licenses.gpl2;
maintainers = with maintainers; [ aw ];
platforms = platforms.linux;
};
}

View File

@ -0,0 +1,13 @@
diff --git a/xmm7360.c b/xmm7360.c
index ccd149d..acc7fea 100644
--- a/xmm7360.c
+++ b/xmm7360.c
@@ -1272,7 +1272,7 @@ static int xmm7360_tty_write(struct tty_struct *tty,
return written;
}
-static int xmm7360_tty_write_room(struct tty_struct *tty)
+static unsigned int xmm7360_tty_write_room(struct tty_struct *tty)
{
struct queue_pair *qp = tty->driver_data;
if (!xmm7360_qp_can_write(qp))

View File

@ -0,0 +1,46 @@
{ lib, stdenv, fetchFromGitHub, xmm7360-pci, python3Packages, makeWrapper }:
let
inherit (xmm7360-pci) pname version src;
pythonPath = with python3Packages; makePythonPath [
python
configargparse
dbus-python
pyroute2
];
in stdenv.mkDerivation {
pname = "${pname}-tools";
inherit version src;
nativeBuildInputs = [ makeWrapper ];
buildInputs = [ python3Packages.python ];
dontBuild = true;
installPhase = ''
runHook preInstall
mkdir -p $out/bin $out/lib
cp -a rpc/* $out/lib
pushd $out/lib
find . -executable -type f | while read file; do
makeWrapper ${python3Packages.python.interpreter} $out/bin/''${file%.py} \
--add-flags "$out/lib/''${file}" \
--prefix NIX_PYTHONPATH : "${pythonPath}"
done
runHook postInstall
'';
meta = with lib; {
description = xmm7360-pci.meta.description + " (tools)";
homepage = src.meta.homepage;
license = licenses.gpl2;
maintainers = with maintainers; [ aw ];
platforms = platforms.linux;
};
}