Subject: [PATCH] gnu: Add ddcci-driver-linux.

From: Brice Waegeneire <[email-masked]>
Date: Mon, 21 Oct 2019 17:16:28 +0200

* gnu/packages/linux.scm (ddcci-driver-linux): Add variable.
---
 gnu/packages/linux.scm | 59 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 59 insertions(+)

diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index 989d55f8aa..4a98c9e60e 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -968,6 +968,65 @@ and should be used with caution, especially on untested models.")
 between the CDemu userspace daemon and linux kernel.")
     (license license:gpl2+)))
 
+
+(define-public ddcci-driver-linux
+  (package
+    (name "ddcci-driver-linux")
+    (version "0.3.3")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://gitlab.com/ddcci-driver-linux/ddcci-driver-linux.git")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "0vkkja3ykjil783zjpwp0vz7jy2fp9ccazzi3afd4fjk8gldin7f"))))
+    (build-system linux-module-build-system)
+    (arguments
+     `(#:tests? #f                               ; no tests
+       #:phases
+       (modify-phases %standard-phases
+         (replace 'build
+           (lambda* (#:key inputs #:allow-other-keys)
+             (for-each (lambda (module)
+                         (invoke "make" "-C"
+                                 (string-append (assoc-ref inputs "linux-module-builder")
+                                                "/lib/modules/build")
+                                 (string-append "M=" (getcwd) "/" module)))
+                       (list "ddcci" "ddcci-backlight"))
+             #t))
+         (replace 'install
+           (lambda* (#:key inputs native-inputs outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (moddir (string-append out "/lib/modules"))
+                    (kmod (assoc-ref (or native-inputs inputs) "kmod")))
+               ;; Install kernel modules
+               (mkdir-p moddir)
+               (for-each (lambda (module)
+                           (invoke "make" "-C"
+                                   (string-append
+                                    (assoc-ref inputs "linux-module-builder")
+                                    "/lib/modules/build")
+                                   (string-append "M=" (getcwd) "/" module)
+                                   (string-append "DEPMOD=" kmod "/bin/depmod")
+                                   (string-append "MODULE_DIR=" moddir)
+                                   (string-append "INSTALL_PATH=" out)
+                                   (string-append "INSTALL_MOD_PATH=" out)
+                                   "INSTALL_MOD_STRIP=1"
+                                   "modules_install"))
+                         (list "ddcci" "ddcci-backlight")))
+             #t)))))
+    (home-page "https://gitlab.com/ddcci-driver-linux/ddcci-driver-linux")
+    (synopsis "A pair of Linux kernel drivers for DDC/CI monitors")
+    (description "Two Linux kernel drivers, ddcci and ddcci-backlight, that
+allow the control of DDC/CI monitors through the sysfs interface. ddcci create
+a character device for each DDC/CI monitors in @file{/dev/bus/ddcci/[I²C bus number]}.
+ddcci-backlight allow the control of the backlight level or luminance property when supported
+under @file{/sys/class/backlight/}.")
+    (license license:gpl2+)))
+
 
 ;;;
 ;;; Pluggable authentication modules (PAM).
-- 
2.19.2