1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2018, 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
3 ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
4 ;;; Copyright © 2020 Brice Waegeneire <brice@waegenei.re>
6 ;;; This file is part of GNU Guix.
8 ;;; GNU Guix is free software; you can redistribute it and/or modify it
9 ;;; under the terms of the GNU General Public License as published by
10 ;;; the Free Software Foundation; either version 3 of the License, or (at
11 ;;; your option) any later version.
13 ;;; GNU Guix is distributed in the hope that it will be useful, but
14 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;;; GNU General Public License for more details.
18 ;;; You should have received a copy of the GNU General Public License
19 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
21 (define-module (gnu packages hardware)
22 #:use-module (gnu packages admin)
23 #:use-module (gnu packages autotools)
24 #:use-module (gnu packages bash)
25 #:use-module (gnu packages compression)
26 #:use-module (gnu packages check)
27 #:use-module (gnu packages cpp)
28 #:use-module (gnu packages crypto)
29 #:use-module (gnu packages documentation)
30 #:use-module (gnu packages gcc)
31 #:use-module (gnu packages glib)
32 #:use-module (gnu packages libusb)
33 #:use-module (gnu packages linux)
34 #:use-module (gnu packages ncurses)
35 #:use-module (gnu packages openldap)
36 #:use-module (gnu packages pkg-config)
37 #:use-module (gnu packages polkit)
38 #:use-module (gnu packages protobuf)
39 #:use-module (gnu packages xdisorg)
40 #:use-module (gnu packages xml)
41 #:use-module (gnu packages xorg)
42 #:use-module (guix build-system gnu)
43 #:use-module (guix download)
44 #:use-module (guix git-download)
45 #:use-module ((guix licenses) #:prefix license:)
46 #:use-module (guix packages)
47 #:use-module (guix utils))
49 ;; This is a module for packages related to physical hardware that don't (yet)
50 ;; have a more specific home like gps.scm, security-token.scm, &c.
52 (define-public ddcutil
59 (uri (string-append "https://www.ddcutil.com/tarballs/"
60 "ddcutil-" version ".tar.gz"))
62 (base32 "0anyxy53k2613hq9glaad16llqlv6iim5p8gz0rs5pnpp8p00dg1"))))
63 (build-system gnu-build-system)
65 `(("pkg-config" ,pkg-config)))
69 ("libdrm" ,libdrm) ; enhanced diagnostics
70 ("libusb" ,libusb) ; support USB monitors
71 ("libx11" ,libx11) ; enhanced diagnostics
72 ("libxrandr" ,libxrandr)
74 (home-page "https://www.ddcutil.com/")
75 (synopsis "Control external monitor settings")
77 "ddcutil can query and modify most external monitors' settings, such as
78 brightness, colour levels, and input sources. Generally speaking, any setting
79 that can be changed by pressing buttons on the monitor can be modified by
82 ddcutil communicates directly with monitors implementing the Monitor Control
83 Command Set (@dfn{MCCS}). It usually does so through the the Display Data
84 Channel Command Interface (@dfn{DDC/CI}) protocol on the I2C bus, but can also
85 communicate over USB as per the USB Monitor Control Class Specification.
87 One particular use case is in colour profile management. Monitor calibration
88 is relative to the monitor colour settings currently in effect, e.g. red gain.
89 ddcutil allows colour-related settings to be saved at the time a monitor is
90 calibrated, and restored when the calibration is applied.")
91 (license (list license:bsd-3 ; FindDDCUtil.cmake
92 license:gpl2+)))) ; everything else
94 (define-public edid-decode
95 (let ((commit "74b64180d67bb009d8d9ea1b6f18ad41aaa16396") ; 2020-04-22
99 (version (git-version "0.0.0" revision commit))
103 (file-name (git-file-name name version))
105 (url "git://linuxtv.org/edid-decode.git")
108 (base32 "0nirp5bza08zj5d8bjgcm0p869hdg3qg3mwa7999pjdrzmn7s2ah"))))
109 (build-system gnu-build-system)
111 `(#:tests? #f ; No test suite
113 (list (string-append "DESTDIR=" (assoc-ref %outputs "out"))
114 "bindir=/bin" "mandir=/share/man")
116 (modify-phases %standard-phases
117 (add-after 'unpack 'fix-cross-compilation
118 (lambda* (#:key native-inputs target #:allow-other-keys)
120 (substitute* "Makefile"
122 (string-append target "-g++"))))
124 (delete 'configure))))
125 (home-page "https://git.linuxtv.org/edid-decode.git/")
126 (synopsis "Decode @dfn{EDID} data in human-readable format")
127 (description "edid-decode decodes @dfn{EDID} monitor description data in
128 human-readable format and checks if it conforms to the standards.")
129 (license license:expat))))
131 ;; Distinct from memtest86, which is obsolete.
132 (define-public memtest86+
135 ;; Update the description when/if UEFI support is released.
140 (uri (string-append "https://www.memtest.org/download/5.01/memtest86+-"
143 (base32 "0fch1l55753y6jkk0hj8f6vw4h1kinkn9ysp22dq5g9zjnvjf88l"))))
144 (build-system gnu-build-system)
146 `(#:system "i686-linux" ; the result runs outside of any OS
147 #:tests? #f ; no way to test this
149 (modify-phases %standard-phases
150 (delete 'configure) ; no configure script
152 ;; The default 'make all' does wonderful things, like scp(1) a file to
153 ;; 192.168.0.12. Build the bootable images and nothing more.
156 "memtest" ; ELF executable
157 "memtest.bin"))) ; DOS/MBR boot sector
159 (lambda* (#:key outputs #:allow-other-keys)
160 (let* ((out (assoc-ref outputs "out"))
161 (lib (string-append out "/lib/memtest86+"))
162 (doc (string-append out "/share/doc/memtest86+-" ,version)))
165 (install-file file lib))
170 (install-file file doc))
175 ;; Newer GCCs fail with a deluge of "multiple definition of `__foo'" errors.
177 (supported-systems (list "i686-linux" "x86_64-linux"))
178 (home-page "https://www.memtest.org/")
179 (synopsis "Thorough real-mode memory tester")
181 "Memtest86+ is a thorough, stand-alone memory test for x86 systems. It
182 repeatedly writes different patterns to all memory locations, reads them back
183 again, and verifies whether the result is the same as what was written. This
184 can help debug even intermittent and non-deterministic errors.
186 It runs independently of any operating system, at computer boot-up, so that it
187 can scan as much of your RAM as possible for hardware defects.
189 Memtest86+ cannot currently be used on computers booted with UEFI.")
190 (license license:gpl2)))
192 (define-public memtester
199 ;; Even the latest release is available under 'old-versions/'.
200 (uri (string-append "http://pyropus.ca/software/memtester/old-versions/"
201 "memtester-" version ".tar.gz"))
203 (base32 "127xymmyzb9r6dxqrwd69v7gf8csv8kv7fjvagbglf3wfgyy5pzr"))))
204 (build-system gnu-build-system)
207 (list ,(string-append "CC=" (cc-for-target)))
209 (modify-phases %standard-phases
211 ;; This is a home-brewed configuration system where the cc/ld command
212 ;; lines are stored in one-line files.
213 (lambda* (#:key outputs #:allow-other-keys)
214 (let* ((out (assoc-ref outputs "out")))
215 (substitute* (list "conf-cc" "conf-ld")
217 (substitute* "Makefile"
218 (("(INSTALLPATH.*=).*" _ assignment)
219 (string-append assignment out)))
222 ;; There is no test suite. Test some RAM for a single iteration.
224 (invoke "./memtester" "64K" "1"))))))
225 (home-page "http://pyropus.ca/software/memtester/")
226 (synopsis "User-space memory subsystem tester")
228 "Memtester stress-tests the memory subsystem of your operating system and
229 computer. It repeatedly writes different patterns to all memory locations,
230 reads them back again, and verifies whether the result is the same as what was
231 written. This can help debug even intermittent and non-deterministic errors.
233 Memtester runs entirely in user space. This means that you don't need to reboot
234 to test your memory, but also that it's not possible to test all of the RAM
235 installed in the system.
237 It can also be told to test memory starting at a particular physical address.")
238 (license license:gpl2)))
240 (define-public msr-tools
247 (uri (string-append "https://01.org/sites/default/files/downloads/"
248 name "/" name "-" version ".zip"))
250 (base32 "07hxmddg0l31kjfmaq84ni142lbbvgq6391r8bd79wpm819pnigr"))))
251 (build-system gnu-build-system)
254 (list (string-append "sbindir=" (assoc-ref %outputs "out") "/sbin"))
256 (modify-phases %standard-phases
257 (delete 'configure) ; no configure script
258 (add-before 'install 'create-output-directory
259 (lambda* (#:key outputs #:allow-other-keys)
260 ;; 'make install' assumes that sbindir exists.
261 (let* ((out (assoc-ref outputs "out"))
262 (sbin (string-append out "/sbin")))
265 #:tests? #f)) ; no test suite
268 ;; These registers and the CPUID instruction only exist on (most) x86 chips.
269 (supported-systems (list "i686-linux" "x86_64-linux"))
270 (home-page "https://01.org/msr-tools/")
271 (synopsis "Read and write Model-Specific Registers (@dfn{MSR})")
273 "The MSR Tools project provides console utilities to directly access the
274 Model-Specific Registers (@dfn{MSR}s) and CPU ID of Intel-compatible processors:
277 @item @command{cpuid}: show identification and feature information of any CPU
278 @item @command{rdmsr}: read MSRs from any CPU or all CPUs
279 @item @command{wrmsr}: write to MSRs on any CPU or all CPUs
282 These tools can be used to query and modify certain low-level CPU parameters,
283 such as the Turbo Boost ratio and Thermal Design Power (@dfn{TDP}) limits.
285 MSR addresses differ (greatly) between processors, and any such modification can
286 be dangerous and may void your CPU or system board's warranty.")
287 (license license:gpl2))) ; cpuid.c is gpl2, {rd,wr}msr.c are gpl2+
289 (define-public wavemon
297 (url "https://github.com/uoaerg/wavemon")
298 (commit (string-append "v" version))))
299 (file-name (git-file-name name version))
301 (base32 "0y984wm03lzqf7bk06a07mw7d1fzjsp9x7zxcvlx4xqmv7wlgb29"))
304 ;; Two upstream commits required to find the correct <ncurses.h>.
308 "https://github.com/uoaerg/wavemon/commit/"
309 "ce7f9c4da90767bb50e4b80cdb3cee61264d8d12.patch"))
311 (base32 "04b4qbsa5l0jr41dkj0c8yw74lm8z8b50nw1iwas6hnzq41dwdm3")))
315 "https://github.com/uoaerg/wavemon/commit/"
316 "31e3def1c7332ad830bd966e7d21b343b4f2da54.patch"))
318 (base32 "0kyv3sbkv9hl8b88xnk6bq550axh9wzfjlhp3jbvqd4fqf7663br")))))))
319 (build-system gnu-build-system)
323 ;; Makefile.in (ab)uses $(datadir) as $(docdir). Set it to Guix's
324 ;; standard --docdir since it's only used as such.
325 (string-append "datadir=" (assoc-ref %outputs "out")
326 "/share/doc/" ,name "-" ,version))
327 #:tests? #f)) ; no tests
329 `(("pkg-config" ,pkg-config)))
333 ("ncurses" ,ncurses)))
334 (home-page "https://github.com/uoaerg/wavemon")
335 (synopsis "Wireless network device monitor")
337 "Wavemon is a wireless device monitor with an interactive ncurses terminal
338 interface. It can display and plot signal and noise levels in real time. It
339 also reports packet statistics, device configuration, network parameters, and
340 access points and other wireless clients of your wireless network hardware.
342 Wavemon should work (with varying levels of detail and features) with any device
343 supported by the Linux kernel.")
344 ;; Source file headers still say GPL2+, but the authorial intent
345 ;; (from COPYING and the F9 'about' screen) is clearly GPL3+.
346 (license license:gpl3+)))
348 (define-public rkdeveloptool
349 (let ((commit "6e92ebcf8b1812da02663494a68972f956e490d3")
352 (name "rkdeveloptool")
353 (version (git-version "1.3" revision commit))
358 (url "https://github.com/rockchip-linux/rkdeveloptool")
360 (file-name (git-file-name name version))
362 (base32 "0zwrkqfxd671iy69v3q0844gfdpm1yk51i9qh2rqc969bd8glxga"))))
363 (build-system gnu-build-system)
365 `(("autoconf" ,autoconf)
366 ("automake" ,automake)
367 ("pkg-config" ,pkg-config)))
369 `(("libusb" ,libusb)))
370 (home-page "https://github.com/rockchip-linux/rkdeveloptool")
371 (synopsis "Read from and write to RockChicp devices over USB")
373 "Rkdeveloptool can read from and write to RockChip devices over USB, such
374 as the Pinebook Pro.")
375 (license license:gpl2+))))
380 ;; NOTE: We are using a Release Candidate version (for 2.0) here because
381 ;; of the linker issues with the previous release.
386 "https://github.com/ClusterLabs/libqb/releases/download/v"
387 version "/libqb-" version ".tar.xz"))
390 "008vvw504kh40br5v2xkqavnp9vpmjvf768faqzv1d00fd53ingn"))))
391 (build-system gnu-build-system)
393 `(("pkg-config" ,pkg-config)
394 ("xmllint" ,libxml2)))
395 (home-page "https://clusterlabs.github.io/libqb/")
396 (synopsis "Library providing high performance logging, tracing, ipc, and poll")
397 (description "Libqb is a library with the primary purpose of providing
398 high-performance, reusable features for client-server architecture, such as
399 logging, tracing, inter-process communication (IPC), and polling. Libqb is
400 not intended to be an all-encompassing library, but instead provide focused
401 APIs that are highly tuned for maximum performance for client-server
403 (license license:lgpl2.1)))
405 (define-public usbguard
412 "https://github.com/USBGuard/usbguard/releases/download/usbguard-"
413 version "/usbguard-" version ".tar.gz"))
414 (file-name (git-file-name name version))
416 (base32 "1il5immqfxh2cj8wn1bfk7l42inflzgjf07yqprpz7r3lalbxc25"))))
417 (build-system gnu-build-system)
420 (modify-phases %standard-phases
421 (add-after 'unpack 'patch-build-scripts
422 (lambda* (#:key inputs #:allow-other-keys)
423 (substitute* "configure"
424 (("/usr/include/catch")
425 (string-append (assoc-ref inputs "catch") "/include")))
426 ;; Do not create log directory.
427 (substitute* "Makefile.in" ((".*/log/usbguard.*") ""))
428 ;; Disable LDAP tests: they use 'sudo'.
429 (substitute* "src/Tests/Makefile.in"
430 (("\\$\\(am__append_2\\)") ""))
432 (add-after 'install 'delete-static-library
433 (lambda* (#:key outputs #:allow-other-keys)
434 ;; It can't be direclty disabled since it's needed for the tests.
435 (delete-file (string-append (assoc-ref outputs "out")
436 "/lib/libusbguard.a"))
438 (add-after 'install 'install-zsh-completion
439 (lambda* (#:key outputs #:allow-other-keys)
440 (let* ((out (assoc-ref outputs "out"))
442 (string-append out "/share/zsh/site-functions")))
443 (mkdir-p site-functions)
444 (copy-file "scripts/usbguard-zsh-completion"
445 (string-append site-functions "/_usbguard"))
448 (list (string-append "BASH_COMPLETION_DIR="
449 (assoc-ref %outputs "out")
450 "/etc/bash_completion.d"))
453 "--localstatedir=/var"
454 "--enable-systemd=no"
460 ("catch" ,catch-framework)
461 ("dbus-glib" ,dbus-glib)
463 ("libcap-ng" ,libcap-ng)
464 ("libseccomp" ,libseccomp)
465 ("libsodium" ,libsodium)
468 ("protobuf" ,protobuf)
471 `(("asciidoc" ,asciidoc)
472 ("bash-completion" ,bash-completion)
473 ("gdbus-codegen" ,glib "bin")
474 ("umockdev" ,umockdev)
476 ("xsltproc" ,libxslt)
477 ("pkg-config" ,pkg-config)))
478 (home-page "https://usbguard.github.io")
479 (synopsis "Helps to protect your computer against rogue USB devices (a.k.a. BadUSB)")
480 (description "USBGuard is a software framework for implementing USB device
481 authorization policies (what kind of USB devices are authorized) as well as
482 method of use policies (how a USB device may interact with the system).
483 Simply put, it is a USB device whitelisting tool.")
484 (license license:gpl2)))