hardware.scm 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2018, 2019 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. (define-module (gnu packages hardware)
  19. #:use-module (gnu packages compression)
  20. #:use-module (gnu packages gcc)
  21. #:use-module (gnu packages glib)
  22. #:use-module (gnu packages libusb)
  23. #:use-module (gnu packages linux)
  24. #:use-module (gnu packages ncurses)
  25. #:use-module (gnu packages pkg-config)
  26. #:use-module (gnu packages xdisorg)
  27. #:use-module (gnu packages xorg)
  28. #:use-module (guix build-system gnu)
  29. #:use-module (guix download)
  30. #:use-module (guix git-download)
  31. #:use-module ((guix licenses) #:prefix license:)
  32. #:use-module (guix packages))
  33. ;; This is a module for packages related to physical hardware that don't (yet)
  34. ;; have a more specific home like gps.scm, security-token.scm, &c.
  35. (define-public ddcutil
  36. (package
  37. (name "ddcutil")
  38. (version "0.9.4")
  39. (source
  40. (origin
  41. (method url-fetch)
  42. (uri (string-append "https://www.ddcutil.com/tarballs/"
  43. "ddcutil-" version ".tar.gz"))
  44. (sha256
  45. (base32 "1jqfip43sx3dnx86znmpy8dj4ikkfpgf8npgq66s7hqwwa99i7zc"))))
  46. (build-system gnu-build-system)
  47. (native-inputs
  48. `(("pkg-config" ,pkg-config)))
  49. (inputs
  50. `(("eudev" ,eudev)
  51. ("glib" ,glib)
  52. ("libdrm" ,libdrm) ; enhanced diagnostics
  53. ("libusb" ,libusb) ; support USB monitors
  54. ("libx11" ,libx11) ; enhanced diagnostics
  55. ("libxrandr" ,libxrandr)
  56. ("zlib" ,zlib)))
  57. (home-page "https://www.ddcutil.com/")
  58. (synopsis "Control external monitor settings")
  59. (description
  60. "ddcutil can query and modify most external monitors' settings, such as
  61. brightness, colour levels, and input sources. Generally speaking, any setting
  62. that can be changed by pressing buttons on the monitor can be modified by
  63. ddcutil.
  64. ddcutil communicates directly with monitors implementing the Monitor Control
  65. Command Set (@dfn{MCCS}). It usually does so through the the Display Data
  66. Channel Command Interface (@dfn{DDC/CI}) protocol on the I2C bus, but can also
  67. communicate over USB as per the USB Monitor Control Class Specification.
  68. One particular use case is in colour profile management. Monitor calibration
  69. is relative to the monitor colour settings currently in effect, e.g. red gain.
  70. ddcutil allows colour-related settings to be saved at the time a monitor is
  71. calibrated, and restored when the calibration is applied.")
  72. (license (list license:bsd-3 ; FindDDCUtil.cmake
  73. license:gpl2+)))) ; everything else
  74. ;; Distinct from memtest86, which is obsolete.
  75. (define-public memtest86+
  76. (package
  77. (name "memtest86+")
  78. ;; Update the description when/if UEFI support is released.
  79. (version "5.01")
  80. (source
  81. (origin
  82. (method url-fetch)
  83. (uri (string-append "https://www.memtest.org/download/5.01/memtest86+-"
  84. version ".tar.gz"))
  85. (sha256
  86. (base32 "0fch1l55753y6jkk0hj8f6vw4h1kinkn9ysp22dq5g9zjnvjf88l"))))
  87. (build-system gnu-build-system)
  88. (arguments
  89. `(#:system "i686-linux" ; the result runs outside of any OS
  90. #:tests? #f ; no way to test this
  91. #:phases
  92. (modify-phases %standard-phases
  93. (delete 'configure) ; no configure script
  94. (replace 'build
  95. ;; The default 'make all' does wonderful things, like scp(1) a file to
  96. ;; 192.168.0.12. Build the bootable images and nothing more.
  97. (lambda _
  98. (invoke "make"
  99. "memtest" ; ELF executable
  100. "memtest.bin"))) ; DOS/MBR boot sector
  101. (replace 'install
  102. (lambda* (#:key outputs #:allow-other-keys)
  103. (let* ((out (assoc-ref outputs "out"))
  104. (lib (string-append out "/lib/memtest86+"))
  105. (doc (string-append out "/share/doc/memtest86+-" ,version)))
  106. (for-each
  107. (lambda (file)
  108. (install-file file lib))
  109. (list "memtest"
  110. "memtest.bin"))
  111. (for-each
  112. (lambda (file)
  113. (install-file file doc))
  114. (list "FAQ"
  115. "README"))
  116. #t))))))
  117. (native-inputs
  118. ;; Newer GCCs fail with a deluge of "multiple definition of `__foo'" errors.
  119. `(("gcc" ,gcc-4.9)))
  120. (supported-systems (list "i686-linux" "x86_64-linux"))
  121. (home-page "https://www.memtest.org/")
  122. (synopsis "Thorough real-mode memory tester")
  123. (description
  124. "Memtest86+ is a thorough, stand-alone memory test for x86 systems. It
  125. repeatedly writes different patterns to all memory locations, reads them back
  126. again, and verifies whether the result is the same as what was written. This
  127. can help debug even intermittent and non-deterministic errors.
  128. It runs independently of any operating system, at computer boot-up, so that it
  129. can scan as much of your RAM as possible for hardware defects.
  130. Memtest86+ cannot currently be used on computers booted with UEFI.")
  131. (license license:gpl2)))
  132. (define-public memtester
  133. (package
  134. (name "memtester")
  135. (version "4.3.0")
  136. (source
  137. (origin
  138. (method url-fetch)
  139. ;; Even the latest release is available under 'old-versions/'.
  140. (uri (string-append "http://pyropus.ca/software/memtester/old-versions/"
  141. "memtester-" version ".tar.gz"))
  142. (sha256
  143. (base32 "127xymmyzb9r6dxqrwd69v7gf8csv8kv7fjvagbglf3wfgyy5pzr"))))
  144. (build-system gnu-build-system)
  145. (arguments
  146. `(#:make-flags
  147. (list "CC=gcc")
  148. #:phases
  149. (modify-phases %standard-phases
  150. (replace 'configure
  151. ;; This is a home-brewed configuration system where the cc/ld command
  152. ;; lines are stored in one-line files.
  153. (lambda* (#:key outputs #:allow-other-keys)
  154. (let* ((out (assoc-ref outputs "out")))
  155. (substitute* (list "conf-cc" "conf-ld")
  156. (("^cc") "gcc"))
  157. (substitute* "Makefile"
  158. (("(INSTALLPATH.*=).*" _ assignment)
  159. (string-append assignment out)))
  160. #t)))
  161. (replace 'check
  162. ;; There is no test suite. Test some RAM for a single iteration.
  163. (lambda _
  164. (invoke "./memtester" "64K" "1"))))))
  165. (home-page "http://pyropus.ca/software/memtester/")
  166. (synopsis "User-space memory subsystem tester")
  167. (description
  168. "Memtester stress-tests the memory subsystem of your operating system and
  169. computer. It repeatedly writes different patterns to all memory locations,
  170. reads them back again, and verifies whether the result is the same as what was
  171. written. This can help debug even intermittent and non-deterministic errors.
  172. Memtester runs entirely in user space. This means that you don't need to reboot
  173. to test your memory, but also that it's not possible to test all of the RAM
  174. installed in the system.
  175. It can also be told to test memory starting at a particular physical address.")
  176. (license license:gpl2)))
  177. (define-public msr-tools
  178. (package
  179. (name "msr-tools")
  180. (version "1.3")
  181. (source
  182. (origin
  183. (method url-fetch)
  184. (uri (string-append "https://01.org/sites/default/files/downloads/"
  185. name "/" name "-" version ".zip"))
  186. (sha256
  187. (base32 "07hxmddg0l31kjfmaq84ni142lbbvgq6391r8bd79wpm819pnigr"))))
  188. (build-system gnu-build-system)
  189. (arguments
  190. `(#:make-flags
  191. (list (string-append "sbindir=" (assoc-ref %outputs "out") "/sbin"))
  192. #:phases
  193. (modify-phases %standard-phases
  194. (delete 'configure) ; no configure script
  195. (add-before 'install 'create-output-directory
  196. (lambda* (#:key outputs #:allow-other-keys)
  197. ;; 'make install' assumes that sbindir exists.
  198. (let* ((out (assoc-ref outputs "out"))
  199. (sbin (string-append out "/sbin")))
  200. (mkdir-p sbin)
  201. #t))))
  202. #:tests? #f)) ; no test suite
  203. (native-inputs
  204. `(("unzip" ,unzip)))
  205. ;; These registers and the CPUID instruction only exist on (most) x86 chips.
  206. (supported-systems (list "i686-linux" "x86_64-linux"))
  207. (home-page "https://01.org/msr-tools/")
  208. (synopsis "Read and write Model-Specific Registers (@dfn{MSR})")
  209. (description
  210. "The MSR Tools project provides console utilities to directly access the
  211. Model-Specific Registers (@dfn{MSR}s) and CPU ID of Intel-compatible processors:
  212. @itemize
  213. @item @command{cpuid}: show identification and feature information of any CPU
  214. @item @command{rdmsr}: read MSRs from any CPU or all CPUs
  215. @item @command{wrmsr}: write to MSRs on any CPU or all CPUs
  216. @end itemize
  217. These tools can be used to query and modify certain low-level CPU parameters,
  218. such as the Turbo Boost ratio and Thermal Design Power (@dfn{TDP}) limits.
  219. MSR addresses differ (greatly) between processors, and any such modification can
  220. be dangerous and may void your CPU or system board's warranty.")
  221. (license license:gpl2))) ; cpuid.c is gpl2, {rd,wr}msr.c are gpl2+
  222. (define-public wavemon
  223. (package
  224. (name "wavemon")
  225. (version "0.9.0")
  226. (source
  227. (origin
  228. (method git-fetch)
  229. (uri (git-reference
  230. (url "https://github.com/uoaerg/wavemon.git")
  231. (commit (string-append "v" version))))
  232. (file-name (git-file-name name version))
  233. (sha256
  234. (base32 "07cid0h3mcyr74nnrzzf8k5n1p9a4y3wij43jbiaqmkpxilcc1i6"))))
  235. (build-system gnu-build-system)
  236. (arguments
  237. `(#:make-flags
  238. (list "CC=gcc"
  239. ;; Makefile.in (ab)uses $(datadir) as $(docdir). Set it to Guix's
  240. ;; standard --docdir since it's only used as such.
  241. (string-append "datadir=" (assoc-ref %outputs "out")
  242. "/share/doc/" ,name "-" ,version))
  243. #:tests? #f)) ; no tests
  244. (native-inputs
  245. `(("pkg-config" ,pkg-config)))
  246. (inputs
  247. `(("libcap" ,libcap)
  248. ("libnl" ,libnl)
  249. ("ncurses" ,ncurses)))
  250. (home-page "https://github.com/uoaerg/wavemon")
  251. (synopsis "Wireless network device monitor")
  252. (description
  253. "Wavemon is a wireless device monitor with an interactive ncurses terminal
  254. interface. It can display and plot signal and noise levels in real time. It
  255. also reports packet statistics, device configuration, network parameters, and
  256. access points and other wireless clients of your wireless network hardware.
  257. Wavemon should work (with varying levels of detail and features) with any device
  258. supported by the Linux kernel.")
  259. ;; Source file headers still say GPL2+, but the authorial intent
  260. ;; (from COPYING and the F9 'about' screen) is clearly GPL3+.
  261. (license license:gpl3+)))