#include <libsyscommon/libgdbus.h>
#include <libsyscommon/list.h>
#include <libsyscommon/file.h>
+#include <device/power-internal.h>
#include "shared/devices.h"
#include "shared/log.h"
if (keycode != KEY_POWER)
return 0;
+ retval = clock_gettime(CLOCK_REALTIME, &ts);
+ if (retval == 0)
+ current_time_ms = (ts.tv_sec * 1000) + (ts.tv_nsec / 1000000);
+
sleep_enabled ^= 1; /* toggle status */
if (sleep_enabled) {
++sleep_id;
- retval = clock_gettime(CLOCK_REALTIME, &ts);
- if (retval == 0)
- current_time_ms = (ts.tv_sec * 1000) + (ts.tv_nsec / 1000000);
gdbus_signal_emit(NULL, DEVICED_PATH_POWER, DEVICED_INTERFACE_POWER,
"sleep", g_variant_new("(tt)", current_time_ms, sleep_id));
} else {
device_notify(DEVICE_NOTIFIER_REQUEST_DISABLE_AUTOSLEEP, NULL);
stop_sleep_wait();
+ gdbus_signal_emit(NULL, DEVICED_PATH_POWER, DEVICED_INTERFACE_POWER,
+ "wakeup", g_variant_new("(tt)", current_time_ms, DEVICE_SIG_WAKEUP_SHORTKEY));
}
return 0;