gnu: Remove ".git" from "https://github/…/….git".
[jackhill/guix/guix.git] / gnu / packages / hardware.scm
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>
5 ;;;
6 ;;; This file is part of GNU Guix.
7 ;;;
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.
12 ;;;
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.
17 ;;;
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/>.
20
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))
48
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.
51
52 (define-public ddcutil
53 (package
54 (name "ddcutil")
55 (version "0.9.8")
56 (source
57 (origin
58 (method url-fetch)
59 (uri (string-append "https://www.ddcutil.com/tarballs/"
60 "ddcutil-" version ".tar.gz"))
61 (sha256
62 (base32 "13ccxbqgyz4ah9jwbcylnfkgl8j3ida8xd00xkcq4xnfyyv5mg6v"))))
63 (build-system gnu-build-system)
64 (native-inputs
65 `(("pkg-config" ,pkg-config)))
66 (inputs
67 `(("eudev" ,eudev)
68 ("glib" ,glib)
69 ("libdrm" ,libdrm) ; enhanced diagnostics
70 ("libusb" ,libusb) ; support USB monitors
71 ("libx11" ,libx11) ; enhanced diagnostics
72 ("libxrandr" ,libxrandr)
73 ("zlib" ,zlib)))
74 (home-page "https://www.ddcutil.com/")
75 (synopsis "Control external monitor settings")
76 (description
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
80 ddcutil.
81
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.
86
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
93
94 (define-public edid-decode
95 (let ((commit "74b64180d67bb009d8d9ea1b6f18ad41aaa16396") ; 2020-04-22
96 (revision "1"))
97 (package
98 (name "edid-decode")
99 (version (git-version "0.0.0" revision commit))
100 (source
101 (origin
102 (method git-fetch)
103 (file-name (git-file-name name version))
104 (uri (git-reference
105 (url "git://linuxtv.org/edid-decode.git")
106 (commit commit)))
107 (sha256
108 (base32 "0nirp5bza08zj5d8bjgcm0p869hdg3qg3mwa7999pjdrzmn7s2ah"))))
109 (build-system gnu-build-system)
110 (arguments
111 `(#:tests? #f ; No test suite
112 #:make-flags
113 (list (string-append "DESTDIR=" (assoc-ref %outputs "out"))
114 "bindir=/bin" "mandir=/share/man")
115 #:phases
116 (modify-phases %standard-phases
117 (add-after 'unpack 'fix-cross-compilation
118 (lambda* (#:key native-inputs target #:allow-other-keys)
119 (when target
120 (substitute* "Makefile"
121 (("\\$\\(CXX\\)")
122 (string-append target "-g++"))))
123 #t))
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))))
130
131 ;; Distinct from memtest86, which is obsolete.
132 (define-public memtest86+
133 (package
134 (name "memtest86+")
135 ;; Update the description when/if UEFI support is released.
136 (version "5.01")
137 (source
138 (origin
139 (method url-fetch)
140 (uri (string-append "https://www.memtest.org/download/5.01/memtest86+-"
141 version ".tar.gz"))
142 (sha256
143 (base32 "0fch1l55753y6jkk0hj8f6vw4h1kinkn9ysp22dq5g9zjnvjf88l"))))
144 (build-system gnu-build-system)
145 (arguments
146 `(#:system "i686-linux" ; the result runs outside of any OS
147 #:tests? #f ; no way to test this
148 #:phases
149 (modify-phases %standard-phases
150 (delete 'configure) ; no configure script
151 (replace 'build
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.
154 (lambda _
155 (invoke "make"
156 "memtest" ; ELF executable
157 "memtest.bin"))) ; DOS/MBR boot sector
158 (replace 'install
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)))
163 (for-each
164 (lambda (file)
165 (install-file file lib))
166 (list "memtest"
167 "memtest.bin"))
168 (for-each
169 (lambda (file)
170 (install-file file doc))
171 (list "FAQ"
172 "README"))
173 #t))))))
174 (native-inputs
175 ;; Newer GCCs fail with a deluge of "multiple definition of `__foo'" errors.
176 `(("gcc" ,gcc-4.9)))
177 (supported-systems (list "i686-linux" "x86_64-linux"))
178 (home-page "https://www.memtest.org/")
179 (synopsis "Thorough real-mode memory tester")
180 (description
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.
185
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.
188
189 Memtest86+ cannot currently be used on computers booted with UEFI.")
190 (license license:gpl2)))
191
192 (define-public memtester
193 (package
194 (name "memtester")
195 (version "4.3.0")
196 (source
197 (origin
198 (method url-fetch)
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"))
202 (sha256
203 (base32 "127xymmyzb9r6dxqrwd69v7gf8csv8kv7fjvagbglf3wfgyy5pzr"))))
204 (build-system gnu-build-system)
205 (arguments
206 `(#:make-flags
207 (list ,(string-append "CC=" (cc-for-target)))
208 #:phases
209 (modify-phases %standard-phases
210 (replace 'configure
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")
216 (("^cc") "gcc"))
217 (substitute* "Makefile"
218 (("(INSTALLPATH.*=).*" _ assignment)
219 (string-append assignment out)))
220 #t)))
221 (replace 'check
222 ;; There is no test suite. Test some RAM for a single iteration.
223 (lambda _
224 (invoke "./memtester" "64K" "1"))))))
225 (home-page "http://pyropus.ca/software/memtester/")
226 (synopsis "User-space memory subsystem tester")
227 (description
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.
232
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.
236
237 It can also be told to test memory starting at a particular physical address.")
238 (license license:gpl2)))
239
240 (define-public msr-tools
241 (package
242 (name "msr-tools")
243 (version "1.3")
244 (source
245 (origin
246 (method url-fetch)
247 (uri (string-append "https://01.org/sites/default/files/downloads/"
248 name "/" name "-" version ".zip"))
249 (sha256
250 (base32 "07hxmddg0l31kjfmaq84ni142lbbvgq6391r8bd79wpm819pnigr"))))
251 (build-system gnu-build-system)
252 (arguments
253 `(#:make-flags
254 (list (string-append "sbindir=" (assoc-ref %outputs "out") "/sbin"))
255 #:phases
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")))
263 (mkdir-p sbin)
264 #t))))
265 #:tests? #f)) ; no test suite
266 (native-inputs
267 `(("unzip" ,unzip)))
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})")
272 (description
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:
275
276 @itemize
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
280 @end itemize
281
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.
284
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+
288
289 (define-public wavemon
290 (package
291 (name "wavemon")
292 (version "0.9.1")
293 (source
294 (origin
295 (method git-fetch)
296 (uri (git-reference
297 (url "https://github.com/uoaerg/wavemon")
298 (commit (string-append "v" version))))
299 (file-name (git-file-name name version))
300 (sha256
301 (base32 "109ycwnjjqc2vpnd8b86njfifczlxglnyv4rh2qmbn2i5nw2wryg"))))
302 (build-system gnu-build-system)
303 (arguments
304 `(#:make-flags
305 (list "CC=gcc"
306 ;; Makefile.in (ab)uses $(datadir) as $(docdir). Set it to Guix's
307 ;; standard --docdir since it's only used as such.
308 (string-append "datadir=" (assoc-ref %outputs "out")
309 "/share/doc/" ,name "-" ,version))
310 #:tests? #f)) ; no tests
311 (native-inputs
312 `(("pkg-config" ,pkg-config)))
313 (inputs
314 `(("libcap" ,libcap)
315 ("libnl" ,libnl)
316 ("ncurses" ,ncurses)))
317 (home-page "https://github.com/uoaerg/wavemon")
318 (synopsis "Wireless network device monitor")
319 (description
320 "Wavemon is a wireless device monitor with an interactive ncurses terminal
321 interface. It can display and plot signal and noise levels in real time. It
322 also reports packet statistics, device configuration, network parameters, and
323 access points and other wireless clients of your wireless network hardware.
324
325 Wavemon should work (with varying levels of detail and features) with any device
326 supported by the Linux kernel.")
327 ;; Source file headers still say GPL2+, but the authorial intent
328 ;; (from COPYING and the F9 'about' screen) is clearly GPL3+.
329 (license license:gpl3+)))
330
331 (define-public rkdeveloptool
332 (let ((commit "6e92ebcf8b1812da02663494a68972f956e490d3")
333 (revision "0"))
334 (package
335 (name "rkdeveloptool")
336 (version (git-version "1.3" revision commit))
337 (source
338 (origin
339 (method git-fetch)
340 (uri (git-reference
341 (url "https://github.com/rockchip-linux/rkdeveloptool")
342 (commit commit)))
343 (file-name (git-file-name name version))
344 (sha256
345 (base32 "0zwrkqfxd671iy69v3q0844gfdpm1yk51i9qh2rqc969bd8glxga"))))
346 (build-system gnu-build-system)
347 (native-inputs
348 `(("autoconf" ,autoconf)
349 ("automake" ,automake)
350 ("pkg-config" ,pkg-config)))
351 (inputs
352 `(("libusb" ,libusb)))
353 (home-page "https://github.com/rockchip-linux/rkdeveloptool")
354 (synopsis "Read from and write to RockChicp devices over USB")
355 (description
356 "Rkdeveloptool can read from and write to RockChip devices over USB, such
357 as the Pinebook Pro.")
358 (license license:gpl2+))))
359
360 (define-public libqb
361 (package
362 (name "libqb")
363 ;; NOTE: We are using a Release Candidate version (for 2.0) here because
364 ;; of the linker issues with the previous release.
365 (version "1.9.1")
366 (source (origin
367 (method url-fetch)
368 (uri (string-append
369 "https://github.com/ClusterLabs/libqb/releases/download/v"
370 version "/libqb-" version ".tar.xz"))
371 (sha256
372 (base32
373 "008vvw504kh40br5v2xkqavnp9vpmjvf768faqzv1d00fd53ingn"))))
374 (build-system gnu-build-system)
375 (native-inputs
376 `(("pkg-config" ,pkg-config)
377 ("xmllint" ,libxml2)))
378 (home-page "https://clusterlabs.github.io/libqb/")
379 (synopsis "Library providing high performance logging, tracing, ipc, and poll")
380 (description "Libqb is a library with the primary purpose of providing
381 high-performance, reusable features for client-server architecture, such as
382 logging, tracing, inter-process communication (IPC), and polling. Libqb is
383 not intended to be an all-encompassing library, but instead provide focused
384 APIs that are highly tuned for maximum performance for client-server
385 applications.")
386 (license license:lgpl2.1)))
387
388 (define-public usbguard
389 (package
390 (name "usbguard")
391 (version "0.7.8")
392 (source (origin
393 (method url-fetch)
394 (uri (string-append
395 "https://github.com/USBGuard/usbguard/releases/download/usbguard-"
396 version "/usbguard-" version ".tar.gz"))
397 (file-name (git-file-name name version))
398 (sha256
399 (base32 "1il5immqfxh2cj8wn1bfk7l42inflzgjf07yqprpz7r3lalbxc25"))))
400 (build-system gnu-build-system)
401 (arguments
402 `(#:phases
403 (modify-phases %standard-phases
404 (add-after 'unpack 'patch-build-scripts
405 (lambda* (#:key inputs #:allow-other-keys)
406 (substitute* "configure"
407 (("/usr/include/catch")
408 (string-append (assoc-ref inputs "catch") "/include")))
409 ;; Do not create log directory.
410 (substitute* "Makefile.in" ((".*/log/usbguard.*") ""))
411 ;; Disable LDAP tests: they use 'sudo'.
412 (substitute* "src/Tests/Makefile.in"
413 (("\\$\\(am__append_2\\)") ""))
414 #t))
415 (add-after 'install 'delete-static-library
416 (lambda* (#:key outputs #:allow-other-keys)
417 ;; It can't be direclty disabled since it's needed for the tests.
418 (delete-file (string-append (assoc-ref outputs "out")
419 "/lib/libusbguard.a"))
420 #t))
421 (add-after 'install 'install-zsh-completion
422 (lambda* (#:key outputs #:allow-other-keys)
423 (let* ((out (assoc-ref outputs "out"))
424 (site-functions
425 (string-append out "/share/zsh/site-functions")))
426 (mkdir-p site-functions)
427 (copy-file "scripts/usbguard-zsh-completion"
428 (string-append site-functions "/_usbguard"))
429 #t))))
430 #:make-flags
431 (list (string-append "BASH_COMPLETION_DIR="
432 (assoc-ref %outputs "out")
433 "/etc/bash_completion.d"))
434 #:configure-flags
435 (list
436 "--localstatedir=/var"
437 "--enable-systemd=no"
438 "--with-ldap"
439 "--with-dbus"
440 "--with-polkit")))
441 (inputs
442 `(("audit" ,audit)
443 ("catch" ,catch-framework)
444 ("dbus-glib" ,dbus-glib)
445 ("ldap" ,openldap)
446 ("libcap-ng" ,libcap-ng)
447 ("libseccomp" ,libseccomp)
448 ("libsodium" ,libsodium)
449 ("pegtl" ,pegtl)
450 ("polkit" ,polkit)
451 ("protobuf" ,protobuf)
452 ("libqb" ,libqb)))
453 (native-inputs
454 `(("asciidoc" ,asciidoc)
455 ("bash-completion" ,bash-completion)
456 ("gdbus-codegen" ,glib "bin")
457 ("umockdev" ,umockdev)
458 ("xmllint" ,libxml2)
459 ("xsltproc" ,libxslt)
460 ("pkg-config" ,pkg-config)))
461 (home-page "https://usbguard.github.io")
462 (synopsis "Helps to protect your computer against rogue USB devices (a.k.a. BadUSB)")
463 (description "USBGuard is a software framework for implementing USB device
464 authorization policies (what kind of USB devices are authorized) as well as
465 method of use policies (how a USB device may interact with the system).
466 Simply put, it is a USB device whitelisting tool.")
467 (license license:gpl2)))