|
@@ -1,148 +1,197 @@
|
1
|
|
-# Light
|
|
1
|
+Light - A Program to Control Backlight Controllers
|
|
2
|
+==================================================
|
2
|
3
|
|
3
|
|
-Copyright (C) 2012 - 2014, Fredrik Haikarainen
|
4
|
|
-This is free software, see the source for copying conditions. There is NO
|
5
|
|
-warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE
|
|
4
|
+- [Introduction](#introduction)
|
|
5
|
+- [Examples](#examples)
|
|
6
|
+- [Usage](#usage)
|
|
7
|
+ - [Operation modes](#operation-modes)
|
|
8
|
+ - [Value modes](#value-modes)
|
|
9
|
+ - [Target](#target)
|
|
10
|
+ - [Field](#field)
|
|
11
|
+ - [Controller modes](#controller-modes)
|
|
12
|
+- [Installation](#installation)
|
|
13
|
+ - [Arch Linux](#arch-linux)
|
|
14
|
+ - [Manual](#manual)
|
|
15
|
+ - [Permissions](#permissions)
|
|
16
|
+- [Origin & References](#origin--references)
|
6
|
17
|
|
7
|
18
|
|
8
|
|
-## Description
|
|
19
|
+Introduction
|
|
20
|
+------------
|
9
|
21
|
|
10
|
|
-Light is a program to control backlight controllers under GNU/Linux, it is the successor of lightscript, which was a bash script with the same purpose, and tries to maintain the same functionality.
|
|
22
|
+[Light][] is a program to control backlight controllers under GNU/Linux:
|
11
|
23
|
|
|
24
|
+* Works, in particular when other software, e.g. xbacklight, does not
|
|
25
|
+* Does not rely on X
|
|
26
|
+* Automatically detects the best controller
|
|
27
|
+* Possibility to set a minimum brightness value
|
12
|
28
|
|
13
|
|
-## Features
|
|
29
|
+Let's get started with a few examples, for details, see below for the
|
|
30
|
+full description of the different commands, options and how to access
|
|
31
|
+different controllers.
|
14
|
32
|
|
15
|
|
-* Works excellent where other software have been proven unusable or problematic, thanks to how it operates internally and the fact that it does not rely on X.
|
16
|
|
-* Can automatically figure out the best controller to use, making full use of underlying hardware.
|
17
|
|
-* Possibility to set a minimum brightness value, as some controllers set the screen to be pitch black at a vaĺue of 0 (or higher).
|
18
|
33
|
|
|
34
|
+Examples
|
|
35
|
+--------
|
19
|
36
|
|
20
|
|
-## Installation
|
|
37
|
+Get the current brightness in percent
|
21
|
38
|
|
22
|
|
-### Arch Linux
|
|
39
|
+ light -G
|
23
|
40
|
|
24
|
|
-If you run Arch Linux, there exists 2 packages;
|
25
|
|
-* [light-git](https://aur.archlinux.org/packages/light-git) - For the absolutely latest version
|
26
|
|
-* [light](https://aur.archlinux.org/packages/light) - For the latest tagged release
|
|
41
|
+or
|
27
|
42
|
|
28
|
|
-I recommend you go with light-git as you might miss important features and bugfixes if you do not.
|
|
43
|
+ light
|
29
|
44
|
|
30
|
|
-### Manual
|
|
45
|
+Increase brightness by 5 percent
|
31
|
46
|
|
32
|
|
-We recommended downloading a versioned tarball from the relases page on
|
33
|
|
-GitHub. Download and untar the archive:
|
|
47
|
+ light -A 5
|
34
|
48
|
|
35
|
|
- tar xf light-x.yy.tar.gz
|
36
|
|
- cd light-x.yy/
|
37
|
|
- ./configure && make
|
38
|
|
- sudo make install
|
|
49
|
+Set the minimum cap to 2 in raw value on the acpi_video0 controller:
|
39
|
50
|
|
40
|
|
-However, should you want to try the latest GitHub source you first need
|
41
|
|
-to clone the repository and run the `autogen.sh` script. This requires
|
42
|
|
-`automake` and `autoconf` to be installed on your system.
|
|
51
|
+ light -cr -s acpi_video0 -S 2
|
43
|
52
|
|
44
|
|
- ./autogen.sh
|
45
|
|
- ./configure && make
|
46
|
|
- sudo make install
|
|
53
|
+Try to set the brightness to 0 after that, it will be changed to the
|
|
54
|
+minimum 2:
|
47
|
55
|
|
48
|
|
-The `configure` script and `Makefile.in` files are not part of GIT
|
49
|
|
-because they are generated at release time with `make release`.
|
|
56
|
+ light -r -s acpi_video0 -S 0
|
50
|
57
|
|
|
58
|
+Find keyboard controllers:
|
51
|
59
|
|
52
|
|
-### Permissions
|
|
60
|
+ light -k -L
|
|
61
|
+
|
|
62
|
+Activate `ScrollLock` LED, here `input15` is used, but this varies
|
|
63
|
+between different systems:
|
|
64
|
+
|
|
65
|
+ light -k -s "input15::scrolllock" -S 100
|
|
66
|
+
|
|
67
|
+Usually, LEDs only take 0 or 1 in raw value (i.e. for off/on), so you
|
|
68
|
+can instead write:
|
|
69
|
+
|
|
70
|
+ light -kr -s "input15::scrolllock" -S 1
|
53
|
71
|
|
54
|
|
-**Optional:** If you want to use udev rules instead of suid to manage sysfs permissions, you may skip the `make install` step and instead add something like the following to `/etc/udev/rules.d/90-backlight.rules` after copying your binaries:
|
55
|
|
-```
|
56
|
|
-ACTION=="add", SUBSYSTEM=="backlight", RUN+="/bin/chgrp video /sys/class/backlight/%k/brightness"
|
57
|
|
-ACTION=="add", SUBSYSTEM=="backlight", RUN+="/bin/chmod g+w /sys/class/backlight/%k/brightness"
|
58
|
|
-```
|
|
72
|
+Verify by reading back the max brightness, you should get a value of 1:
|
59
|
73
|
|
|
74
|
+ light -kr -m -s "input15::scrolllock
|
60
|
75
|
|
61
|
|
-## Usage
|
62
|
76
|
|
63
|
|
-This application usually has 5 different criteria on flags to use, which are operation modes, value mode, target, field and controller mode. Flags from these different modes can never be used in conjunction, but all of them do not always have to be specified (although it is recommended to do so for verbosity).
|
|
77
|
+Usage
|
|
78
|
+-----
|
64
|
79
|
|
65
|
|
-**Note:** This application will only print errors if you are using it incorrectly. If something goes wrong, and you can't figure out why, try setting the verbosity flag with -v:
|
|
80
|
+### Commands
|
|
81
|
+
|
|
82
|
+* `-G`: Get (read) brightness/data from controllers/files
|
|
83
|
+* `-S VAL`: Set (write)brightness/data to controllers/files
|
|
84
|
+* `-A VAL`: Like `-S`, but adds the given value
|
|
85
|
+* `-U VAL`: Like `-S`, but subtracts the given value
|
|
86
|
+* `-O`: Save the current brightness for later use (usually used on shutdown)
|
|
87
|
+* `-I`: Restore the previously saved brightness (usually used on boot)
|
|
88
|
+* `-L`: List available controllers, see below `-k` option as well
|
|
89
|
+
|
|
90
|
+Without any options (below) the commands operate on the brightness of an
|
|
91
|
+automatically selected controller. Values are given in percent, unless
|
|
92
|
+the below `r` option is also given.
|
|
93
|
+
|
|
94
|
+**Note:** like most UNIX applications, light only gives output on
|
|
95
|
+ errors. If something goes wrong try the verbosity option `-v VAL`:
|
66
|
96
|
|
67
|
97
|
* 0: No debug output
|
68
|
98
|
* 1: Errors
|
69
|
99
|
* 2: Errors, warnings
|
70
|
100
|
* 3: Errors, warnings, notices
|
71
|
101
|
|
72
|
|
-### Operation modes
|
73
|
|
-
|
74
|
|
-The operation modes describe **what** you want to do.
|
|
102
|
+### Options
|
75
|
103
|
|
76
|
|
-* -G: Which **reads/gets** brightness/data from controllers/files
|
77
|
|
-* -S: Which **writes/sets** brightness/data to controllers/files
|
78
|
|
-* -A: Which does like -S but instead **adds** the value
|
79
|
|
-* -U: Which does like -S but instead '**subtracts** the value
|
80
|
|
-* -O: Save the current brightness for later use (usually used on shutdown)
|
81
|
|
-* -I: Restore the previously saved brightness (usually used on boot)
|
82
|
|
-* -L: List the available controllers
|
|
104
|
+Values may be given, or presented, in percent or raw mode. Raw mode is
|
|
105
|
+the format specific to the controller. The default is in percent, but
|
|
106
|
+raw mode may be required for precise control, or when the steps are very
|
|
107
|
+few, e.g. for most keyboard backlight controllers.
|
83
|
108
|
|
84
|
|
-When used by themselves operate on the brightness of a controller that is selected automatically. S, A and U needs another argument -- except for the main 4 criteria -- which is the value to set/add/subtract. This can be specified either in percent or in raw values, but remember to specify the value mode (read below) if you want to write raw values.
|
|
109
|
+* `-p`: Percent, default
|
|
110
|
+* `-r`: Raw mode
|
85
|
111
|
|
86
|
|
-### Value modes
|
|
112
|
+By default the screen is the active target for all commands, use `-k` to
|
|
113
|
+select the keyboard instead. In either case you may need to select a
|
|
114
|
+different controller, see below.
|
87
|
115
|
|
88
|
|
-The value mode specify in what unit you want to read or write values in. The default one (if not specified) is in percent, the other one is raw mode and should always be used when you need very precise values (or only have a controller with a very small amount of brightness levels).
|
|
116
|
+* `-l`: Act on screen backlight, default
|
|
117
|
+* `-k`: Act on keyboard backlight and LEDs
|
89
|
118
|
|
90
|
|
-* -p: Percent
|
91
|
|
-* -r: Raw mode
|
|
119
|
+By default commands act on the brightness property, which is read+write.
|
|
120
|
+The maximum brightness is a read-only property. The minimum brightness
|
|
121
|
+cap is a feature implemented to protect against setting brightness too
|
|
122
|
+low, since some controllers make the screen go pitch black at 0%. For
|
|
123
|
+controllers like that it is recommended to set this value.
|
92
|
124
|
|
93
|
|
-Remember, this is the unit that will be used when you set, get, add or subtract brightness values.
|
|
125
|
+* `-b`: Current brightness of selected controller, default
|
|
126
|
+* `-m`: Max. brightness of selected controller
|
|
127
|
+* `-c`: Min. brightness (cap) of selected controller (recommend raw mode)
|
94
|
128
|
|
95
|
|
-### Target
|
|
129
|
+Controller is automatically done to select the controller with maximum
|
|
130
|
+precision. It can however also be done manually and we recommend the
|
|
131
|
+`-L` and `-Lk` commands to list available controllers:
|
96
|
132
|
|
97
|
|
-You can choose which target to act on:
|
|
133
|
+* `-a`: Automatic controller selection
|
|
134
|
+* `-s ARG`: Manual controller selection
|
98
|
135
|
|
99
|
|
-* -l: Act on screen backlight
|
100
|
|
-* -k: Act on keyboard backlight and LEDs
|
|
136
|
+**Note:** Without the `-s` flag on _every_ command light will default
|
|
137
|
+ to automatic controller selection.
|
101
|
138
|
|
102
|
|
-### Field
|
103
|
139
|
|
104
|
|
-As you can not only handle the **brightness** of controllers, you may also specify a field to read/write from/to:
|
|
140
|
+Installation
|
|
141
|
+------------
|
105
|
142
|
|
106
|
|
-* -b: Current brightness of selected controller
|
107
|
|
-* -m: Maximum brightness of selected controller
|
108
|
|
-* -c: Minimum brightness (cap) of selected controller
|
|
143
|
+### Arch Linux
|
109
|
144
|
|
110
|
|
-The minimum brightness is a feature implemented as some controllers make the screen go pitch black at 0%, if you have a controller like that, it is recommended to set this value (in either percent or in raw mode). These values will be saved in raw mode though, so if you specify it in percent it might not be too accurate depending on your controller.
|
|
145
|
+If you run Arch Linux, there exists 2 packages;
|
111
|
146
|
|
112
|
|
-### Controller modes
|
|
147
|
+* [light-git][] - For the absolutely latest version
|
|
148
|
+* [light-tag][] - For the latest tagged release
|
113
|
149
|
|
114
|
|
-Finally, you can either use the built-in controller selection to get the controller with the maximum precision, or you can specify one manually with the -s flag. The -a flag will force automatic mode and is default. Use -L to get a list of controllers to use with the -s flag (to specify which controller to use).
|
|
150
|
+We recommend you go with light-git as you might miss important features
|
|
151
|
+and bugfixes if you do not.
|
115
|
152
|
|
116
|
|
-**Notice: You _need_ to include the `-s` or `-a` flag on _every_ command you run. The controller setting will _not_ be stored anywhere! If you do not use any of the flags, it will always default to automatic selection.**
|
117
|
153
|
|
118
|
|
-### Examples
|
|
154
|
+### Manual
|
119
|
155
|
|
120
|
|
-Get the current brightness in percent
|
|
156
|
+We recommended downloading a versioned tarball from the relases page on
|
|
157
|
+GitHub. Download and untar the archive:
|
121
|
158
|
|
122
|
|
-`light -G`, or simply `light`
|
|
159
|
+ tar xf light-x.yy.tar.gz
|
|
160
|
+ cd light-x.yy/
|
|
161
|
+ ./configure && make
|
|
162
|
+ sudo make install
|
123
|
163
|
|
124
|
|
-Increase brightness by 5 percent
|
|
164
|
+However, should you want to try the latest GitHub source you first need
|
|
165
|
+to clone the repository and run the `autogen.sh` script. This requires
|
|
166
|
+`automake` and `autoconf` to be installed on your system.
|
125
|
167
|
|
126
|
|
-`light -A 5`
|
|
168
|
+ ./autogen.sh
|
|
169
|
+ ./configure && make
|
|
170
|
+ sudo make install
|
127
|
171
|
|
128
|
|
-Set the minimum cap to 2 in raw value on the acpi_video0 controller:
|
|
172
|
+The `configure` script and `Makefile.in` files are not part of GIT
|
|
173
|
+because they are generated at release time with `make release`.
|
129
|
174
|
|
130
|
|
-`light -Scrs "acpi_video0" 2`
|
131
|
175
|
|
132
|
|
-Try to set the brightness to 0 after that, it will be changed to the minimum 2
|
|
176
|
+### Permissions
|
133
|
177
|
|
134
|
|
-`light -Srs "acpi_video0" 0`
|
|
178
|
+**Optional:** Instead of SUID root you can set up udev rules to manage
|
|
179
|
+ sysfs permissions, you may skip the `make install` step and instead
|
|
180
|
+ copy the file `90-backlight.rules` to `/etc/udev/rules.d/`:
|
135
|
181
|
|
136
|
|
-Find keyboard controllers
|
137
|
182
|
|
138
|
|
-`light -Lk`
|
|
183
|
+ ACTION=="add", SUBSYSTEM=="backlight", RUN+="/bin/chgrp video /sys/class/backlight/%k/brightness"
|
|
184
|
+ ACTION=="add", SUBSYSTEM=="backlight", RUN+="/bin/chmod g+w /sys/class/backlight/%k/brightness"
|
139
|
185
|
|
140
|
|
-Activate `ScrollLock` LED
|
141
|
186
|
|
142
|
|
-`light -Sks "input15::scrolllock" 100`
|
|
187
|
+Origin & References
|
|
188
|
+-------------------
|
143
|
189
|
|
144
|
|
-Usually, LEDs only take 0 or 1 in raw value (i.e. for off/on), so you can write
|
|
190
|
+Copyright (C) 2012-2018 Fredrik Haikarainen
|
145
|
191
|
|
146
|
|
-`light -Skrs "input15::scrolllock" 1`
|
|
192
|
+This is free software, see the source for copying conditions. There is NO
|
|
193
|
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE
|
147
|
194
|
|
148
|
|
-Verify this with `light -v3 -mkrs input15::scrolllock`, you should get a max. brightness of 1
|
|
195
|
+[Light]: https://github.com/haikarainen/light
|
|
196
|
+[light-git]: https://aur.archlinux.org/packages/light-git
|
|
197
|
+[light-tag]: https://aur.archlinux.org/packages/light
|