From c353ff94025bc23bd4a1124fbc36ec21ebaeee52 Mon Sep 17 00:00:00 2001 From: MakiseKurisu Date: Sat, 9 Nov 2024 00:16:47 +0800 Subject: [PATCH] ch9344: 2.0 -> 0-unstable-2024-11-15 GitHub repository does not contain versioned tags. The version mentioned in the commit message also does not match the change log embedded in the source code, which seems to be where the official version came from. Since this is such a mess, treat the package as no versioning. --- pkgs/os-specific/linux/ch9344/default.nix | 20 +++++++++---------- .../fix-incompatible-pointer-types.patch | 16 --------------- .../linux/ch9344/fix-linux-6-12-build.patch | 16 +++++++++++++++ 3 files changed, 26 insertions(+), 26 deletions(-) delete mode 100644 pkgs/os-specific/linux/ch9344/fix-incompatible-pointer-types.patch create mode 100644 pkgs/os-specific/linux/ch9344/fix-linux-6-12-build.patch diff --git a/pkgs/os-specific/linux/ch9344/default.nix b/pkgs/os-specific/linux/ch9344/default.nix index 42c26503ea15..094460b115e7 100644 --- a/pkgs/os-specific/linux/ch9344/default.nix +++ b/pkgs/os-specific/linux/ch9344/default.nix @@ -1,17 +1,18 @@ -{ stdenv, lib, fetchzip, kernel }: +{ stdenv, lib, fetchFromGitHub, kernel }: stdenv.mkDerivation rec { pname = "ch9344"; - version = "2.0"; + version = "0-unstable-2024-11-15"; - src = fetchzip { - name = "CH9344SER_LINUX.zip"; - url = "https://www.wch.cn/downloads/file/386.html#CH9344SER_LINUX.zip"; - hash = "sha256-YKNMYpap7CjhgTIpd/M9+nB11NtpwGYT/P14J6q3XZg="; + src = fetchFromGitHub { + owner = "WCHSoftGroup"; + repo = "ch9344ser_linux"; + rev = "4ea8973886989d67acdd01dba213e355eacc9088"; + hash = "sha256-ZZ/8s26o7wRwHy6c0m1vZ/DtRW5od+NgiU6aXZBVfc4="; }; patches = [ - ./fix-incompatible-pointer-types.patch + ./fix-linux-6-12-build.patch ]; sourceRoot = "${src.name}/driver"; @@ -34,13 +35,12 @@ stdenv.mkDerivation rec { meta = with lib; { homepage = "https://www.wch-ic.com/"; - downloadPage = "https://www.wch.cn/downloads/CH9344SER_LINUX_ZIP.html"; + downloadPage = "https://github.com/WCHSoftGroup/ch9344ser_linux"; description = "WCH CH9344/CH348 UART driver"; longDescription = '' A kernel module for WinChipHead CH9344/CH348 USB To Multi Serial Ports controller. ''; - # Archive contains no license. - license = licenses.unfree; + license = licenses.gpl2Only; platforms = platforms.linux; maintainers = with maintainers; [ MakiseKurisu ]; }; diff --git a/pkgs/os-specific/linux/ch9344/fix-incompatible-pointer-types.patch b/pkgs/os-specific/linux/ch9344/fix-incompatible-pointer-types.patch deleted file mode 100644 index 89c95347ed65..000000000000 --- a/pkgs/os-specific/linux/ch9344/fix-incompatible-pointer-types.patch +++ /dev/null @@ -1,16 +0,0 @@ -diff --git a/ch9344.c b/ch9344.c -index bfa10bb..76a94a7 100644 ---- a/ch9344.c -+++ b/ch9344.c -@@ -837,7 +837,11 @@ static void ch9344_tty_close(struct tty_struct *tty, struct file *filp) - } - } - -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 6, 0)) -+static ssize_t ch9344_tty_write(struct tty_struct *tty, const u8 *buf, size_t count) -+#else - static int ch9344_tty_write(struct tty_struct *tty, const unsigned char *buf, int count) -+#endif - { - struct ch9344 *ch9344 = tty->driver_data; - int stat; diff --git a/pkgs/os-specific/linux/ch9344/fix-linux-6-12-build.patch b/pkgs/os-specific/linux/ch9344/fix-linux-6-12-build.patch new file mode 100644 index 000000000000..a9ae61d51aa7 --- /dev/null +++ b/pkgs/os-specific/linux/ch9344/fix-linux-6-12-build.patch @@ -0,0 +1,16 @@ +diff --git a/ch9344.c b/ch9344.c +index 8130334..b017faa 100644 +--- a/ch9344.c ++++ b/ch9344.c +@@ -62,7 +62,11 @@ + #include + #include + #include ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 12, 0)) ++#include ++#else + #include ++#endif + + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)) + #include