1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
4 ;;; This file is part of GNU Guix.
6 ;;; GNU Guix is free software; you can redistribute it and/or modify it
7 ;;; under the terms of the GNU General Public License as published by
8 ;;; the Free Software Foundation; either version 3 of the License, or (at
9 ;;; your option) any later version.
11 ;;; GNU Guix is distributed in the hope that it will be useful, but
12 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ;;; GNU General Public License for more details.
16 ;;; You should have received a copy of the GNU General Public License
17 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
19 (define-module (gnu packages hardware)
20 #:use-module (gnu packages compression)
21 #:use-module (gnu packages gcc)
22 #:use-module (gnu packages glib)
23 #:use-module (gnu packages libusb)
24 #:use-module (gnu packages linux)
25 #:use-module (gnu packages ncurses)
26 #:use-module (gnu packages pkg-config)
27 #:use-module (gnu packages xdisorg)
28 #:use-module (gnu packages xorg)
29 #:use-module (guix build-system gnu)
30 #:use-module (guix download)
31 #:use-module (guix git-download)
32 #:use-module ((guix licenses) #:prefix license:)
33 #:use-module (guix packages))
35 ;; This is a module for packages related to physical hardware that don't (yet)
36 ;; have a more specific home like gps.scm, security-token.scm, &c.
38 (define-public ddcutil
45 (uri (string-append "https://www.ddcutil.com/tarballs/"
46 "ddcutil-" version ".tar.gz"))
48 (base32 "18brwj54dkjylvpx7c6ksf7fzhdjffi60avyg7qbs8vw9awnsxqz"))))
49 (build-system gnu-build-system)
51 `(("pkg-config" ,pkg-config)))
55 ("libdrm" ,libdrm) ; enhanced diagnostics
56 ("libusb" ,libusb) ; support USB monitors
57 ("libx11" ,libx11) ; enhanced diagnostics
58 ("libxrandr" ,libxrandr)
60 (home-page "https://www.ddcutil.com/")
61 (synopsis "Control external monitor settings")
63 "ddcutil can query and modify most external monitors' settings, such as
64 brightness, colour levels, and input sources. Generally speaking, any setting
65 that can be changed by pressing buttons on the monitor can be modified by
68 ddcutil communicates directly with monitors implementing the Monitor Control
69 Command Set (@dfn{MCCS}). It usually does so through the the Display Data
70 Channel Command Interface (@dfn{DDC/CI}) protocol on the I2C bus, but can also
71 communicate over USB as per the USB Monitor Control Class Specification.
73 One particular use case is in colour profile management. Monitor calibration
74 is relative to the monitor colour settings currently in effect, e.g. red gain.
75 ddcutil allows colour-related settings to be saved at the time a monitor is
76 calibrated, and restored when the calibration is applied.")
77 (license (list license:bsd-3 ; FindDDCUtil.cmake
78 license:gpl2+)))) ; everything else
80 ;; Distinct from memtest86, which is obsolete.
81 (define-public memtest86+
84 ;; Update the description when/if UEFI support is released.
89 (uri (string-append "https://www.memtest.org/download/5.01/memtest86+-"
92 (base32 "0fch1l55753y6jkk0hj8f6vw4h1kinkn9ysp22dq5g9zjnvjf88l"))))
93 (build-system gnu-build-system)
95 `(#:system "i686-linux" ; the result runs outside of any OS
96 #:tests? #f ; no way to test this
98 (modify-phases %standard-phases
99 (delete 'configure) ; no configure script
101 ;; The default 'make all' does wonderful things, like scp(1) a file to
102 ;; 192.168.0.12. Build the bootable images and nothing more.
105 "memtest" ; ELF executable
106 "memtest.bin"))) ; DOS/MBR boot sector
108 (lambda* (#:key outputs #:allow-other-keys)
109 (let* ((out (assoc-ref outputs "out"))
110 (lib (string-append out "/lib/memtest86+"))
111 (doc (string-append out "/share/doc/memtest86+-" ,version)))
114 (install-file file lib))
119 (install-file file doc))
124 ;; Newer GCCs fail with a deluge of "multiple definition of `__foo'" errors.
126 (supported-systems (list "i686-linux" "x86_64-linux"))
127 (home-page "https://www.memtest.org/")
128 (synopsis "Thorough real-mode memory tester")
130 "Memtest86+ is a thorough, stand-alone memory test for x86 systems. It
131 repeatedly writes different patterns to all memory locations, reads them back
132 again, and verifies whether the result is the same as what was written. This
133 can help debug even intermittent and non-deterministic errors.
135 It runs independently of any operating system, at computer boot-up, so that it
136 can scan as much of your RAM as possible for hardware defects.
138 Memtest86+ cannot currently be used on computers booted with UEFI.")
139 (license license:gpl2)))
141 (define-public memtester
148 ;; Even the latest release is available under 'old-versions/'.
149 (uri (string-append "http://pyropus.ca/software/memtester/old-versions/"
150 "memtester-" version ".tar.gz"))
152 (base32 "127xymmyzb9r6dxqrwd69v7gf8csv8kv7fjvagbglf3wfgyy5pzr"))))
153 (build-system gnu-build-system)
158 (modify-phases %standard-phases
160 ;; This is a home-brewed configuration system where the cc/ld command
161 ;; lines are stored in one-line files.
162 (lambda* (#:key outputs #:allow-other-keys)
163 (let* ((out (assoc-ref outputs "out")))
164 (substitute* (list "conf-cc" "conf-ld")
166 (substitute* "Makefile"
167 (("(INSTALLPATH.*=).*" _ assignment)
168 (string-append assignment out)))
171 ;; There is no test suite. Test some RAM for a single iteration.
173 (invoke "./memtester" "64K" "1"))))))
174 (home-page "http://pyropus.ca/software/memtester/")
175 (synopsis "User-space memory subsystem tester")
177 "Memtester stress-tests the memory subsystem of your operating system and
178 computer. It repeatedly writes different patterns to all memory locations,
179 reads them back again, and verifies whether the result is the same as what was
180 written. This can help debug even intermittent and non-deterministic errors.
182 Memtester runs entirely in user space. This means that you don't need to reboot
183 to test your memory, but also that it's not possible to test all of the RAM
184 installed in the system.
186 It can also be told to test memory starting at a particular physical address.")
187 (license license:gpl2)))
189 (define-public msr-tools
196 (uri (string-append "https://01.org/sites/default/files/downloads/"
197 name "/" name "-" version ".zip"))
199 (base32 "07hxmddg0l31kjfmaq84ni142lbbvgq6391r8bd79wpm819pnigr"))))
200 (build-system gnu-build-system)
203 (list (string-append "sbindir=" (assoc-ref %outputs "out") "/sbin"))
205 (modify-phases %standard-phases
206 (delete 'configure) ; no configure script
207 (add-before 'install 'create-output-directory
208 (lambda* (#:key outputs #:allow-other-keys)
209 ;; 'make install' assumes that sbindir exists.
210 (let* ((out (assoc-ref outputs "out"))
211 (sbin (string-append out "/sbin")))
214 #:tests? #f)) ; no test suite
217 ;; These registers and the CPUID instruction only exist on (most) x86 chips.
218 (supported-systems (list "i686-linux" "x86_64-linux"))
219 (home-page "https://01.org/msr-tools/")
220 (synopsis "Read and write Model-Specific Registers (@dfn{MSR})")
222 "The MSR Tools project provides console utilities to directly access the
223 Model-Specific Registers (@dfn{MSR}s) and CPU ID of Intel-compatible processors:
226 @item @command{cpuid}: show identification and feature information of any CPU
227 @item @command{rdmsr}: read MSRs from any CPU or all CPUs
228 @item @command{wrmsr}: write to MSRs on any CPU or all CPUs
231 These tools can be used to query and modify certain low-level CPU parameters,
232 such as the Turbo Boost ratio and Thermal Design Power (@dfn{TDP}) limits.
234 MSR addresses differ (greatly) between processors, and any such modification can
235 be dangerous and may void your CPU or system board's warranty.")
236 (license license:gpl2))) ; cpuid.c is gpl2, {rd,wr}msr.c are gpl2+
238 (define-public wavemon
246 (url "https://github.com/uoaerg/wavemon.git")
247 (commit (string-append "v" version))))
248 (file-name (git-file-name name version))
250 (base32 "07cid0h3mcyr74nnrzzf8k5n1p9a4y3wij43jbiaqmkpxilcc1i6"))))
251 (build-system gnu-build-system)
255 ;; Makefile.in (ab)uses $(datadir) as $(docdir). Set it to Guix's
256 ;; standard --docdir since it's only used as such.
257 (string-append "datadir=" (assoc-ref %outputs "out")
258 "/share/doc/" ,name "-" ,version))
259 #:tests? #f)) ; no tests
261 `(("pkg-config" ,pkg-config)))
265 ("ncurses" ,ncurses)))
266 (home-page "https://github.com/uoaerg/wavemon")
267 (synopsis "Wireless network device monitor")
269 "Wavemon is a wireless device monitor with an interactive ncurses terminal
270 interface. It can display and plot signal and noise levels in real time. It
271 also reports packet statistics, device configuration, network parameters, and
272 access points and other wireless clients of your wireless network hardware.
274 Wavemon should work (with varying levels of detail and features) with any device
275 supported by the Linux kernel.")
276 ;; Source file headers still say GPL2+, but the authorial intent
277 ;; (from COPYING and the F9 'about' screen) is clearly GPL3+.
278 (license license:gpl3+)))