diff options
| author | sumuel <samuel@yakubos.org> | 2026-08-17 20:44:55 +0000 |
|---|---|---|
| committer | sumuel <samuel@yakubos.org> | 2026-08-17 20:44:55 +0000 |
| commit | 76424950e373d3b04ac3dd13019151bfba3e8423 (patch) | |
| tree | 4c3cfdbda039e592b9186be3e28f8d7cfd439e8a /src/detection/brightness/brightness_nbsd.c | |
Add the files
Diffstat (limited to 'src/detection/brightness/brightness_nbsd.c')
| -rw-r--r-- | src/detection/brightness/brightness_nbsd.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/detection/brightness/brightness_nbsd.c b/src/detection/brightness/brightness_nbsd.c new file mode 100644 index 0000000..afd6656 --- /dev/null +++ b/src/detection/brightness/brightness_nbsd.c @@ -0,0 +1,26 @@ +#include "brightness.h" + +#include "common/sysctl.h" + +const char* ffDetectBrightness(FF_A_UNUSED FFBrightnessOptions* options, FFlist* result) { + // https://man.netbsd.org/NetBSD-10.1/acpiout.4#DESCRIPTION + char key[] = "hw.acpi.acpiout0.brightness"; + char* pn = key + strlen("hw.acpi.acpiout"); + + for (uint32_t i = 0; i <= 9; ++i) { + *pn = (char) ('0' + i); + int value = ffSysctlGetInt(key, -1); + if (value == -1) { + continue; + } + + FFBrightnessResult* brightness = FF_LIST_ADD(FFBrightnessResult, *result); + ffStrbufInitF(&brightness->name, "acpiout%d", i); + + brightness->max = 100; + brightness->min = 0; + brightness->current = value; + brightness->builtin = true; + } + return NULL; +} |