瀏覽代碼

Rearrange and simplify text a bit, also put examples early

Most users want to see the examples as early as possible, so we place
them directly after the new (simplified) introduction.  The examples
have been rewritten to separate commands from options and grouping
the command with its value, where applicable.

The rest of the document has just been auto-filled to fit to < 72
columns and sections now use === and ---- for headings to make the
README more accessible from a terminal.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
Joachim Nilsson 6 年之前
父節點
當前提交
fd267b6d97
共有 1 個文件被更改,包括 136 次插入63 次删除
  1. 136
    63
      README.md

+ 136
- 63
README.md 查看文件

@@ -1,74 +1,97 @@
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 operating modes, value conversion and
31
+how to operate 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:
53 64
 
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
-```
65
+    light -k -s "input15::scrolllock" -S 100
59 66
 
67
+Usually, LEDs only take 0 or 1 in raw value (i.e. for off/on), so you
68
+can instead write:
60 69
 
61
-## Usage
70
+    light -kr -s "input15::scrolllock" -S 1
62 71
 
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).
72
+Verify by reading back the max brightness, you should get a value of 1:
64 73
 
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:
74
+    light -kr -m -s "input15::scrolllock
75
+
76
+
77
+Usage
78
+-----
79
+
80
+Light has 5 different criteria on flags to use: operation modes, value
81
+mode, target, field and controller mode.  Flags from these different
82
+modes can never be used in conjunction, i.e. you cannot get and set a
83
+value at the same time, that requires different invocations.
84
+
85
+**Note:** like most UNIX applications, light only print errors if you
86
+  are using it incorrectly. If something goes wrong, and you can't
87
+  figure out why, try setting the verbosity flag with -v:
66 88
 
67 89
 * 0: No debug output
68 90
 * 1: Errors
69 91
 * 2: Errors, warnings
70 92
 * 3: Errors, warnings, notices
71 93
 
94
+
72 95
 ### Operation modes
73 96
 
74 97
 The operation modes describe **what** you want to do.
@@ -81,16 +104,26 @@ The operation modes describe **what** you want to do.
81 104
 * -I: Restore the previously saved brightness (usually used on boot)
82 105
 * -L: List the available controllers
83 106
 
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.
107
+When used by themselves operate on the brightness of a controller that
108
+is selected automatically. S, A and U needs another argument -- except
109
+for the main 4 criteria -- which is the value to set/add/subtract.  This
110
+can be specified either in percent or in raw values, but remember to
111
+specify the value mode (read below) if you want to write raw values.
112
+
85 113
 
86 114
 ### Value modes
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
+The value mode specify in what unit you want to read or write values
117
+in. The default one (if not specified) is in percent, the other one is
118
+raw mode and should always be used when you need very precise values (or
119
+only have a controller with a very small amount of brightness levels).
89 120
 
90 121
 * -p: Percent
91 122
 * -r: Raw mode
92 123
 
93
-Remember, this is the unit that will be used when you set, get, add or subtract brightness values.
124
+Remember, this is the unit that will be used when you set, get, add or
125
+subtract brightness values.
126
+
94 127
 
95 128
 ### Target
96 129
 
@@ -99,50 +132,90 @@ You can choose which target to act on:
99 132
 * -l: Act on screen backlight
100 133
 * -k: Act on keyboard backlight and LEDs
101 134
 
135
+
102 136
 ### Field
103 137
 
104
-As you can not only handle the **brightness** of controllers, you may also specify a field to read/write from/to:
138
+As you can not only handle the **brightness** of controllers, you may
139
+also specify a field to read/write from/to:
105 140
 
106 141
 * -b: Current brightness of selected controller
107 142
 * -m: Maximum brightness of selected controller
108 143
 * -c: Minimum brightness (cap) of selected controller
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
+The minimum brightness is a feature implemented as some controllers make
146
+the screen go pitch black at 0%, if you have a controller like that, it
147
+is recommended to set this value (in percent or raw mode).  These values
148
+are saved in raw mode though, so if you specify it in percent it might
149
+not be too accurate depending on your controller.
150
+
111 151
 
112 152
 ### Controller modes
113 153
 
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). 
154
+Finally, you can either use the built-in controller selection to get the
155
+controller with the maximum precision, or you can specify one manually
156
+with the -s flag. The -a flag will force automatic mode and is
157
+default. Use -L to get a list of controllers to use with the -s flag (to
158
+specify which controller to use).
115 159
 
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.**
160
+**Note:** Without the `-s` flag on _every_ command light will default
161
+  to automatic controller selection.
117 162
 
118
-### Examples
119 163
 
120
-Get the current brightness in percent
164
+Installation
165
+------------
121 166
 
122
-`light -G`, or simply `light`
167
+### Arch Linux
123 168
 
124
-Increase brightness by 5 percent
169
+If you run Arch Linux, there exists 2 packages;
125 170
 
126
-`light -A 5`
171
+* [light-git][] - For the absolutely latest version
172
+* [light-tag][] - For the latest tagged release
127 173
 
128
-Set the minimum cap to 2 in raw value on the acpi_video0 controller:
174
+We recommend you go with light-git as you might miss important features
175
+and bugfixes if you do not.
129 176
 
130
-`light -Scrs "acpi_video0" 2`
131 177
 
132
-Try to set the brightness to 0 after that, it will be changed to the minimum 2
178
+### Manual
133 179
 
134
-`light -Srs "acpi_video0" 0`
180
+We recommended downloading a versioned tarball from the relases page on
181
+GitHub.  Download and untar the archive:
135 182
 
136
-Find keyboard controllers
183
+    tar xf light-x.yy.tar.gz
184
+    cd light-x.yy/
185
+    ./configure && make
186
+    sudo make install
137 187
 
138
-`light -Lk`
188
+However, should you want to try the latest GitHub source you first need
189
+to clone the repository and run the `autogen.sh` script.  This requires
190
+`automake` and `autoconf` to be installed on your system.
139 191
 
140
-Activate `ScrollLock` LED
192
+    ./autogen.sh
193
+    ./configure && make
194
+    sudo make install
195
+
196
+The `configure` script and `Makefile.in` files are not part of GIT
197
+because they are generated at release time with `make release`.
141 198
 
142
-`light -Sks "input15::scrolllock" 100`
143 199
 
144
-Usually, LEDs only take 0 or 1 in raw value (i.e. for off/on), so you can write
200
+### Permissions
201
+
202
+**Optional:** Instead of SUID root you can set up udev rules to manage
203
+   sysfs permissions, you may skip the `make install` step and instead
204
+   copy the file `90-backlight.rules` to `/etc/udev/rules.d/`:
145 205
 
146
-`light -Skrs "input15::scrolllock" 1`
147 206
 
148
-Verify this with `light -v3 -mkrs input15::scrolllock`, you should get a max. brightness of 1
207
+    ACTION=="add", SUBSYSTEM=="backlight", RUN+="/bin/chgrp video /sys/class/backlight/%k/brightness"
208
+    ACTION=="add", SUBSYSTEM=="backlight", RUN+="/bin/chmod g+w /sys/class/backlight/%k/brightness"
209
+
210
+
211
+Origin & References
212
+-------------------
213
+
214
+Copyright (C) 2012-2018 Fredrik Haikarainen
215
+
216
+This is free software, see the source for copying conditions.  There is NO
217
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE
218
+
219
+[Light]:     https://github.com/haikarainen/light
220
+[light-git]: https://aur.archlinux.org/packages/light-git
221
+[light-tag]: https://aur.archlinux.org/packages/light