gnu: emacs-consult: Fix grammar.
[jackhill/guix/guix.git] / gnu / packages / hardware.scm
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>
7 ;;;
8 ;;; This file is part of GNU Guix.
9 ;;;
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.
14 ;;;
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.
19 ;;;
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/>.
22
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))
57
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.
60
61 (define-public ddcutil
62 (package
63 (name "ddcutil")
64 (version "1.1.0")
65 (source
66 (origin
67 (method url-fetch)
68 (uri (string-append "https://www.ddcutil.com/tarballs/"
69 "ddcutil-" version ".tar.gz"))
70 (sha256
71 (base32 "19kkwb9ijzn6ya3mvjanggh1c96fcc0lkbk7xnyi2qp6wsr4nhxp"))))
72 (build-system gnu-build-system)
73 (native-inputs
74 `(("pkg-config" ,pkg-config)))
75 (inputs
76 `(("eudev" ,eudev)
77 ("glib" ,glib)
78 ("libdrm" ,libdrm) ; enhanced diagnostics
79 ("libusb" ,libusb) ; support USB monitors
80 ("libx11" ,libx11) ; enhanced diagnostics
81 ("libxrandr" ,libxrandr)
82 ("zlib" ,zlib)))
83 (home-page "https://www.ddcutil.com/")
84 (synopsis "Control external monitor settings")
85 (description
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
89 ddcutil.
90
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.
95
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
102
103 (define-public edid-decode
104 (let ((commit "74b64180d67bb009d8d9ea1b6f18ad41aaa16396") ; 2020-04-22
105 (revision "1"))
106 (package
107 (name "edid-decode")
108 (version (git-version "0.0.0" revision commit))
109 (source
110 (origin
111 (method git-fetch)
112 (file-name (git-file-name name version))
113 (uri (git-reference
114 (url "git://linuxtv.org/edid-decode.git")
115 (commit commit)))
116 (sha256
117 (base32 "0nirp5bza08zj5d8bjgcm0p869hdg3qg3mwa7999pjdrzmn7s2ah"))))
118 (build-system gnu-build-system)
119 (arguments
120 `(#:tests? #f ; No test suite
121 #:make-flags
122 (list (string-append "DESTDIR=" (assoc-ref %outputs "out"))
123 "bindir=/bin" "mandir=/share/man")
124 #:phases
125 (modify-phases %standard-phases
126 (add-after 'unpack 'fix-cross-compilation
127 (lambda* (#:key native-inputs target #:allow-other-keys)
128 (when target
129 (substitute* "Makefile"
130 (("\\$\\(CXX\\)")
131 (string-append target "-g++"))))
132 #t))
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))))
139
140 (define-public libsmbios
141 (package
142 (name "libsmbios")
143 (version "2.4.3")
144 (source
145 (origin
146 (method git-fetch)
147 (uri
148 (git-reference
149 (url (string-append "https://github.com/dell/" name))
150 (commit (string-append "v" version))))
151 (file-name (git-file-name name version))
152 (sha256
153 (base32 "0krwwydyvb9224r884y1mlmzyxhlfrcqw73vi1j8787rl0gl5a2i"))))
154 (build-system gnu-build-system)
155 (native-inputs
156 `(("autoconf" ,autoconf)
157 ("automake" ,automake)
158 ("gettext" ,gettext-minimal)
159 ("libtool" ,libtool)
160 ("pkg-config" ,pkg-config)
161 ("perl" ,perl)
162 ("python" ,python)))
163 (inputs
164 `(("libxml2" ,libxml2)))
165 (arguments
166 `(#:phases
167 (modify-phases %standard-phases
168 (replace 'bootstrap
169 (lambda _ (invoke "autoreconf" "-vfi"))))))
170 (synopsis "Library for interacting with Dell SMBIOS tables")
171 (description
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")
176 (license
177 (list license:osl2.1 license:gpl2+ license:bsd-3 license:boost1.0))))
178
179 ;; Distinct from memtest86, which is obsolete.
180 (define-public memtest86+
181 (package
182 (name "memtest86+")
183 ;; Update the description when/if UEFI support is released.
184 (version "5.01")
185 (source
186 (origin
187 (method url-fetch)
188 (uri (string-append "https://www.memtest.org/download/5.01/memtest86+-"
189 version ".tar.gz"))
190 (sha256
191 (base32 "0fch1l55753y6jkk0hj8f6vw4h1kinkn9ysp22dq5g9zjnvjf88l"))))
192 (build-system gnu-build-system)
193 (arguments
194 `(#:system "i686-linux" ; the result runs outside of any OS
195 #:tests? #f ; no way to test this
196 #:phases
197 (modify-phases %standard-phases
198 (delete 'configure) ; no configure script
199 (replace 'build
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.
202 (lambda _
203 (invoke "make"
204 "memtest" ; ELF executable
205 "memtest.bin"))) ; DOS/MBR boot sector
206 (replace 'install
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)))
211 (for-each
212 (lambda (file)
213 (install-file file lib))
214 (list "memtest"
215 "memtest.bin"))
216 (for-each
217 (lambda (file)
218 (install-file file doc))
219 (list "FAQ"
220 "README"))
221 #t))))))
222 (native-inputs
223 ;; Newer GCCs fail with a deluge of "multiple definition of `__foo'" errors.
224 `(("gcc" ,gcc-4.9)))
225 (supported-systems (list "i686-linux" "x86_64-linux"))
226 (home-page "https://www.memtest.org/")
227 (synopsis "Thorough real-mode memory tester")
228 (description
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.
233
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.
236
237 Memtest86+ cannot currently be used on computers booted with UEFI.")
238 (license license:gpl2)))
239
240 (define-public memtester
241 (package
242 (name "memtester")
243 (version "4.5.0")
244 (source
245 (origin
246 (method url-fetch)
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"))
250 (sha256
251 (base32 "0dxfwayns3hjjplkxkpkm1409lmjlpi4chcrahcvdbnl0q6jpmcf"))))
252 (build-system gnu-build-system)
253 (arguments
254 `(#:make-flags
255 (list ,(string-append "CC=" (cc-for-target)))
256 #:phases
257 (modify-phases %standard-phases
258 (replace 'configure
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")
264 (("^cc") "gcc"))
265 (substitute* "Makefile"
266 (("(INSTALLPATH.*=).*" _ assignment)
267 (string-append assignment out)))
268 #t)))
269 (replace 'check
270 ;; There is no test suite. Test some RAM for a single iteration.
271 (lambda _
272 (invoke "./memtester" "64K" "1"))))))
273 (home-page "http://pyropus.ca/software/memtester/")
274 (synopsis "User-space memory subsystem tester")
275 (description
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.
280
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.
284
285 It can also be told to test memory starting at a particular physical address.")
286 (license license:gpl2)))
287
288 (define-public msr-tools
289 (package
290 (name "msr-tools")
291 (version "1.3")
292 (source
293 (origin
294 (method url-fetch)
295 (uri (string-append "https://01.org/sites/default/files/downloads/"
296 name "/" name "-" version ".zip"))
297 (sha256
298 (base32 "07hxmddg0l31kjfmaq84ni142lbbvgq6391r8bd79wpm819pnigr"))))
299 (build-system gnu-build-system)
300 (arguments
301 `(#:make-flags
302 (list (string-append "sbindir=" (assoc-ref %outputs "out") "/sbin"))
303 #:phases
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")))
311 (mkdir-p sbin)
312 #t))))
313 #:tests? #f)) ; no test suite
314 (native-inputs
315 `(("unzip" ,unzip)))
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})")
320 (description
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:
323
324 @itemize
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
328 @end itemize
329
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.
332
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+
336
337 (define-public wavemon
338 (package
339 (name "wavemon")
340 (version "0.9.3")
341 (source
342 (origin
343 (method git-fetch)
344 (uri (git-reference
345 (url "https://github.com/uoaerg/wavemon")
346 (commit (string-append "v" version))))
347 (file-name (git-file-name name version))
348 (sha256
349 (base32 "0m9n5asjxs1ir5rqprigqcrm976mgjvh4yql1jhfnbszwbf95193"))))
350 (build-system gnu-build-system)
351 (arguments
352 `(#:make-flags
353 (list "CC=gcc"
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
359 (native-inputs
360 `(("pkg-config" ,pkg-config)))
361 (inputs
362 `(("libcap" ,libcap)
363 ("libnl" ,libnl)
364 ("ncurses" ,ncurses)))
365 (home-page "https://github.com/uoaerg/wavemon")
366 (synopsis "Wireless network device monitor")
367 (description
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.
372
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+)))
378
379 (define-public rkdeveloptool
380 (let ((commit "6e92ebcf8b1812da02663494a68972f956e490d3")
381 (revision "0"))
382 (package
383 (name "rkdeveloptool")
384 (version (git-version "1.3" revision commit))
385 (source
386 (origin
387 (method git-fetch)
388 (uri (git-reference
389 (url "https://github.com/rockchip-linux/rkdeveloptool")
390 (commit commit)))
391 (file-name (git-file-name name version))
392 (sha256
393 (base32 "0zwrkqfxd671iy69v3q0844gfdpm1yk51i9qh2rqc969bd8glxga"))))
394 (build-system gnu-build-system)
395 (native-inputs
396 `(("autoconf" ,autoconf)
397 ("automake" ,automake)
398 ("pkg-config" ,pkg-config)))
399 (inputs
400 `(("libusb" ,libusb)))
401 (home-page "https://github.com/rockchip-linux/rkdeveloptool")
402 (synopsis "Read from and write to RockChicp devices over USB")
403 (description
404 "Rkdeveloptool can read from and write to RockChip devices over USB, such
405 as the Pinebook Pro.")
406 (license license:gpl2+))))
407
408 (define-public libqb
409 (package
410 (name "libqb")
411 ;; NOTE: We are using a Release Candidate version (for 2.0) here because
412 ;; of the linker issues with the previous release.
413 (version "1.9.1")
414 (source (origin
415 (method url-fetch)
416 (uri (string-append
417 "https://github.com/ClusterLabs/libqb/releases/download/v"
418 version "/libqb-" version ".tar.xz"))
419 (sha256
420 (base32
421 "008vvw504kh40br5v2xkqavnp9vpmjvf768faqzv1d00fd53ingn"))))
422 (build-system gnu-build-system)
423 (native-inputs
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
433 applications.")
434 (license license:lgpl2.1)))
435
436 (define-public usbguard
437 (package
438 (name "usbguard")
439 (version "0.7.8")
440 (source (origin
441 (method url-fetch)
442 (uri (string-append
443 "https://github.com/USBGuard/usbguard/releases/download/usbguard-"
444 version "/usbguard-" version ".tar.gz"))
445 (file-name (git-file-name name version))
446 (sha256
447 (base32 "1il5immqfxh2cj8wn1bfk7l42inflzgjf07yqprpz7r3lalbxc25"))))
448 (build-system gnu-build-system)
449 (arguments
450 `(#:phases
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\\)") ""))
462 #t))
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"))
468 #t))
469 (add-after 'install 'install-zsh-completion
470 (lambda* (#:key outputs #:allow-other-keys)
471 (let* ((out (assoc-ref outputs "out"))
472 (site-functions
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"))
477 #t))))
478 #:make-flags
479 (list (string-append "BASH_COMPLETION_DIR="
480 (assoc-ref %outputs "out")
481 "/etc/bash_completion.d"))
482 #:configure-flags
483 (list
484 "--localstatedir=/var"
485 "--enable-systemd=no"
486 "--with-ldap"
487 "--with-dbus"
488 "--with-polkit")))
489 (inputs
490 `(("audit" ,audit)
491 ("catch" ,catch-framework)
492 ("dbus-glib" ,dbus-glib)
493 ("ldap" ,openldap)
494 ("libcap-ng" ,libcap-ng)
495 ("libseccomp" ,libseccomp)
496 ("libsodium" ,libsodium)
497 ("pegtl" ,pegtl)
498 ("polkit" ,polkit)
499 ("protobuf" ,protobuf)
500 ("libqb" ,libqb)))
501 (native-inputs
502 `(("asciidoc" ,asciidoc)
503 ("bash-completion" ,bash-completion)
504 ("gdbus-codegen" ,glib "bin")
505 ("umockdev" ,umockdev)
506 ("xmllint" ,libxml2)
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)))
516
517 (define-public screentest
518 (package
519 (name "screentest")
520 (version "2.1")
521 (source
522 (origin
523 (method git-fetch)
524 (uri (git-reference
525 (url "https://github.com/TobiX/screentest")
526 (commit version)))
527 (file-name (git-file-name name version))
528 (sha256
529 (base32 "0gv3xj9sbk1wsyijfw9xjnvy8pg7j4arjnma2r2kfi18qy32wd30"))))
530 (build-system gnu-build-system)
531 (inputs
532 `(("glib" ,glib)
533 ("gtk+" ,gtk+-2)))
534 (native-inputs
535 `(("autoconf" ,autoconf)
536 ("intltool" ,intltool)
537 ("libtool" ,libtool)
538 ("glib" ,glib "bin")
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)))
547
548 (define-public tpm2-tss
549 (package
550 (name "tpm2-tss")
551 (version "3.0.3")
552 (source
553 (origin
554 (method url-fetch)
555 (uri (string-append "https://github.com/tpm2-software/tpm2-tss"
556 "/releases/download/" version "/tpm2-tss-" version
557 ".tar.gz"))
558 (sha256
559 (base32 "05xynpwq851fp8f5fy7ac0blvz8mr5m5cbqj3gslgbwv63kjnfbq"))))
560 (build-system gnu-build-system)
561 (native-inputs
562 `(("pkg-config" ,pkg-config)))
563 (inputs
564 `(("curl" ,curl)
565 ("json-c" ,json-c)
566 ("openssl" ,openssl)))
567 (home-page "https://tpm2-software.github.io/")
568 (synopsis "OSS Implementation of the TCG TPM2 Software Stack (TSS2)")
569 (description
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)))