DSME_HANDLER(DSM_MSGTYPE_DBUS_DISCONNECT, client, msg) { dsme_log(LOG_DEBUG, "DBUS_DISCONNECT"); dsme_dbus_unbind_methods(&bound, methods, service, req_interface); } DSME_HANDLER(DSM_MSGTYPE_DSME_VERSION, server, msg) { if (!dsme_version) { dsme_version = g_strdup(DSMEMSG_EXTRA(msg)); } } module_fn_info_t message_handlers[] = { DSME_HANDLER_BINDING(DSM_MSGTYPE_STATE_CHANGE_IND), DSME_HANDLER_BINDING(DSM_MSGTYPE_SAVE_DATA_IND), DSME_HANDLER_BINDING(DSM_MSGTYPE_STATE_REQ_DENIED_IND), DSME_HANDLER_BINDING(DSM_MSGTYPE_DBUS_CONNECT), DSME_HANDLER_BINDING(DSM_MSGTYPE_DBUS_DISCONNECT), DSME_HANDLER_BINDING(DSM_MSGTYPE_DSME_VERSION), { 0 } }; void module_init(module_t* handle) { /* get dsme version so that we can report it over D-Bus if asked to */ DSM_MSGTYPE_GET_VERSION req = DSME_MSG_INIT(DSM_MSGTYPE_GET_VERSION); broadcast_internally(&req);
}; DSME_HANDLER(DSM_MSGTYPE_GET_VERSION, client, ind) { static const char* version = STRINGIFY(PRG_VERSION); DSM_MSGTYPE_DSME_VERSION msg = DSME_MSG_INIT(DSM_MSGTYPE_DSME_VERSION); dsme_log(LOG_DEBUG, "version requested, sending '%s'", version); endpoint_send_with_extra(client, &msg, strlen(version) + 1, version); } module_fn_info_t message_handlers[] = { DSME_HANDLER_BINDING(DSM_MSGTYPE_GET_VERSION), {0} }; void module_init(module_t *handle) { dsme_log(LOG_DEBUG, "DSME %s starting up", STRINGIFY(PRG_VERSION)); char * modulename; char * path; char name[1024]; /* TODO more dynamic length */ const char **names; FILE *conffile = fopen(MODULES_CONF, "r"); modulename = strdup(module_name(handle)); if (!modulename) {
{ dsme_log(LOG_DEBUG, PFIX"DBUS_CONNECT"); dsme_dbus_bind_signals(&bound, signals); #ifdef DSME_VIBRA_FEEDBACK dsme_ini_vibrafeedback(); #endif // DSME_VIBRA_FEEDBACK } DSME_HANDLER(DSM_MSGTYPE_DBUS_DISCONNECT, client, msg) { dsme_log(LOG_DEBUG, PFIX"DBUS_DISCONNECT"); dsme_dbus_unbind_signals(&bound, signals); } module_fn_info_t message_handlers[] = { DSME_HANDLER_BINDING(DSM_MSGTYPE_STATE_QUERY), DSME_HANDLER_BINDING(DSM_MSGTYPE_TELINIT), DSME_HANDLER_BINDING(DSM_MSGTYPE_SHUTDOWN_REQ), DSME_HANDLER_BINDING(DSM_MSGTYPE_POWERUP_REQ), DSME_HANDLER_BINDING(DSM_MSGTYPE_REBOOT_REQ), DSME_HANDLER_BINDING(DSM_MSGTYPE_SET_ALARM_STATE), DSME_HANDLER_BINDING(DSM_MSGTYPE_SET_USB_STATE), DSME_HANDLER_BINDING(DSM_MSGTYPE_SET_CHARGER_STATE), DSME_HANDLER_BINDING(DSM_MSGTYPE_SET_THERMAL_STATUS), DSME_HANDLER_BINDING(DSM_MSGTYPE_SET_EMERGENCY_CALL_STATE), DSME_HANDLER_BINDING(DSM_MSGTYPE_SET_BATTERY_STATE), DSME_HANDLER_BINDING(DSM_MSGTYPE_DBUS_CONNECT), DSME_HANDLER_BINDING(DSM_MSGTYPE_DBUS_DISCONNECT), {0} };
static bool bound = false; DSME_HANDLER(DSM_MSGTYPE_DBUS_CONNECT, client, msg) { dsme_log(LOG_DEBUG, "DBUS_CONNECT"); dsme_dbus_bind_signals(&bound, signals); } DSME_HANDLER(DSM_MSGTYPE_DBUS_DISCONNECT, client, msg) { dsme_log(LOG_DEBUG, "DBUS_DISCONNECT"); dsme_dbus_unbind_signals(&bound, signals); } module_fn_info_t message_handlers[] = { DSME_HANDLER_BINDING(DSM_MSGTYPE_DBUS_CONNECT), DSME_HANDLER_BINDING(DSM_MSGTYPE_DBUS_DISCONNECT), { 0 } }; void module_init(module_t* handle) { /* Do not connect to D-Bus; it is probably not started yet. * Instead, wait for DSM_MSGTYPE_DBUS_CONNECT. */ dsme_log(LOG_DEBUG, "libemergencycalltracker.so loaded"); } void module_fini(void) {
dsme_log(LOG_DEBUG, "removed process with closed socket from process wd"); } } /** * @ingroup processwd * DSME messages handled by process watchdog. * - DSM_MSGTYPE_PROCESSWD_CREATE Starts a process watchdog for connection sending * the event. dsmemsg_swwd_t * - DSM_MSGTYPE_PROCESSWD_DELETE Stop the watchdog for connection sending the * event. dsmemsg_swwd_t * - DSM_MSGTYPE_PONG The reply sent by a process for ping. dsmemsg_swwd_t * dsmemsg_timeout_change_t */ module_fn_info_t message_handlers[] = { DSME_HANDLER_BINDING(DSM_MSGTYPE_PROCESSWD_CREATE), DSME_HANDLER_BINDING(DSM_MSGTYPE_PROCESSWD_DELETE), DSME_HANDLER_BINDING(DSM_MSGTYPE_PROCESSWD_PONG), DSME_HANDLER_BINDING(DSM_MSGTYPE_WAKEUP), DSME_HANDLER_BINDING(DSM_MSGTYPE_CLOSE), {0} }; void module_init(module_t *handle) { dsme_log(LOG_DEBUG, "processwd.so loaded"); subscribe_to_wakeup(); } void module_fini(void)
} if (disk_space_running_out(msg)) { reaper_pid = reaper_process_new(); if (reaper_pid != -1) { g_child_watch_add(reaper_pid, temp_reaper_finished, temp_reaper_finished); dsme_log(LOG_INFO, "tempreaper: reaper process started (PID %i).", reaper_pid); } } } module_fn_info_t message_handlers[] = { DSME_HANDLER_BINDING(DSM_MSGTYPE_DISK_SPACE), { 0 } }; void module_init(module_t* module) { dsme_log(LOG_DEBUG, "tempreaper.so loaded"); } void module_fini(void) { if (reaper_pid != -1) { dsme_log(LOG_INFO, "killing temp reaper with pid %i", reaper_pid); kill(reaper_pid, SIGKILL); }
DSME_THERMAL_FLAG_FILE, strerror(errno)); } } DSME_HANDLER(DSM_MSGTYPE_SET_THERMAL_STATUS, client, thermal_state) { if (thermal_state->status == DSM_THERMAL_STATUS_OVERHEATED) { write_thermal_flag(); } else { /* don't remove DSME_THERMAL_FLAG_FILE */ } } module_fn_info_t message_handlers[] = { DSME_HANDLER_BINDING(DSM_MSGTYPE_SET_THERMAL_STATUS), { 0 } }; void module_init(module_t* handle) { dsme_log(LOG_DEBUG, "thermalflagger.so loaded"); remove_thermal_flag(); } void module_fini(void) { dsme_log(LOG_DEBUG, "thermalflagger.so unloaded"); }
case DSME_STATE_REBOOT: case DSME_STATE_MALF: force_save = true; break; default: break; } pot_update_cal(user_mode, force_save); in_user_mode = user_mode; } module_fn_info_t message_handlers[] = { DSME_HANDLER_BINDING(DSM_MSGTYPE_STATE_CHANGE_IND), DSME_HANDLER_BINDING(DSM_MSGTYPE_WAKEUP), DSME_HANDLER_BINDING(DSM_MSGTYPE_DBUS_CONNECT), DSME_HANDLER_BINDING(DSM_MSGTYPE_DBUS_DISCONNECT), { 0 } }; /* ========================================================================= * * Plugin init and fini * ========================================================================= */ void module_init(module_t* handle) { poweron_update_cb(); // QUARANTINE this_module = handle;
free(sender); } DSME_HANDLER(DSM_MSGTYPE_STATE_CHANGE_IND, conn, msg) { write_log("Received: dsme internal state", state_name(msg->state)); if (saved_shutdown_reason == SD_REASON_UNKNOWN) { if (msg->state == DSME_STATE_SHUTDOWN) saved_shutdown_reason = SD_SW_SHUTDOWN; else if (msg->state == DSME_STATE_REBOOT) saved_shutdown_reason = SD_SW_REBOOT; } } module_fn_info_t message_handlers[] = { DSME_HANDLER_BINDING(DSM_MSGTYPE_SHUTDOWN_REQ), DSME_HANDLER_BINDING(DSM_MSGTYPE_REBOOT_REQ), DSME_HANDLER_BINDING(DSM_MSGTYPE_SET_THERMAL_STATUS), DSME_HANDLER_BINDING(DSM_MSGTYPE_SET_BATTERY_STATE), DSME_HANDLER_BINDING(DSM_MSGTYPE_STATE_CHANGE_IND), {0} }; void module_init(module_t* handle) { dsme_log(LOG_DEBUG, "bootreasonlogger.so loaded"); log_startup(); saved_shutdown_reason = SD_REASON_UNKNOWN; }
} DSME_HANDLER(DSM_MSGTYPE_CHANGE_RUNLEVEL, conn, msg) { (void)change_runlevel(msg->runlevel); } DSME_HANDLER(DSM_MSGTYPE_SHUTDOWN, conn, msg) { shutdown(msg->runlevel); } module_fn_info_t message_handlers[] = { DSME_HANDLER_BINDING(DSM_MSGTYPE_CHANGE_RUNLEVEL), DSME_HANDLER_BINDING(DSM_MSGTYPE_SHUTDOWN), { 0 } }; void module_init(module_t* module) { dsme_log(LOG_DEBUG, "runlevel.so loaded"); } void module_fini(void) { dsme_log(LOG_DEBUG, "runlevel.so unloaded"); }