summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2020-05-30 19:22:55 +0100
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2020-05-30 19:22:55 +0100
commit2d811cc9947b0fd06609c99844c3cbbcffd55ead (patch)
treee235102015b762c3ede0ec163f29c142f5950df7
parentadb376b23b98a4fa87120e973fe2bdfbeb9c4963 (diff)
e sys - also force e to exit on halt or reboot after a timeout.
also log more on what is going on...
-rw-r--r--src/bin/e_sys.c56
1 files changed, 49 insertions, 7 deletions
diff --git a/src/bin/e_sys.c b/src/bin/e_sys.c
index 9664a3677..ee917732a 100644
--- a/src/bin/e_sys.c
+++ b/src/bin/e_sys.c
@@ -55,6 +55,10 @@ static Ecore_Timer *_e_sys_screensaver_unignore_timer = NULL;
55 55
56static double resume_backlight; 56static double resume_backlight;
57 57
58static Ecore_Timer *_e_sys_suspend_delay_timer = NULL;
59static Ecore_Timer *_e_sys_hibernate_delay_timer = NULL;
60static Ecore_Timer *_e_sys_halt_reboot_timer = NULL;
61
58static Eina_Bool on_the_way_out = EINA_FALSE; 62static Eina_Bool on_the_way_out = EINA_FALSE;
59 63
60E_API int E_EVENT_SYS_SUSPEND = -1; 64E_API int E_EVENT_SYS_SUSPEND = -1;
@@ -396,12 +400,21 @@ e_sys_init(void)
396EINTERN int 400EINTERN int
397e_sys_shutdown(void) 401e_sys_shutdown(void)
398{ 402{
403 if (_e_sys_halt_reboot_timer)
404 ecore_timer_del(_e_sys_halt_reboot_timer);
405 if (_e_sys_suspend_delay_timer)
406 ecore_timer_del(_e_sys_suspend_delay_timer);
407 if (_e_sys_hibernate_delay_timer)
408 ecore_timer_del(_e_sys_hibernate_delay_timer);
399 if (_e_sys_resume_delay_timer) 409 if (_e_sys_resume_delay_timer)
400 ecore_timer_del(_e_sys_resume_delay_timer); 410 ecore_timer_del(_e_sys_resume_delay_timer);
401 if (_e_sys_screensaver_unignore_timer) 411 if (_e_sys_screensaver_unignore_timer)
402 ecore_timer_del(_e_sys_screensaver_unignore_timer); 412 ecore_timer_del(_e_sys_screensaver_unignore_timer);
403 if (_e_sys_acpi_handler) 413 if (_e_sys_acpi_handler)
404 ecore_event_handler_del(_e_sys_acpi_handler); 414 ecore_event_handler_del(_e_sys_acpi_handler);
415 _e_sys_halt_reboot_timer = NULL;
416 _e_sys_suspend_delay_timer = NULL;
417 _e_sys_hibernate_delay_timer = NULL;
405 _e_sys_resume_delay_timer = NULL; 418 _e_sys_resume_delay_timer = NULL;
406 _e_sys_screensaver_unignore_timer = NULL; 419 _e_sys_screensaver_unignore_timer = NULL;
407 _e_sys_acpi_handler = NULL; 420 _e_sys_acpi_handler = NULL;
@@ -988,7 +1001,6 @@ _e_sys_cb_acpi_event(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
988 return ECORE_CALLBACK_PASS_ON; 1001 return ECORE_CALLBACK_PASS_ON;
989} 1002}
990 1003
991static Ecore_Timer *_e_sys_suspend_delay_timer = NULL;
992static Eina_Bool 1004static Eina_Bool
993_e_sys_suspend_delay(void *data EINA_UNUSED) 1005_e_sys_suspend_delay(void *data EINA_UNUSED)
994{ 1006{
@@ -1020,7 +1032,6 @@ _e_sys_suspend_delay(void *data EINA_UNUSED)
1020 return EINA_FALSE; 1032 return EINA_FALSE;
1021} 1033}
1022 1034
1023static Ecore_Timer *_e_sys_hibernate_delay_timer = NULL;
1024static Eina_Bool 1035static Eina_Bool
1025_e_sys_hibernate_delay(void *data EINA_UNUSED) 1036_e_sys_hibernate_delay(void *data EINA_UNUSED)
1026{ 1037{
@@ -1035,6 +1046,14 @@ _e_sys_hibernate_delay(void *data EINA_UNUSED)
1035 return EINA_FALSE; 1046 return EINA_FALSE;
1036} 1047}
1037 1048
1049static Eina_Bool
1050_e_sys_halt_reboot(void *data EINA_UNUSED)
1051{
1052 _e_sys_halt_reboot_timer = NULL;
1053 ecore_main_loop_quit();
1054 return EINA_FALSE;
1055}
1056
1038static int 1057static int
1039_e_sys_action_do(E_Sys_Action a, char *param EINA_UNUSED, Eina_Bool raw) 1058_e_sys_action_do(E_Sys_Action a, char *param EINA_UNUSED, Eina_Bool raw)
1040{ 1059{
@@ -1101,15 +1120,26 @@ _e_sys_action_do(E_Sys_Action a, char *param EINA_UNUSED, Eina_Bool raw)
1101 { 1120 {
1102 if (raw) 1121 if (raw)
1103 { 1122 {
1123 printf("SSS: do actual halt...\n");
1104 _e_sys_begin_time = ecore_time_get(); 1124 _e_sys_begin_time = ecore_time_get();
1105 if (systemd_works) 1125 if (systemd_works)
1106 _e_sys_systemd_poweroff(); 1126 {
1127 printf("SSS: tell systemd to halt...\n");
1128 _e_sys_systemd_poweroff();
1129 }
1107 else 1130 else
1108 e_system_send("power-halt", NULL); 1131 {
1132 printf("SSS: tell e system service to halt...\n");
1133 e_system_send("power-halt", NULL);
1134 }
1135 if (!_e_sys_halt_reboot_timer)
1136 _e_sys_halt_reboot_timer = ecore_timer_add
1137 (1.0, _e_sys_halt_reboot, NULL);
1109 ret = 1; 1138 ret = 1;
1110 } 1139 }
1111 else 1140 else
1112 { 1141 {
1142 printf("SSS: begin halt...\n");
1113 ret = 0; 1143 ret = 0;
1114 _e_sys_begin_time = ecore_time_get(); 1144 _e_sys_begin_time = ecore_time_get();
1115 _e_sys_logout_begin(a, EINA_TRUE); 1145 _e_sys_logout_begin(a, EINA_TRUE);
@@ -1126,18 +1156,30 @@ _e_sys_action_do(E_Sys_Action a, char *param EINA_UNUSED, Eina_Bool raw)
1126 { 1156 {
1127 if (raw) 1157 if (raw)
1128 { 1158 {
1159 printf("SSS: do actual reboot...\n");
1129 _e_sys_begin_time = ecore_time_get(); 1160 _e_sys_begin_time = ecore_time_get();
1130 if (systemd_works) 1161 if (systemd_works)
1131 _e_sys_systemd_reboot(); 1162 {
1163 printf("SSS: tell systemd to reboot...\n");
1164 _e_sys_systemd_reboot();
1165 }
1132 else 1166 else
1133 e_system_send("power-reboot", NULL); 1167 {
1168 printf("SSS: tell e system service to reboot...\n");
1169 e_system_send("power-reboot", NULL);
1170 }
1171 if (!_e_sys_halt_reboot_timer)
1172 _e_sys_halt_reboot_timer = ecore_timer_add
1173 (1.0, _e_sys_halt_reboot, NULL);
1174 ret = 1;
1134 } 1175 }
1135 else 1176 else
1136 { 1177 {
1178 printf("SSS: begin reboot...\n");
1179 ret = 0;
1137 _e_sys_begin_time = ecore_time_get(); 1180 _e_sys_begin_time = ecore_time_get();
1138 _e_sys_logout_begin(a, EINA_TRUE); 1181 _e_sys_logout_begin(a, EINA_TRUE);
1139 } 1182 }
1140 ret = 1;
1141 } 1183 }
1142 break; 1184 break;
1143 1185