aboutsummaryrefslogtreecommitdiffstats
path: root/src/modules/temperature/e_mod_main.c
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2017-07-10 09:05:12 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2017-07-10 10:18:50 +0900
commit7caf5c8ff40ef0f2423f7f80a83686f56a331f80 (patch)
treea9ec32dfcf2090cf38c2aac297279e5a41a7320d /src/modules/temperature/e_mod_main.c
parente widget entry: fix the compilation warning (diff)
downloadenlightenment-7caf5c8ff40ef0f2423f7f80a83686f56a331f80.tar.gz
add new powersave features for supporting a live sleep mode
so new laptops now seem to no longer support S3 sleep. sleeping is done basically by going as idle as possible. you can ask the kernel to freeze execution BUT this seems to use about the same power as staying alive in my tests. to support this add 2 things: 1. a FREEZE powersave mode which implies we're alive but want to really stay as idle as absolutely possible. 2. powersave aware sleep functions that replace the usleeps in threads so they can switch from being super sleepy when in freeze mode to normal.
Diffstat (limited to 'src/modules/temperature/e_mod_main.c')
-rw-r--r--src/modules/temperature/e_mod_main.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/modules/temperature/e_mod_main.c b/src/modules/temperature/e_mod_main.c
index 61f6f1872..5e76d5919 100644
--- a/src/modules/temperature/e_mod_main.c
+++ b/src/modules/temperature/e_mod_main.c
@@ -57,6 +57,7 @@ _temperature_thread_free(Tempthread *tth)
#ifdef HAVE_EEZE
EINA_LIST_FREE(tth->tempdevs, s) eina_stringshare_del(s);
#endif
+ e_powersave_sleeper_free(tth->sleeper);
free(tth->extn);
free(tth);
}
@@ -328,7 +329,11 @@ _temperature_check_main(void *data, Ecore_Thread *th)
temp = temperature_tempget_get(tth);
if (ptemp != temp) ecore_thread_feedback(th, (void *)((long)temp));
ptemp = temp;
- usleep((1000000.0 / 8.0) * (double)tth->poll_interval);
+ e_powersave_sleeper_sleep(tth->sleeper, tth->poll_interval);
+ if (e_powersave_mode_get() == E_POWERSAVE_MODE_FREEZE)
+ usleep((1000000.0 / 800.0) * (double)tth->poll_interval);
+ else
+ usleep((1000000.0 / 8.0) * (double)tth->poll_interval);
if (ecore_thread_check(th)) break;
}
}
@@ -361,6 +366,7 @@ temperature_face_update_config(Config_Face *inst)
tth->poll_interval = inst->poll_interval;
tth->sensor_type = inst->sensor_type;
tth->inst = inst;
+ tth->sleeper = e_powersave_sleeper_new();
if (inst->sensor_name)
tth->sensor_name = eina_stringshare_add(inst->sensor_name);