#define ON_COUNT 1
#define OFF_COUNT 1
-struct lbm_config {
- int on;
- int off;
- int on_count;
- int off_count;
-};
-
-struct lbm_config lbm_conf = {
- .on = ON_LUX,
- .off = OFF_LUX,
- .on_count = ON_COUNT,
- .off_count = OFF_COUNT,
-};
-
static int (*_default_action) (int);
static Ecore_Timer *alc_timeout_id = 0;
static Ecore_Timer *update_timeout;
static int min_brightness = PM_MIN_BRIGHTNESS;
static char *min_brightness_name = 0;
static int value_table[MAX_AUTOMATIC_COUNT];
-static int lbm_state = -1;
static bool update_working_position(void)
{
}
}
-static bool check_lbm(int lux, int setting)
-{
- static int on_count, off_count;
-
- if (lux < 0)
- return false;
-
- if (lbm_conf.on < 0 || lbm_conf.off < 0)
- return true;
-
- if (lux <= lbm_conf.on && lbm_state != true) {
- off_count = 0;
- on_count++;
- if (on_count >= lbm_conf.on_count || setting) {
- on_count = 0;
- lbm_state = true;
- _D("LBM is on");
- return true;
- }
- } else if (lux >= lbm_conf.off && lbm_state != false) {
- on_count = 0;
- off_count++;
- if (off_count >= lbm_conf.off_count || setting) {
- off_count = 0;
- lbm_state = false;
- _D("LBM is off");
- return true;
- }
- } else if (lux > lbm_conf.on && lux < lbm_conf.off) {
- off_count = 0;
- on_count = 0;
- }
-
- if (setting)
- return true;
-
- return false;
-}
-
static bool check_brightness_changed(int value)
{
int i;
} else {
fault_count = 0;
- if (!check_lbm((int)light_data.values[0], setting))
- return EINA_TRUE;
-
if (display_conf.continuous_sampling &&
!check_brightness_changed(value) && !setting)
return EINA_TRUE;
} else if (status == SETTING_BRIGHTNESS_AUTOMATIC_PAUSE) {
_I("auto brightness paused!");
disconnect_sensor();
- lbm_state = 0;
} else {
disconnect_sensor();
- lbm_state = 0;
/* escape dim state if it's in low battery.*/
set_brightness_changed_state();
return 0;
}
-static int lbm_load_config(struct parse_result *result, void *user_data)
-{
- struct lbm_config *c = user_data;
-
- _D("%s,%s,%s", result->section, result->name, result->value);
-
- if (!c)
- return -EINVAL;
-
- if (!MATCH(result->section, "LBM"))
- return 0;
-
- if (MATCH(result->name, "on")) {
- SET_CONF(c->on, atoi(result->value));
- _D("on lux is %d", c->on);
- } else if (MATCH(result->name, "off")) {
- SET_CONF(c->off, atoi(result->value));
- _D("off lux is %d", c->off);
- } else if (MATCH(result->name, "on_count")) {
- SET_CONF(c->on_count, atoi(result->value));
- _D("on count is %d", c->on_count);
- } else if (MATCH(result->name, "off_count")) {
- SET_CONF(c->off_count, atoi(result->value));
- _D("off count is %d", c->off_count);
- }
-
- return 0;
-}
-
static void exit_lsensor(void)
{
vconf_ignore_key_changed(VCONFKEY_SETAPPL_BRIGHTNESS_AUTOMATIC_INT,
display_info.set_autobrightness_min = set_autobrightness_min;
display_info.reset_autobrightness_min = reset_autobrightness_min;
- /* load configutation */
- ret = config_parse(BOARD_CONF_FILE, lbm_load_config, &lbm_conf);
- if (ret < 0)
- _W("Failed to load %s, %d Use default value!",
- BOARD_CONF_FILE, ret);
-
register_notifier(DEVICE_NOTIFIER_LCD, lcd_changed_cb);
register_notifier(DEVICE_NOTIFIER_BOOTING_DONE, booting_done_cb);
}