plat: unix: correct backlight max_brightness path

We are assuming that device has its backlight device symlinked to /sys/class/backlight/backlight so this should be stated.

Additionally any hardcoding should be disallowed and the symlink should be always used.
This commit is contained in:
CTCaer 2021-06-09 13:16:37 +03:00
parent 3647bdef0f
commit 98be8f0c22
1 changed files with 4 additions and 4 deletions

View File

@ -1349,15 +1349,15 @@ static void frontend_unix_set_screen_brightness(int value)
char *buffer = NULL;
char svalue[16] = {0};
unsigned int max_brightness = 100;
#if !defined(HAVE_LAKKA_SWITCH)
filestream_read_file("/sys/devices/platform/backlight/backlight/backlight/max_brightness",
/* Device tree should have 'label = "backlight";' if control is desirable */
filestream_read_file("/sys/class/backlight/backlight/max_brightness",
&buffer, NULL);
if (buffer)
{
sscanf(buffer, "%u", &max_brightness);
free(buffer);
}
#endif
/* Calculate the brightness */
value = (value * max_brightness) / 100;