backlight: Just match amdgpu_bl prefix (#2122)

Some devices can have "amdgpu_bl1" or "amdgpu_bl2", but the code hardcoded in the value "amdgpu_bl0". This change tests based on the first characters: "amdgpu_bl".
This commit is contained in:
nicey0 2020-06-05 16:48:17 -03:00 committed by GitHub
parent 55b7533ed1
commit b8a1354117
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -51,7 +51,8 @@ namespace modules {
* The only sensible way is to use the 'brightness' file instead
* Ref: https://github.com/Alexays/Waybar/issues/335
*/
auto path_backlight_val = m_path_backlight + "/" + (card == "amdgpu_bl0" ? "brightness" : "actual_brightness");
std::string brightness_type = ((card.substr(0, 9) == "amdgpu_bl") ? "brightness" : "actual_brightness");
auto path_backlight_val = m_path_backlight + "/" + brightness_type;
m_val.filepath(path_backlight_val);
m_max.filepath(m_path_backlight + "/max_brightness");