소스 검색

Update to reflect README.md

Fredrik Svantesson 5 년 전
부모
커밋
baa1c518eb
No account linked to committer's email
1개의 변경된 파일137개의 추가작업 그리고 60개의 파일을 삭제
  1. 137
    60
      index.md

+ 137
- 60
index.md 파일 보기

@@ -1,102 +1,179 @@
1
-# Light
1
+Light - A program to control backlights (and other hardware lights) in GNU/Linux
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
+*Copyright (C) 2012 - 2018*
6 5
 
6
+*Author: Fredrik Haikarainen*
7 7
 
8
-## Description
8
+*Contributor & Maintainer: Joachim Nilsson*
9 9
 
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.
10
+*This is free software, see the source for copying conditions.  There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE*
11 11
 
12 12
 
13
-## Features
13
+- [Introduction](#introduction)
14
+- [Examples](#examples)
15
+- [Usage](#usage)
16
+  - [Command options](#command-options)
17
+  - [Extra options](#extra-options)
18
+- [Installation](#installation)
19
+  - [Arch Linux](#arch-linux)
20
+  - [Fedora](#fedora)
21
+  - [Debian/Ubuntu](#debian)
22
+  - [NixOS/nix](#nix)
23
+  - [Manual](#manual)
24
+  - [Permissions](#permissions)
14 25
 
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 26
 
27
+Introduction
28
+------------
19 29
 
20
-## Installation
30
+[Light][] is a program to control backlights and other lights under GNU/Linux:
21 31
 
22
-### Arch Linux
32
+* Works where other software has proven unreliable (xbacklight etc.)
33
+* Works even in a fully CLI-environment, i.e. it does not rely on X
34
+* Provides functionality to automatically control backlights with the highest precision available
35
+* Extra features, like setting a minimum brightness value for controllers, or saving/restoring the value for poweroffs/boots.
23 36
 
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
37
+See the following sections for the detailed descriptions of all available commands, options and how to access different controllers.
27 38
 
28
-I recommend you go with light-git as you might miss important features and bugfixes if you do not.
39
+Light is available in many GNU/Linux distributions already.
29 40
 
30
-### Manual
31 41
 
32
-`make && make install`
42
+Examples
43
+--------
44
+
45
+Get the current backlight brightness in percent
46
+
47
+    light -G
48
+
49
+or
50
+
51
+     light
52
+
53
+Increase backlight brightness by 5 percent
54
+
55
+    light -A 5
33 56
 
34
-**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:
35
-```
36
-ACTION=="add", SUBSYSTEM=="backlight", RUN+="/bin/chgrp video /sys/class/backlight/%k/brightness"
37
-ACTION=="add", SUBSYSTEM=="backlight", RUN+="/bin/chmod g+w /sys/class/backlight/%k/brightness"
38
-```
57
+Set the minimum cap to 2 in raw value on the sysfs/backlight/acpi_video0 device:
39 58
 
59
+    light -Nrs "sysfs/backlight/acpi_video0" 2
40 60
 
41
-## Usage
61
+List available devices
42 62
 
43
-This application usually has 4 different criteria on flags to use, which are operation modes, value mode, target 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).
63
+    light -L
44 64
 
45
-**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:
65
+Activate the Num. Lock keyboard LED, here `sysfs/leds/input3::numlock` is used, but this varies
66
+between different systems:
46 67
 
47
-* 0: No debug output
48
-* 1: Errors
49
-* 2: Errors, warnings
50
-* 3: Errors, warnings, notices
68
+    light -Srs "sysfs/leds/input3::numlock" 1
51 69
 
52
-### Operation modes
53 70
 
54
-The operation modes describe **what** you want to do.
71
+Usage
72
+-----
55 73
 
56
-* -G: Which **reads/gets** brightness/data from controllers/files
57
-* -S: Which **writes/sets** brightness/data to controllers/files
58
-* -A: Which does like -S but instead **adds** the value
59
-* -U: Which does like -S but instead '**subtracts** the value
60
-* -O: Save the current brightness for later use (usually used on shutdown)
61
-* -I: Restore the previously saved brightness (usually used on boot)
62
-* -L: List the available controllers
74
+Usage follows the following pattern, where options are optional and the neccesity of value depends on the options used
75
+    
76
+    light [options] <value>
63 77
 
64
-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.
78
+### Command options
65 79
 
66
-### Value modes
80
+You may only specify one command flag at a time. These flags decide what the program will ultimately end up doing.
67 81
 
68
-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).
82
+*  `-H` Show help and exit
83
+*  `-V` Show program version and exit
84
+*  `-L` List available devices
85
+*  `-A` Increase brightness by value (value needed!)
86
+*  `-U` Decrease brightness by value (value needed!)
87
+*  `-S` Set brightness to value (value needed!)
88
+*  `-G` Get brightness
89
+*  `-N` Set minimum brightness to value (value needed!)
90
+*  `-P` Get minimum brightness
91
+*  `-O` Save the current brightness
92
+*  `-I` Restore the previously saved brightness
69 93
 
70
-* -p: Percent
71
-* -r: Raw mode
94
+Without any extra options, the command will operate on the device called `sysfs/backlight/auto`, which works as it's own device however it proxies the backlight device that has the highest controller resolution (read: highest precision). Values are interpreted and printed as percentage between 0.0 - 100.0.
95
+
96
+**Note:** If something goes wrong, you can find out by maxing out the verbosity flag by passing `-v 3` to the options. This will activate the logging of warnings, errors and notices. Light will never print these by default, as it is designed to primarily interface with other applications and not humanbeings directly.
97
+
98
+### Extra options
99
+
100
+These can be mixed, combined and matched after convenience. 
101
+
102
+* `-r` Raw mode, values (printed and interpreted from commandline) will be treated as integers in the controllers native range, instead of in percent.
103
+* `-v <verbosity>` Specifies the verbosity level. 0 is default and prints nothing. 1 prints only errors, 2 prints only errors and warnings, and 3 prints both errors, warnings and notices.
104
+* `-s <devicepath>` Specifies which device to work on. List available devices with the -L command. Full path is needed.
105
+
106
+
107
+Installation
108
+------------
109
+
110
+### Arch Linux
72 111
 
73
-Remember, this is the unit that will be used when you set, get, add or subtract brightness values.
112
+The latest stable release is available in official repos, install with:
113
+
114
+    pacman -S light
115
+
116
+Additionally, the latest development branch (master) is available on AUR: [light-git][]
117
+
118
+### Fedora
119
+
120
+Fedora already has light packaged in main repos, so just run:
121
+
122
+    dnf install light
123
+
124
+and you're good to go.
125
+
126
+### <a name="debian"></a>Debian/Ubuntu
127
+
128
+Pre-built .deb files, for the latest Ubuntu release, can be downloaded
129
+from the [GitHub](https://github.com/haikarainen/light/releases/) releases page.  If you want to build your own
130
+there is native support available in the GIT sources.  Clone and follow
131
+the development branch guidelines below followed by:
132
+
133
+    make deb
134
+
135
+### <a name="nix"></a>NixOS/nix
136
+
137
+You can add the following line to your `configuration.nix`:
138
+
139
+    programs.light.enable = true;
140
+
141
+For more detail on Backlight control in NixOS and setting system keybindings, visit the [NixOS Wiki page](https://nixos.wiki/wiki/Backlight)
142
+
143
+### Manual
74 144
 
75
-### Target
145
+If you download a stable release, these are the commands that will get you up and running:
76 146
 
77
-As you can not only handle the **brightness** of controllers, you may also specify a target to read/write from/to:
147
+    tar xf light-x.yy.tar.gz
148
+    cd light-x.yy/
149
+    ./configure && make
150
+    sudo make install
78 151
 
79
-* -b: Current brightness of selected controller
80
-* -m: Maximum brightness of selected controller
81
-* -c: Minimum brightness (cap) of selected controller
152
+However the latest development branch requires some extras. Clone the repository and run the `autogen.sh` script.  This requires that `automake` and `autoconf` is installed on your system.
82 153
 
83
-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.
154
+    ./autogen.sh
155
+    ./configure && make
156
+    sudo make install
84 157
 
85
-### Controller modes
158
+The `configure` script and `Makefile.in` files are not part of GIT because they are generated at release time with `make release`.
86 159
 
87
-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).
88 160
 
89
-### Examples
161
+### Permissions
90 162
 
91
-Get the current brightness in percent
163
+Optionally, instead of the classic SUID root mode of operation, udev rules can be set up to manage the kernel sysfs permissions.  Use the configure script to enable this mode of operation:
92 164
 
93
-`light -G`
165
+    ./configure --with-udev && make
166
+    sudo make install
94 167
 
95
-Increase brightness by 5 percent
168
+This installs the `90-backlight.rules` into `/usr/lib/udev/rules.d/`.
169
+If your udev rules are located elsewhere, use `--with-udev=PATH`.
96 170
 
97
-`light -A 5`
171
+**Note:** make sure that your user is part of the `video` group, otherwise you will not get access to the devices.
98 172
 
99
-Set the minimum cap to 2 in raw value on the acpi_video0 controller:
173
+**Note:** in this mode `light` runs unpriviliged, so the `/etc/light`
174
+directory (for cached settings) is not used, instead the per-user
175
+specific `~/.config/light` is used.
100 176
 
101
-`light -Scrs "acpi_video0" 2`
102 177
 
178
+[Light]:     https://github.com/haikarainen/light/
179
+[light-git]: https://aur.archlinux.org/packages/light-git