forked from enlightenment/enlightenment
e alert - in case of crash use e system in new alert mode
this forces all ddc/backlight devices to max when discovered so you can always see the alert.
This commit is contained in:
parent
5d6424e3bc
commit
bd97c74492
|
@ -243,7 +243,6 @@ main(int argc, char **argv)
|
||||||
else if (i == 3) exit_gdb = atoi(argv[i]);
|
else if (i == 3) exit_gdb = atoi(argv[i]);
|
||||||
else if (i == 4) backtrace_str = argv[i];
|
else if (i == 4) backtrace_str = argv[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(stderr, "exit_gdb: %i\n", exit_gdb);
|
fprintf(stderr, "exit_gdb: %i\n", exit_gdb);
|
||||||
|
|
||||||
s = getenv("E_TAINTED");
|
s = getenv("E_TAINTED");
|
||||||
|
@ -252,7 +251,20 @@ main(int argc, char **argv)
|
||||||
|
|
||||||
ecore_app_no_system_modules();
|
ecore_app_no_system_modules();
|
||||||
elm_init(argc, argv);
|
elm_init(argc, argv);
|
||||||
if (setup_display()) elm_run();
|
|
||||||
|
if (setup_display())
|
||||||
|
{
|
||||||
|
s = getenv("E_ALERT_SYSTEM_BIN");
|
||||||
|
if (s && s[0])
|
||||||
|
{
|
||||||
|
putenv("E_ALERT_BACKLIGHT_RESET=1");
|
||||||
|
ecore_exe_pipe_run
|
||||||
|
(s, ECORE_EXE_PIPE_READ | ECORE_EXE_PIPE_WRITE |
|
||||||
|
ECORE_EXE_NOT_LEADER | ECORE_EXE_TERM_WITH_PARENT, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
elm_run();
|
||||||
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -343,7 +343,10 @@ main(int argc, char **argv)
|
||||||
e_util_env_set("E_RESTART_OK", NULL);
|
e_util_env_set("E_RESTART_OK", NULL);
|
||||||
e_util_env_set("PANTS", "ON");
|
e_util_env_set("PANTS", "ON");
|
||||||
e_util_env_set("DESKTOP", "Enlightenment");
|
e_util_env_set("DESKTOP", "Enlightenment");
|
||||||
|
if (getenv("E_ALERT_FONT_DIR"))
|
||||||
|
e_util_env_set("E_ALERT_FONT_DIR", NULL);
|
||||||
|
if (getenv("E_ALERT_SYSTEM_BIN"))
|
||||||
|
e_util_env_set("E_ALERT_SYSTEM_BIN", NULL);
|
||||||
strshare = eina_stringshare_printf("%s/enlightenment_askpass",
|
strshare = eina_stringshare_printf("%s/enlightenment_askpass",
|
||||||
e_prefix_bin_get());
|
e_prefix_bin_get());
|
||||||
if (strshare)
|
if (strshare)
|
||||||
|
|
|
@ -576,7 +576,7 @@ main(int argc, char **argv)
|
||||||
int i, valgrind_mode = 0;
|
int i, valgrind_mode = 0;
|
||||||
int valgrind_tool = 0;
|
int valgrind_tool = 0;
|
||||||
int valgrind_gdbserver = 0;
|
int valgrind_gdbserver = 0;
|
||||||
char buf[8192], buf2[4096], **args, *home;
|
char buf[8192], buf2[4096], buf3[4096], **args, *home;
|
||||||
char valgrind_path[PATH_MAX] = "";
|
char valgrind_path[PATH_MAX] = "";
|
||||||
const char *valgrind_log = NULL;
|
const char *valgrind_log = NULL;
|
||||||
const char *bindir;
|
const char *bindir;
|
||||||
|
@ -709,6 +709,9 @@ main(int argc, char **argv)
|
||||||
snprintf(buf2, sizeof(buf2),
|
snprintf(buf2, sizeof(buf2),
|
||||||
"E_ALERT_FONT_DIR=%s/data/fonts", eina_prefix_data_get(pfx));
|
"E_ALERT_FONT_DIR=%s/data/fonts", eina_prefix_data_get(pfx));
|
||||||
putenv(buf2);
|
putenv(buf2);
|
||||||
|
snprintf(buf3, sizeof(buf3),
|
||||||
|
"E_ALERT_SYSTEM_BIN=%s/enlightenment/utils/enlightenment_system", eina_prefix_lib_get(pfx));
|
||||||
|
putenv(buf3);
|
||||||
|
|
||||||
if ((valgrind_mode || valgrind_tool) &&
|
if ((valgrind_mode || valgrind_tool) &&
|
||||||
!find_valgrind(valgrind_path, sizeof(valgrind_path)))
|
!find_valgrind(valgrind_path, sizeof(valgrind_path)))
|
||||||
|
|
|
@ -96,6 +96,8 @@ void *alloca (size_t);
|
||||||
|
|
||||||
#define ERR(args...) do { fprintf(stderr, "E_SYSTEM_ERR: "); fprintf(stderr, ##args); } while (0)
|
#define ERR(args...) do { fprintf(stderr, "E_SYSTEM_ERR: "); fprintf(stderr, ##args); } while (0)
|
||||||
|
|
||||||
|
extern Eina_Bool alert_backlight_reset;
|
||||||
|
|
||||||
extern uid_t uid;
|
extern uid_t uid;
|
||||||
extern gid_t gid;
|
extern gid_t gid;
|
||||||
|
|
||||||
|
|
|
@ -160,6 +160,14 @@ _light_add(const char *dev)
|
||||||
lig->max = 100;
|
lig->max = 100;
|
||||||
#endif
|
#endif
|
||||||
_devices = eina_list_append(_devices, lig);
|
_devices = eina_list_append(_devices, lig);
|
||||||
|
if (alert_backlight_reset)
|
||||||
|
{ // set brightness to max if alert mode is on
|
||||||
|
eina_lock_take(&_devices_lock);
|
||||||
|
lig->val_set = lig->max;
|
||||||
|
lig->set = EINA_TRUE;
|
||||||
|
eina_semaphore_release(&_worker_sem, 1);
|
||||||
|
eina_lock_release(&_devices_lock);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_EEZE
|
#ifdef HAVE_EEZE
|
||||||
|
@ -176,7 +184,7 @@ _light_device_include(const char *dev)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_light_refresh_devices(void)
|
_light_refresh_devices()
|
||||||
{
|
{
|
||||||
Light *lig;
|
Light *lig;
|
||||||
|
|
||||||
|
@ -260,9 +268,12 @@ _cb_bklight_list(void *data EINA_UNUSED, const char *params EINA_UNUSED)
|
||||||
static void
|
static void
|
||||||
_cb_bklight_refresh(void *data EINA_UNUSED, const char *params EINA_UNUSED)
|
_cb_bklight_refresh(void *data EINA_UNUSED, const char *params EINA_UNUSED)
|
||||||
{
|
{
|
||||||
|
Eina_Bool tmp = alert_backlight_reset;
|
||||||
|
alert_backlight_reset = EINA_FALSE;
|
||||||
eina_lock_take(&_devices_lock);
|
eina_lock_take(&_devices_lock);
|
||||||
_light_refresh_devices();
|
_light_refresh_devices();
|
||||||
eina_lock_release(&_devices_lock);
|
eina_lock_release(&_devices_lock);
|
||||||
|
alert_backlight_reset = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -302,9 +313,9 @@ done:
|
||||||
void
|
void
|
||||||
e_system_backlight_init(void)
|
e_system_backlight_init(void)
|
||||||
{
|
{
|
||||||
_light_refresh_devices();
|
|
||||||
eina_lock_new(&_devices_lock);
|
eina_lock_new(&_devices_lock);
|
||||||
eina_semaphore_new(&_worker_sem, 0);
|
eina_semaphore_new(&_worker_sem, 0);
|
||||||
|
_light_refresh_devices();
|
||||||
ecore_thread_feedback_run(_cb_worker, _cb_worker_message,
|
ecore_thread_feedback_run(_cb_worker, _cb_worker_message,
|
||||||
_cb_worker_end, _cb_worker_cancel,
|
_cb_worker_end, _cb_worker_cancel,
|
||||||
NULL, EINA_TRUE);
|
NULL, EINA_TRUE);
|
||||||
|
|
|
@ -285,6 +285,11 @@ _ddc_probe(void)
|
||||||
eina_lock_take(&_devices_lock);
|
eina_lock_take(&_devices_lock);
|
||||||
_devices = eina_list_append(_devices, d);
|
_devices = eina_list_append(_devices, d);
|
||||||
eina_lock_release(&_devices_lock);
|
eina_lock_release(&_devices_lock);
|
||||||
|
if (alert_backlight_reset)
|
||||||
|
{ // set brightness to max if alert mode is on
|
||||||
|
ddc_func.ddca_set_non_table_vcp_value
|
||||||
|
(ddc_dh[i], 0x10, 0, 100);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else free(d);
|
else free(d);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
#include "e_system.h"
|
#include "e_system.h"
|
||||||
|
|
||||||
|
Eina_Bool alert_backlight_reset = EINA_FALSE;
|
||||||
|
|
||||||
uid_t uid = -1; // uid of person running me
|
uid_t uid = -1; // uid of person running me
|
||||||
gid_t gid = -1; // gid of person running me
|
gid_t gid = -1; // gid of person running me
|
||||||
|
|
||||||
|
@ -275,6 +277,14 @@ _cb_idle_enterer(void *data EINA_UNUSED)
|
||||||
int
|
int
|
||||||
main(int argc EINA_UNUSED, const char **argv EINA_UNUSED)
|
main(int argc EINA_UNUSED, const char **argv EINA_UNUSED)
|
||||||
{
|
{
|
||||||
|
const char *s;
|
||||||
|
|
||||||
|
// special mode to reset all newly found bl devices to max on
|
||||||
|
// discovery because we were run by the e alert crash handler and
|
||||||
|
// the user needs to see it...
|
||||||
|
s = getenv("E_ALERT_BACKLIGHT_RESET");
|
||||||
|
if ((s) && (s[0] == '1')) alert_backlight_reset = EINA_TRUE;
|
||||||
|
|
||||||
setuid_setup();
|
setuid_setup();
|
||||||
|
|
||||||
ecore_app_no_system_modules();
|
ecore_app_no_system_modules();
|
||||||
|
|
Loading…
Reference in New Issue