gnu: wavemon: Update to 0.9.1.
[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 ;;;
4 ;;; This file is part of GNU Guix.
5 ;;;
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.
10 ;;;
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.
15 ;;;
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/>.
18
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))
34
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.
37
38 (define-public ddcutil
39 (package
40 (name "ddcutil")
41 (version "0.9.8")
42 (source
43 (origin
44 (method url-fetch)
45 (uri (string-append "https://www.ddcutil.com/tarballs/"
46 "ddcutil-" version ".tar.gz"))
47 (sha256
48 (base32 "13ccxbqgyz4ah9jwbcylnfkgl8j3ida8xd00xkcq4xnfyyv5mg6v"))))
49 (build-system gnu-build-system)
50 (native-inputs
51 `(("pkg-config" ,pkg-config)))
52 (inputs
53 `(("eudev" ,eudev)
54 ("glib" ,glib)
55 ("libdrm" ,libdrm) ; enhanced diagnostics
56 ("libusb" ,libusb) ; support USB monitors
57 ("libx11" ,libx11) ; enhanced diagnostics
58 ("libxrandr" ,libxrandr)
59 ("zlib" ,zlib)))
60 (home-page "https://www.ddcutil.com/")
61 (synopsis "Control external monitor settings")
62 (description
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
66 ddcutil.
67
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.
72
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
79
80 ;; Distinct from memtest86, which is obsolete.
81 (define-public memtest86+
82 (package
83 (name "memtest86+")
84 ;; Update the description when/if UEFI support is released.
85 (version "5.01")
86 (source
87 (origin
88 (method url-fetch)
89 (uri (string-append "https://www.memtest.org/download/5.01/memtest86+-"
90 version ".tar.gz"))
91 (sha256
92 (base32 "0fch1l55753y6jkk0hj8f6vw4h1kinkn9ysp22dq5g9zjnvjf88l"))))
93 (build-system gnu-build-system)
94 (arguments
95 `(#:system "i686-linux" ; the result runs outside of any OS
96 #:tests? #f ; no way to test this
97 #:phases
98 (modify-phases %standard-phases
99 (delete 'configure) ; no configure script
100 (replace 'build
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.
103 (lambda _
104 (invoke "make"
105 "memtest" ; ELF executable
106 "memtest.bin"))) ; DOS/MBR boot sector
107 (replace 'install
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)))
112 (for-each
113 (lambda (file)
114 (install-file file lib))
115 (list "memtest"
116 "memtest.bin"))
117 (for-each
118 (lambda (file)
119 (install-file file doc))
120 (list "FAQ"
121 "README"))
122 #t))))))
123 (native-inputs
124 ;; Newer GCCs fail with a deluge of "multiple definition of `__foo'" errors.
125 `(("gcc" ,gcc-4.9)))
126 (supported-systems (list "i686-linux" "x86_64-linux"))
127 (home-page "https://www.memtest.org/")
128 (synopsis "Thorough real-mode memory tester")
129 (description
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.
134
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.
137
138 Memtest86+ cannot currently be used on computers booted with UEFI.")
139 (license license:gpl2)))
140
141 (define-public memtester
142 (package
143 (name "memtester")
144 (version "4.3.0")
145 (source
146 (origin
147 (method url-fetch)
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"))
151 (sha256
152 (base32 "127xymmyzb9r6dxqrwd69v7gf8csv8kv7fjvagbglf3wfgyy5pzr"))))
153 (build-system gnu-build-system)
154 (arguments
155 `(#:make-flags
156 (list "CC=gcc")
157 #:phases
158 (modify-phases %standard-phases
159 (replace 'configure
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")
165 (("^cc") "gcc"))
166 (substitute* "Makefile"
167 (("(INSTALLPATH.*=).*" _ assignment)
168 (string-append assignment out)))
169 #t)))
170 (replace 'check
171 ;; There is no test suite. Test some RAM for a single iteration.
172 (lambda _
173 (invoke "./memtester" "64K" "1"))))))
174 (home-page "http://pyropus.ca/software/memtester/")
175 (synopsis "User-space memory subsystem tester")
176 (description
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.
181
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.
185
186 It can also be told to test memory starting at a particular physical address.")
187 (license license:gpl2)))
188
189 (define-public msr-tools
190 (package
191 (name "msr-tools")
192 (version "1.3")
193 (source
194 (origin
195 (method url-fetch)
196 (uri (string-append "https://01.org/sites/default/files/downloads/"
197 name "/" name "-" version ".zip"))
198 (sha256
199 (base32 "07hxmddg0l31kjfmaq84ni142lbbvgq6391r8bd79wpm819pnigr"))))
200 (build-system gnu-build-system)
201 (arguments
202 `(#:make-flags
203 (list (string-append "sbindir=" (assoc-ref %outputs "out") "/sbin"))
204 #:phases
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")))
212 (mkdir-p sbin)
213 #t))))
214 #:tests? #f)) ; no test suite
215 (native-inputs
216 `(("unzip" ,unzip)))
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})")
221 (description
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:
224
225 @itemize
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
229 @end itemize
230
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.
233
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+
237
238 (define-public wavemon
239 (package
240 (name "wavemon")
241 (version "0.9.1")
242 (source
243 (origin
244 (method git-fetch)
245 (uri (git-reference
246 (url "https://github.com/uoaerg/wavemon.git")
247 (commit (string-append "v" version))))
248 (file-name (git-file-name name version))
249 (sha256
250 (base32 "109ycwnjjqc2vpnd8b86njfifczlxglnyv4rh2qmbn2i5nw2wryg"))))
251 (build-system gnu-build-system)
252 (arguments
253 `(#:make-flags
254 (list "CC=gcc"
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
260 (native-inputs
261 `(("pkg-config" ,pkg-config)))
262 (inputs
263 `(("libcap" ,libcap)
264 ("libnl" ,libnl)
265 ("ncurses" ,ncurses)))
266 (home-page "https://github.com/uoaerg/wavemon")
267 (synopsis "Wireless network device monitor")
268 (description
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.
273
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+)))