raster pushed a commit to branch master. http://git.enlightenment.org/core/enlightenment.git/commit/?id=63bc2a809359d09e75268a7ac237f63313a26153
commit 63bc2a809359d09e75268a7ac237f63313a26153 Author: Carsten Haitzler (Rasterman) <ras...@rasterman.com> Date: Sat Sep 5 11:34:14 2020 +0100 backlight - support backlight on non-lid panels and bl_power too i didn't know bl_ppower existed... i found a device that exposes this sysfs node and it seems it's a good idea to swizzle it too in addition to brightness. so fix that and also fix e's backlight handling to find backlight devices for non-lid panels marked to have a backlight ... i have such a device here. this makes backlight controls work in this case. --- src/bin/e_backlight.c | 4 ++++ src/bin/system/e_system_backlight.c | 39 +++++++++++++++++++++++++++++++++++-- 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/src/bin/e_backlight.c b/src/bin/e_backlight.c index b1ccd7d6a..cb5962e76 100644 --- a/src/bin/e_backlight.c +++ b/src/bin/e_backlight.c @@ -350,6 +350,10 @@ _backlight_devices_screen_lid_get(void) { if (sc->info.is_lid) return sc; } + EINA_LIST_FOREACH(e_randr2->screens, l, sc) + { + if (sc->info.backlight) return sc; + } return NULL; } diff --git a/src/bin/system/e_system_backlight.c b/src/bin/system/e_system_backlight.c index 053a5997c..bb5ee7a56 100644 --- a/src/bin/system/e_system_backlight.c +++ b/src/bin/system/e_system_backlight.c @@ -21,8 +21,20 @@ _light_set(Light *lig, int val) lig->val = nval; #ifdef HAVE_EEZE char buf[PATH_MAX]; + int fd; + if (val == 0) + { + snprintf(buf, sizeof(buf), "%s/bl_power", lig->dev); + fd = open(buf, O_WRONLY); + if (fd >= 0) + { + if (write(fd, "4", 1) <= 0) + ERR("Write failed of [%s] to [%s]\n", "4", buf); + close(fd); + } + } snprintf(buf, sizeof(buf), "%s/brightness", lig->dev); - int fd = open(buf, O_WRONLY); + fd = open(buf, O_WRONLY); if (fd >= 0) { char buf2[32]; @@ -31,6 +43,17 @@ _light_set(Light *lig, int val) ERR("Write failed of [%s] to [%s]\n", buf2, buf); close(fd); } + if (val != 0) + { + snprintf(buf, sizeof(buf), "%s/bl_power", lig->dev); + fd = open(buf, O_WRONLY); + if (fd >= 0) + { + if (write(fd, "0", 1) <= 0) + ERR("Write failed of [%s] to [%s]\n", "0", buf); + close(fd); + } + } #elif defined(__FreeBSD_kernel__) sysctlbyname(lig->dev, NULL, NULL, &(lig->val), sizeof(lig->val)); #endif @@ -41,7 +64,19 @@ _light_get(Light *lig) { #ifdef HAVE_EEZE const char *s; - s = eeze_udev_syspath_get_sysattr(lig->dev, "brightness"); + s = eeze_udev_syspath_get_sysattr(lig->dev, "bl_power"); + if (s) + { + if (atoi(s) != 0) + { + lig->val = 0; + eina_stringshare_del(s); + return; + } + eina_stringshare_del(s); + } + s = eeze_udev_syspath_get_sysattr(lig->dev, "actual_brightness"); + if (!s) s = eeze_udev_syspath_get_sysattr(lig->dev, "brightness"); if (s) { lig->val = atoi(s); --