summaryrefslogtreecommitdiff
path: root/src/lib/ecore_drm2/ecore_drm2_outputs.c
diff options
context:
space:
mode:
authorChris Michael <cp.michael@samsung.com>2017-06-06 10:37:01 -0400
committerChris Michael <cp.michael@samsung.com>2017-06-06 10:37:01 -0400
commit2f10ce10559692b862316b8bda4ecbadb3086b47 (patch)
tree8c1a125908d8ddb5e8ee09d39c35f41f9049cb21 /src/lib/ecore_drm2/ecore_drm2_outputs.c
parent81bcc14615b7437f1548cee415347bdfb22bbede (diff)
ecore-drm2: Add internal functions to get backlight values
Small patch to add an internal function which can be used to retrieve backlight values on output creation. Signed-off-by: Chris Michael <cp.michael@samsung.com>
Diffstat (limited to 'src/lib/ecore_drm2/ecore_drm2_outputs.c')
-rw-r--r--src/lib/ecore_drm2/ecore_drm2_outputs.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/lib/ecore_drm2/ecore_drm2_outputs.c b/src/lib/ecore_drm2/ecore_drm2_outputs.c
index 263fccd30d..4af738041a 100644
--- a/src/lib/ecore_drm2/ecore_drm2_outputs.c
+++ b/src/lib/ecore_drm2/ecore_drm2_outputs.c
@@ -466,6 +466,23 @@ err:
466} 466}
467#endif 467#endif
468 468
469static double
470_output_backlight_value_get(Ecore_Drm2_Output *output, const char *attr)
471{
472 const char *b = NULL;
473 double ret = 0.0;
474
475 if ((!output) || (!output->backlight.path)) return 0.0;
476
477 b = eeze_udev_syspath_get_sysattr(output->backlight.path, attr);
478 if (!b) return 0.0;
479
480 ret = strtod(b, NULL);
481 if (ret < 0) ret = 0.0;
482
483 return ret;
484}
485
469static void 486static void
470_output_backlight_init(Ecore_Drm2_Output *output, unsigned int conn_type) 487_output_backlight_init(Ecore_Drm2_Output *output, unsigned int conn_type)
471{ 488{
@@ -501,6 +518,10 @@ _output_backlight_init(Ecore_Drm2_Output *output, unsigned int conn_type)
501 { 518 {
502 output->backlight.type = type; 519 output->backlight.type = type;
503 output->backlight.path = eina_stringshare_add(dev); 520 output->backlight.path = eina_stringshare_add(dev);
521 output->backlight.max =
522 _output_backlight_value_get(output, "max_brightness");
523 output->backlight.value =
524 _output_backlight_value_get(output, "brightness");
504 } 525 }
505 526
506 EINA_LIST_FREE(devs, dev) 527 EINA_LIST_FREE(devs, dev)