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