1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2018–2021 Tobias Geerinckx-Rice <me@tobias.gr>
3 ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
4 ;;; Copyright © 2020 Brice Waegeneire <brice@waegenei.re>
5 ;;; Copyright © 2021 Evgeny Pisemsky <evgeny@pisemsky.com>
6 ;;; Copyright © 2021 Léo Le Bouter <lle-bout@zaclys.net>
8 ;;; This file is part of GNU Guix.
10 ;;; GNU Guix is free software; you can redistribute it and/or modify it
11 ;;; under the terms of the GNU General Public License as published by
12 ;;; the Free Software Foundation; either version 3 of the License, or (at
13 ;;; your option) any later version.
15 ;;; GNU Guix is distributed in the hope that it will be useful, but
16 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;;; GNU General Public License for more details.
20 ;;; You should have received a copy of the GNU General Public License
21 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
23 (define-module (gnu packages hardware)
24 #:use-module (gnu packages admin)
25 #:use-module (gnu packages autotools)
26 #:use-module (gnu packages bash)
27 #:use-module (gnu packages compression)
28 #:use-module (gnu packages check)
29 #:use-module (gnu packages cpp)
30 #:use-module (gnu packages crypto)
31 #:use-module (gnu packages curl)
32 #:use-module (gnu packages documentation)
33 #:use-module (gnu packages gcc)
34 #:use-module (gnu packages gettext)
35 #:use-module (gnu packages glib)
36 #:use-module (gnu packages gtk)
37 #:use-module (gnu packages libusb)
38 #:use-module (gnu packages linux)
39 #:use-module (gnu packages ncurses)
40 #:use-module (gnu packages openldap)
41 #:use-module (gnu packages perl)
42 #:use-module (gnu packages pkg-config)
43 #:use-module (gnu packages polkit)
44 #:use-module (gnu packages protobuf)
45 #:use-module (gnu packages python)
46 #:use-module (gnu packages tls)
47 #:use-module (gnu packages web)
48 #:use-module (gnu packages xdisorg)
49 #:use-module (gnu packages xml)
50 #:use-module (gnu packages xorg)
51 #:use-module (guix build-system gnu)
52 #:use-module (guix download)
53 #:use-module (guix git-download)
54 #:use-module ((guix licenses) #:prefix license:)
55 #:use-module (guix packages)
56 #:use-module (guix utils))
58 ;; This is a module for packages related to physical hardware that don't (yet)
59 ;; have a more specific home like gps.scm, security-token.scm, &c.
61 (define-public ddcutil
68 (uri (string-append "https://www.ddcutil.com/tarballs/"
69 "ddcutil-" version ".tar.gz"))
71 (base32 "19kkwb9ijzn6ya3mvjanggh1c96fcc0lkbk7xnyi2qp6wsr4nhxp"))))
72 (build-system gnu-build-system)
74 `(("pkg-config" ,pkg-config)))
78 ("libdrm" ,libdrm) ; enhanced diagnostics
79 ("libusb" ,libusb) ; support USB monitors
80 ("libx11" ,libx11) ; enhanced diagnostics
81 ("libxrandr" ,libxrandr)
83 (home-page "https://www.ddcutil.com/")
84 (synopsis "Control external monitor settings")
86 "ddcutil can query and modify most external monitors' settings, such as
87 brightness, colour levels, and input sources. Generally speaking, any setting
88 that can be changed by pressing buttons on the monitor can be modified by
91 ddcutil communicates directly with monitors implementing the Monitor Control
92 Command Set (@dfn{MCCS}). It usually does so through the the Display Data
93 Channel Command Interface (@dfn{DDC/CI}) protocol on the I2C bus, but can also
94 communicate over USB as per the USB Monitor Control Class Specification.
96 One particular use case is in colour profile management. Monitor calibration
97 is relative to the monitor colour settings currently in effect, e.g. red gain.
98 ddcutil allows colour-related settings to be saved at the time a monitor is
99 calibrated, and restored when the calibration is applied.")
100 (license (list license:bsd-3 ; FindDDCUtil.cmake
101 license:gpl2+)))) ; everything else
103 (define-public edid-decode
104 (let ((commit "74b64180d67bb009d8d9ea1b6f18ad41aaa16396") ; 2020-04-22
108 (version (git-version "0.0.0" revision commit))
112 (file-name (git-file-name name version))
114 (url "git://linuxtv.org/edid-decode.git")
117 (base32 "0nirp5bza08zj5d8bjgcm0p869hdg3qg3mwa7999pjdrzmn7s2ah"))))
118 (build-system gnu-build-system)
120 `(#:tests? #f ; No test suite
122 (list (string-append "DESTDIR=" (assoc-ref %outputs "out"))
123 "bindir=/bin" "mandir=/share/man")
125 (modify-phases %standard-phases
126 (add-after 'unpack 'fix-cross-compilation
127 (lambda* (#:key native-inputs target #:allow-other-keys)
129 (substitute* "Makefile"
131 (string-append target "-g++"))))
133 (delete 'configure))))
134 (home-page "https://git.linuxtv.org/edid-decode.git/")
135 (synopsis "Decode @dfn{EDID} data in human-readable format")
136 (description "edid-decode decodes @dfn{EDID} monitor description data in
137 human-readable format and checks if it conforms to the standards.")
138 (license license:expat))))
140 (define-public libsmbios
149 (url (string-append "https://github.com/dell/" name))
150 (commit (string-append "v" version))))
151 (file-name (git-file-name name version))
153 (base32 "0krwwydyvb9224r884y1mlmzyxhlfrcqw73vi1j8787rl0gl5a2i"))))
154 (build-system gnu-build-system)
156 `(("autoconf" ,autoconf)
157 ("automake" ,automake)
158 ("gettext" ,gettext-minimal)
160 ("pkg-config" ,pkg-config)
164 `(("libxml2" ,libxml2)))
167 (modify-phases %standard-phases
169 (lambda _ (invoke "autoreconf" "-vfi"))))))
170 (synopsis "Library for interacting with Dell SMBIOS tables")
172 "libsmbios provides a library to interface with the SMBIOS tables. It
173 also provides extensions for proprietary methods of interfacing with Dell
174 specific SMBIOS tables.")
175 (home-page "https://github.com/dell/libsmbios")
177 (list license:osl2.1 license:gpl2+ license:bsd-3 license:boost1.0))))
179 ;; Distinct from memtest86, which is obsolete.
180 (define-public memtest86+
183 ;; Update the description when/if UEFI support is released.
188 (uri (string-append "https://www.memtest.org/download/5.01/memtest86+-"
191 (base32 "0fch1l55753y6jkk0hj8f6vw4h1kinkn9ysp22dq5g9zjnvjf88l"))))
192 (build-system gnu-build-system)
194 `(#:system "i686-linux" ; the result runs outside of any OS
195 #:tests? #f ; no way to test this
197 (modify-phases %standard-phases
198 (delete 'configure) ; no configure script
200 ;; The default 'make all' does wonderful things, like scp(1) a file to
201 ;; 192.168.0.12. Build the bootable images and nothing more.
204 "memtest" ; ELF executable
205 "memtest.bin"))) ; DOS/MBR boot sector
207 (lambda* (#:key outputs #:allow-other-keys)
208 (let* ((out (assoc-ref outputs "out"))
209 (lib (string-append out "/lib/memtest86+"))
210 (doc (string-append out "/share/doc/memtest86+-" ,version)))
213 (install-file file lib))
218 (install-file file doc))
223 ;; Newer GCCs fail with a deluge of "multiple definition of `__foo'" errors.
225 (supported-systems (list "i686-linux" "x86_64-linux"))
226 (home-page "https://www.memtest.org/")
227 (synopsis "Thorough real-mode memory tester")
229 "Memtest86+ is a thorough, stand-alone memory test for x86 systems. It
230 repeatedly writes different patterns to all memory locations, reads them back
231 again, and verifies whether the result is the same as what was written. This
232 can help debug even intermittent and non-deterministic errors.
234 It runs independently of any operating system, at computer boot-up, so that it
235 can scan as much of your RAM as possible for hardware defects.
237 Memtest86+ cannot currently be used on computers booted with UEFI.")
238 (license license:gpl2)))
240 (define-public memtester
247 ;; Even the latest release is available under 'old-versions/'.
248 (uri (string-append "http://pyropus.ca/software/memtester/old-versions/"
249 "memtester-" version ".tar.gz"))
251 (base32 "0dxfwayns3hjjplkxkpkm1409lmjlpi4chcrahcvdbnl0q6jpmcf"))))
252 (build-system gnu-build-system)
255 (list ,(string-append "CC=" (cc-for-target)))
257 (modify-phases %standard-phases
259 ;; This is a home-brewed configuration system where the cc/ld command
260 ;; lines are stored in one-line files.
261 (lambda* (#:key outputs #:allow-other-keys)
262 (let* ((out (assoc-ref outputs "out")))
263 (substitute* (list "conf-cc" "conf-ld")
265 (substitute* "Makefile"
266 (("(INSTALLPATH.*=).*" _ assignment)
267 (string-append assignment out)))
270 ;; There is no test suite. Test some RAM for a single iteration.
272 (invoke "./memtester" "64K" "1"))))))
273 (home-page "http://pyropus.ca/software/memtester/")
274 (synopsis "User-space memory subsystem tester")
276 "Memtester stress-tests the memory subsystem of your operating system and
277 computer. It repeatedly writes different patterns to all memory locations,
278 reads them back again, and verifies whether the result is the same as what was
279 written. This can help debug even intermittent and non-deterministic errors.
281 Memtester runs entirely in user space. This means that you don't need to reboot
282 to test your memory, but also that it's not possible to test all of the RAM
283 installed in the system.
285 It can also be told to test memory starting at a particular physical address.")
286 (license license:gpl2)))
288 (define-public msr-tools
295 (uri (string-append "https://01.org/sites/default/files/downloads/"
296 name "/" name "-" version ".zip"))
298 (base32 "07hxmddg0l31kjfmaq84ni142lbbvgq6391r8bd79wpm819pnigr"))))
299 (build-system gnu-build-system)
302 (list (string-append "sbindir=" (assoc-ref %outputs "out") "/sbin"))
304 (modify-phases %standard-phases
305 (delete 'configure) ; no configure script
306 (add-before 'install 'create-output-directory
307 (lambda* (#:key outputs #:allow-other-keys)
308 ;; 'make install' assumes that sbindir exists.
309 (let* ((out (assoc-ref outputs "out"))
310 (sbin (string-append out "/sbin")))
313 #:tests? #f)) ; no test suite
316 ;; These registers and the CPUID instruction only exist on (most) x86 chips.
317 (supported-systems (list "i686-linux" "x86_64-linux"))
318 (home-page "https://01.org/msr-tools/")
319 (synopsis "Read and write Model-Specific Registers (@dfn{MSR})")
321 "The MSR Tools project provides console utilities to directly access the
322 Model-Specific Registers (@dfn{MSR}s) and CPU ID of Intel-compatible processors:
325 @item @command{cpuid}: show identification and feature information of any CPU
326 @item @command{rdmsr}: read MSRs from any CPU or all CPUs
327 @item @command{wrmsr}: write to MSRs on any CPU or all CPUs
330 These tools can be used to query and modify certain low-level CPU parameters,
331 such as the Turbo Boost ratio and Thermal Design Power (@dfn{TDP}) limits.
333 MSR addresses differ (greatly) between processors, and any such modification can
334 be dangerous and may void your CPU or system board's warranty.")
335 (license license:gpl2))) ; cpuid.c is gpl2, {rd,wr}msr.c are gpl2+
337 (define-public wavemon
345 (url "https://github.com/uoaerg/wavemon")
346 (commit (string-append "v" version))))
347 (file-name (git-file-name name version))
349 (base32 "0m9n5asjxs1ir5rqprigqcrm976mgjvh4yql1jhfnbszwbf95193"))))
350 (build-system gnu-build-system)
354 ;; Makefile.in (ab)uses $(datadir) as $(docdir). Set it to Guix's
355 ;; standard --docdir since it's only used as such.
356 (string-append "datadir=" (assoc-ref %outputs "out")
357 "/share/doc/" ,name "-" ,version))
358 #:tests? #f)) ; no tests
360 `(("pkg-config" ,pkg-config)))
364 ("ncurses" ,ncurses)))
365 (home-page "https://github.com/uoaerg/wavemon")
366 (synopsis "Wireless network device monitor")
368 "Wavemon is a wireless device monitor with an interactive ncurses terminal
369 interface. It can display and plot signal and noise levels in real time. It
370 also reports packet statistics, device configuration, network parameters, and
371 access points and other wireless clients of your wireless network hardware.
373 Wavemon should work (with varying levels of detail and features) with any device
374 supported by the Linux kernel.")
375 ;; Source file headers still say GPL2+, but the authorial intent
376 ;; (from COPYING and the F9 'about' screen) is clearly GPL3+.
377 (license license:gpl3+)))
379 (define-public rkdeveloptool
380 (let ((commit "6e92ebcf8b1812da02663494a68972f956e490d3")
383 (name "rkdeveloptool")
384 (version (git-version "1.3" revision commit))
389 (url "https://github.com/rockchip-linux/rkdeveloptool")
391 (file-name (git-file-name name version))
393 (base32 "0zwrkqfxd671iy69v3q0844gfdpm1yk51i9qh2rqc969bd8glxga"))))
394 (build-system gnu-build-system)
396 `(("autoconf" ,autoconf)
397 ("automake" ,automake)
398 ("pkg-config" ,pkg-config)))
400 `(("libusb" ,libusb)))
401 (home-page "https://github.com/rockchip-linux/rkdeveloptool")
402 (synopsis "Read from and write to RockChicp devices over USB")
404 "Rkdeveloptool can read from and write to RockChip devices over USB, such
405 as the Pinebook Pro.")
406 (license license:gpl2+))))
411 ;; NOTE: We are using a Release Candidate version (for 2.0) here because
412 ;; of the linker issues with the previous release.
417 "https://github.com/ClusterLabs/libqb/releases/download/v"
418 version "/libqb-" version ".tar.xz"))
421 "008vvw504kh40br5v2xkqavnp9vpmjvf768faqzv1d00fd53ingn"))))
422 (build-system gnu-build-system)
424 `(("pkg-config" ,pkg-config)
425 ("xmllint" ,libxml2)))
426 (home-page "https://clusterlabs.github.io/libqb/")
427 (synopsis "Library providing high performance logging, tracing, ipc, and poll")
428 (description "Libqb is a library with the primary purpose of providing
429 high-performance, reusable features for client-server architecture, such as
430 logging, tracing, inter-process communication (IPC), and polling. Libqb is
431 not intended to be an all-encompassing library, but instead provide focused
432 APIs that are highly tuned for maximum performance for client-server
434 (license license:lgpl2.1)))
436 (define-public usbguard
443 "https://github.com/USBGuard/usbguard/releases/download/usbguard-"
444 version "/usbguard-" version ".tar.gz"))
445 (file-name (git-file-name name version))
447 (base32 "1il5immqfxh2cj8wn1bfk7l42inflzgjf07yqprpz7r3lalbxc25"))))
448 (build-system gnu-build-system)
451 (modify-phases %standard-phases
452 (add-after 'unpack 'patch-build-scripts
453 (lambda* (#:key inputs #:allow-other-keys)
454 (substitute* "configure"
455 (("/usr/include/catch")
456 (string-append (assoc-ref inputs "catch") "/include")))
457 ;; Do not create log directory.
458 (substitute* "Makefile.in" ((".*/log/usbguard.*") ""))
459 ;; Disable LDAP tests: they use 'sudo'.
460 (substitute* "src/Tests/Makefile.in"
461 (("\\$\\(am__append_2\\)") ""))
463 (add-after 'install 'delete-static-library
464 (lambda* (#:key outputs #:allow-other-keys)
465 ;; It can't be direclty disabled since it's needed for the tests.
466 (delete-file (string-append (assoc-ref outputs "out")
467 "/lib/libusbguard.a"))
469 (add-after 'install 'install-zsh-completion
470 (lambda* (#:key outputs #:allow-other-keys)
471 (let* ((out (assoc-ref outputs "out"))
473 (string-append out "/share/zsh/site-functions")))
474 (mkdir-p site-functions)
475 (copy-file "scripts/usbguard-zsh-completion"
476 (string-append site-functions "/_usbguard"))
479 (list (string-append "BASH_COMPLETION_DIR="
480 (assoc-ref %outputs "out")
481 "/etc/bash_completion.d"))
484 "--localstatedir=/var"
485 "--enable-systemd=no"
491 ("catch" ,catch-framework)
492 ("dbus-glib" ,dbus-glib)
494 ("libcap-ng" ,libcap-ng)
495 ("libseccomp" ,libseccomp)
496 ("libsodium" ,libsodium)
499 ("protobuf" ,protobuf)
502 `(("asciidoc" ,asciidoc)
503 ("bash-completion" ,bash-completion)
504 ("gdbus-codegen" ,glib "bin")
505 ("umockdev" ,umockdev)
507 ("xsltproc" ,libxslt)
508 ("pkg-config" ,pkg-config)))
509 (home-page "https://usbguard.github.io")
510 (synopsis "Helps to protect your computer against rogue USB devices (a.k.a. BadUSB)")
511 (description "USBGuard is a software framework for implementing USB device
512 authorization policies (what kind of USB devices are authorized) as well as
513 method of use policies (how a USB device may interact with the system).
514 Simply put, it is a USB device whitelisting tool.")
515 (license license:gpl2)))
517 (define-public screentest
525 (url "https://github.com/TobiX/screentest")
527 (file-name (git-file-name name version))
529 (base32 "0gv3xj9sbk1wsyijfw9xjnvy8pg7j4arjnma2r2kfi18qy32wd30"))))
530 (build-system gnu-build-system)
535 `(("autoconf" ,autoconf)
536 ("intltool" ,intltool)
539 ("automake" ,automake)
540 ("pkg-config" ,pkg-config)))
541 (synopsis "Simple screen testing tool")
542 (description "This is a program for testing the quality of CRT/LCD
543 screens. It displays various patterns and allows you to estimate the quality
544 of your CRT/LCD monitor.")
545 (home-page "https://github.com/TobiX/screentest")
546 (license license:gpl2)))
548 (define-public tpm2-tss
555 (uri (string-append "https://github.com/tpm2-software/tpm2-tss"
556 "/releases/download/" version "/tpm2-tss-" version
559 (base32 "05xynpwq851fp8f5fy7ac0blvz8mr5m5cbqj3gslgbwv63kjnfbq"))))
560 (build-system gnu-build-system)
562 `(("pkg-config" ,pkg-config)))
566 ("openssl" ,openssl)))
567 (home-page "https://tpm2-software.github.io/")
568 (synopsis "OSS Implementation of the TCG TPM2 Software Stack (TSS2)")
570 "This package provides the @acronym{TCG, Trusted Computing Group}
571 @acronym{TSS2, TPM2 Software Stack}. The stack contains libtss2-fapi,
572 libtss2-esys, libtss2-sys, libtss2-mu, libtss2-tcti-device, libtss2-tcti-swtpm
573 and libtss2-tcti-mssim.")
574 (license license:bsd-2)))