gnu: Add msr-tools.
[jackhill/guix/guix.git] / gnu / packages / hardware.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2018 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 glib)
22 #:use-module (gnu packages libusb)
23 #:use-module (gnu packages linux)
24 #:use-module (gnu packages pkg-config)
25 #:use-module (gnu packages xdisorg)
26 #:use-module (gnu packages xorg)
27 #:use-module (guix build-system gnu)
28 #:use-module (guix download)
29 #:use-module ((guix licenses) #:prefix license:)
30 #:use-module (guix packages))
31
32 ;; This is a module for packages related to physical hardware that don't (yet)
33 ;; have a more specific home like gps.scm, security-token.scm, &c.
34
35 (define-public ddcutil
36 (package
37 (name "ddcutil")
38 (version "0.9.1")
39 (source
40 (origin
41 (method url-fetch)
42 (uri (string-append "https://www.ddcutil.com/tarballs/"
43 name "-" version ".tar.gz"))
44 (sha256
45 (base32 "1b4bm3zhk5vnad6fxf0mn8nrlj3fngifl7nzxgxw0n56hlv7ccv0"))))
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
65 ddcutil communicates directly with monitors implementing the Monitor Control
66 Command Set (@dfn{MCCS}). It usually does so through the the Display Data
67 Channel Command Interface (@dfn{DDC/CI}) protocol on the I2C bus, but can also
68 communicate over USB as per the USB Monitor Control Class Specification.
69
70 One particular use case is in colour profile management. Monitor calibration
71 is relative to the monitor colour settings currently in effect, e.g. red gain.
72 ddcutil allows colour-related settings to be saved at the time a monitor is
73 calibrated, and restored when the calibration is applied.")
74 (license (list license:bsd-3 ; FindDDCUtil.cmake
75 license:gpl2+)))) ; everything else
76
77 (define-public msr-tools
78 (package
79 (name "msr-tools")
80 (version "1.3")
81 (source
82 (origin
83 (method url-fetch)
84 (uri (string-append "https://01.org/sites/default/files/downloads/"
85 name "/" name "-" version ".zip"))
86 (sha256
87 (base32 "07hxmddg0l31kjfmaq84ni142lbbvgq6391r8bd79wpm819pnigr"))))
88 (build-system gnu-build-system)
89 (arguments
90 `(#:make-flags
91 (list (string-append "sbindir=" (assoc-ref %outputs "out") "/sbin"))
92 #:phases
93 (modify-phases %standard-phases
94 (delete 'configure) ; no configure script
95 (add-before 'install 'create-output-directory
96 (lambda* (#:key outputs #:allow-other-keys)
97 ;; 'make install' assumes that sbindir exists.
98 (let* ((out (assoc-ref outputs "out"))
99 (sbin (string-append out "/sbin")))
100 (mkdir-p sbin)
101 #t))))
102 #:tests? #f)) ; no test suite
103 (native-inputs
104 `(("unzip" ,unzip)))
105 ;; These registers and the CPUID instruction only exist on (most) x86 chips.
106 (supported-systems (list "i686-linux" "x86_64-linux"))
107 (home-page "https://01.org/msr-tools/")
108 (synopsis "Read and write Model-Specific Registers (@dfn{MSR})")
109 (description
110 "The MSR Tools project provides console utilities to directly access the
111 Model-Specific Registers (@dfn{MSR}s) and CPU ID of Intel-compatible processors:
112
113 @itemize
114 @item @command{cpuid}: show identification and feature information of any CPU
115 @item @command{rdmsr}: read MSRs from any CPU or all CPUs
116 @item @command{wrmsr}: write to MSRs on any CPU or all CPUs
117 @end itemize
118
119 These tools can be used to query and modify certain low-level CPU parameters,
120 such as the Turbo Boost ratio and Thermal Design Power (@dfn{TDP}) limits.
121
122 MSR addresses differ (greatly) between processors, and any such modification can
123 be dangerous and may void your CPU or system board's warranty.")
124 (license license:gpl2))) ; cpuid.c is gpl2, {rd,wr}msr.c are gpl2+