ch9344: init at 1.9

+72
+48
pkgs/os-specific/linux/ch9344/default.nix
··· 1 + { stdenv, lib, fetchzip, kernel }: 2 + 3 + stdenv.mkDerivation rec { 4 + pname = "ch9344"; 5 + version = "1.9"; 6 + 7 + src = fetchzip { 8 + name = "CH9344SER_LINUX.zip"; 9 + url = "https://www.wch.cn/downloads/file/386.html#CH9344SER_LINUX.zip"; 10 + hash = "sha256-g55ftAfjKKlUFzGhI1a/O7Eqbz6rkGf1vWuEJjBZxBE="; 11 + }; 12 + 13 + patches = lib.optionals (lib.versionAtLeast kernel.modDirVersion "6.1") [ 14 + # https://github.com/torvalds/linux/commit/a8c11c1520347be74b02312d10ef686b01b525f1 15 + ./fix-incompatible-pointer-types.patch 16 + ]; 17 + 18 + sourceRoot = "${src.name}/driver"; 19 + hardeningDisable = [ "pic" ]; 20 + nativeBuildInputs = kernel.moduleBuildDependencies; 21 + 22 + preBuild = '' 23 + substituteInPlace Makefile --replace "KERNELDIR :=" "KERNELDIR ?=" 24 + ''; 25 + 26 + makeFlags = [ 27 + "KERNELDIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build" 28 + ]; 29 + 30 + installPhase = '' 31 + runHook preInstall 32 + install -D ch9344.ko $out/lib/modules/${kernel.modDirVersion}/usb/serial/ch9344.ko 33 + runHook postInstall 34 + ''; 35 + 36 + meta = with lib; { 37 + homepage = "http://www.wch-ic.com/"; 38 + downloadPage = "https://www.wch.cn/downloads/CH9344SER_LINUX_ZIP.html"; 39 + description = "WCH CH9344/CH348 UART driver"; 40 + longDescription = '' 41 + A kernel module for WinChipHead CH9344/CH348 USB To Multi Serial Ports controller. 42 + ''; 43 + # Archive contains no license. 44 + license = licenses.unfree; 45 + platforms = platforms.linux; 46 + maintainers = with maintainers; [ MakiseKurisu ]; 47 + }; 48 + }
+22
pkgs/os-specific/linux/ch9344/fix-incompatible-pointer-types.patch
··· 1 + diff --git a/ch9344.c b/ch9344.c 2 + index 1e37293..a16af82 100644 3 + --- a/ch9344.c 4 + +++ b/ch9344.c 5 + @@ -79,7 +79,7 @@ static DEFINE_IDR(ch9344_minors); 6 + static DEFINE_MUTEX(ch9344_minors_lock); 7 + 8 + static void ch9344_tty_set_termios(struct tty_struct *tty, 9 + - struct ktermios *termios_old); 10 + + const struct ktermios *termios_old); 11 + 12 + static int ch9344_get_portnum(int index); 13 + 14 + @@ -1597,7 +1597,7 @@ u8 cal_recv_tmt(__le32 bd) 15 + } 16 + 17 + static void ch9344_tty_set_termios(struct tty_struct *tty, 18 + - struct ktermios *termios_old) 19 + + const struct ktermios *termios_old) 20 + { 21 + struct ch9344 *ch9344 = tty->driver_data; 22 + struct ktermios *termios = &tty->termios;
+2
pkgs/top-level/linux-kernels.nix
··· 308 308 309 309 bbswitch = callPackage ../os-specific/linux/bbswitch {}; 310 310 311 + ch9344 = callPackage ../os-specific/linux/ch9344 { }; 312 + 311 313 chipsec = callPackage ../tools/security/chipsec { 312 314 inherit kernel; 313 315 withDriver = true;