mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-10-27 23:30:47 +01:00
Brightness (Linux): fixes random built-in flag and stdout leak in DDC/CI detection (#2616)
DDC/CI results never set `builtin`, and FF_LIST_ADD does not zero the new element, so external monitors were reported as built-in or external at random. Set it to false, as the BSD DDC/CI backend does. FF_SUPPRESS_IO() was declared inside the `if (ffddca_init)` block, so its cleanup restored stdout before display detection ran and libddcutil trace lines could reach the output, ahead of `--format json` too. Declare it at function scope so it covers the whole detection, including the FF_DISABLE_DLOPEN build. Closes #2615
This commit is contained in:
@@ -58,6 +58,7 @@ Features:
|
||||
|
||||
Bugfixes:
|
||||
* Fixed Snapdragon X2 series model detection on Linux. (#2611, CPU / Linux)
|
||||
* Fixed external monitors detected via DDC/CI being randomly reported as built-in, and libddcutil trace messages occasionally leaking into the output and breaking `--format json`. (#2615, Brightness / Linux)
|
||||
* Fixed image logo caching, padding, and positioning issues, including an iTerm display bug. (Logo)
|
||||
* Fixed several Windows issues, including Windows Terminal font detection, redirected `--gen-config` output, and gamepad battery reporting for DualShock 4 and Switch controllers. (#2573, TerminalFont; Gamepad; General)
|
||||
* Fixed formatting and display issues, including ANSI-aware truncation, date/time formatting, and bright key/title colors. (Format / DateTime / Display)
|
||||
|
||||
@@ -98,10 +98,12 @@ static const char* detectWithDdcci([[maybe_unused]] FFBrightnessOptions* options
|
||||
FF_LIBRARY_LOAD_SYMBOL_MESSAGE(libddcutil, ddca_free_any_vcp_value)
|
||||
FF_LIBRARY_LOAD_SYMBOL_MESSAGE(libddcutil, ddca_close_display)
|
||||
|
||||
// libddcutil may print trace messages to stdout during display detection, not only in ddca_init
|
||||
FF_SUPPRESS_IO();
|
||||
|
||||
#ifndef FF_DISABLE_DLOPEN
|
||||
FF_LIBRARY_LOAD_SYMBOL_LAZY(libddcutil, ddca_init)
|
||||
if (ffddca_init) {
|
||||
FF_SUPPRESS_IO();
|
||||
// Ref: https://github.com/rockowitz/ddcutil/issues/344
|
||||
if (ffddca_init(nullptr, -1 /*DDCA_SYSLOG_NOT_SET*/, 1 /*DDCA_INIT_OPTIONS_DISABLE_CONFIG_FILE*/) < 0) {
|
||||
return "ddca_init() failed";
|
||||
@@ -148,6 +150,7 @@ static const char* detectWithDdcci([[maybe_unused]] FFBrightnessOptions* options
|
||||
brightness->max = max;
|
||||
brightness->min = 0;
|
||||
brightness->current = current;
|
||||
brightness->builtin = false;
|
||||
ffStrbufInitS(&brightness->name, display->model_name);
|
||||
}
|
||||
ffddca_close_display(handle);
|
||||
|
||||
Reference in New Issue
Block a user