Add backlight(9) support for keyboard brightness.
Details
- Reviewers
wulf imp - Commits
- rG105869a2c78d: acpi_system76: Add backlight(9) support for keyboard
To set keyboard backlight via backlight(8)
% backlight -f /dev/backlight/backlight1 84 % sysctl hw.acpi.s76.keyboard_backlight hw.acpi.s76.keyboard_backlight: 224 % backlight -f /dev/backlight/backlight1 0 % sysctl hw.acpi.s76.keyboard_backlight hw.acpi.s76.keyboard_backlight: 0 % backlight -f /dev/backlight/backlight1 incr % backlight -f /dev/backlight/backlight1 brightness: 6 levels: 0 6 12 18 24 30 36 42 48 54 60 66 72 78 84 100 % backlight -f /dev/backlight/backlight1 decr % backlight -f /dev/backlight/backlight1 brightness: 0 levels: 0 6 12 18 24 30 36 42 48 54 60 66 72 78 84 100
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Passed - Unit
No Test Coverage - Build Status
Buildable 71257 Build 68140: arc lint + arc unit
Event Timeline
| sys/dev/acpi_support/acpi_system76.c | ||
|---|---|---|
| 470 | That is not enough to store only hardware value of brightness. You should keep users i.e. obtained via backlight(9) value too and convert one to another every time it has changed. Imagine that user's software increases brightness in 2 pct steps through backlight(9) interface. It wont work with current code as minimal step is 6 pct. | |
| sys/dev/acpi_support/acpi_system76.c | ||
|---|---|---|
| 470 | You're right. | |
| sys/dev/acpi_support/acpi_system76.c | ||
|---|---|---|
| 470 | IIRC setting of number of levels to zero enables all of them. | |
Address @wulf comments.
Test:
% backlight -f /dev/backlight/backlight1 brightness: 0 levels: 0 6 12 18 24 30 36 42 48 54 60 66 72 78 84 100 % backlight -f /dev/backlight/backlight1 + 5 % backlight -qf /dev/backlight/backlight1 brightness: 5 % sysctl hw.acpi.s76.keyboard_backlight hw.acpi.s76.keyboard_backlight: 0 % backlight -f /dev/backlight/backlight1 + 1 % sysctl hw.acpi.s76.keyboard_backlight hw.acpi.s76.keyboard_backlight: 16 % backlight -f /dev/backlight/backlight1 44 % backlight -qf /dev/backlight/backlight1 brightness: 44 % sysctl hw.acpi.s76.keyboard_backlight hw.acpi.s76.keyboard_backlight: 112 % sysctl hw.acpi.s76.keyboard_backlight=81 hw.acpi.s76.keyboard_backlight: 112 -> 81 % backlight -qf /dev/backlight/backlight1 brightness: 30
Also add suspend, resume, shutdown method.
suspend and resume depends on this revision.
shutdown is added to avoid panics AcpiNotify after kldunload.