#include <errno.h>
#include <dlfcn.h>
#include <hal/device/hal-display.h>
+#include <libsyscommon/resource-manager.h>
+#include <system/syscommon-plugin-deviced-display-interface.h>
+#include <system/syscommon-plugin-deviced-common-interface.h>
#include "ambient-mode.h"
#include "core/log.h"
return -ENOENT;
}
- ret = display_backlight_get_max_brightness(&max);
+ ret = syscommon_resman_get_resource_attr_int(SYSCOMMON_RESOURCE_ID(DEVICED_RESOURCE_TYPE_DISPLAY),
+ DEVICED_DISPLAY_ATTR_INT_GET_MAX_BRIGHTNESS, &max);
if (ret < 0) {
_E("Failed to get max brightness.");
return ret;
#include <system/syscommon-plugin-deviced-display.h>
#include "shared/common.h"
+#include "display-backlight.h"
+
+static int get_max_brightness(int resource_id,
+ const struct syscommon_resman_resource_attribute *attr, void *data)
+{
+ int brightness = 0;
+ int ret = 0;
+
+ if (!data)
+ return -EINVAL;
+
+ ret = display_backlight_get_max_brightness(&brightness);
+ if (ret < 0)
+ return ret;
+
+ *(int *) data = brightness;
+
+ return 0;
+
+}
static const struct syscommon_resman_resource_attribute display_attrs[] = {
+ {
+ .name = "DEVICED_DISPLAY_ATTR_INT_GET_MAX_BRIGHTNESS",
+ .id = DEVICED_DISPLAY_ATTR_INT_GET_MAX_BRIGHTNESS,
+ .type = SYSCOMMON_RESMAN_DATA_TYPE_INT,
+ .flag = SYSCOMMON_RESMAN_RESOURCE_FLAG_PUBLIC,
+ .ops = {
+ .get = get_max_brightness,
+ .is_supported = syscommon_resman_resource_attr_supported_always
+ },
+ },
};
static const struct syscommon_resman_resource_driver deviced_display_driver = {