Loading healthd/healthd.cpp +8 −5 Original line number Diff line number Diff line Loading @@ -136,10 +136,14 @@ static void healthd_mode_nop_battery_update( struct android::BatteryProperties* /*props*/) { } int healthd_register_event(int fd, void (*handler)(uint32_t)) { int healthd_register_event(int fd, void (*handler)(uint32_t), EventWakeup wakeup) { struct epoll_event ev; ev.events = EPOLLIN | EPOLLWAKEUP; ev.events = EPOLLIN; if (wakeup == EVENT_WAKEUP_FD) ev.events |= EPOLLWAKEUP; ev.data.ptr = (void *)handler; if (epoll_ctl(epollfd, EPOLL_CTL_ADD, fd, &ev) == -1) { KLOG_ERROR(LOG_TAG, Loading Loading @@ -245,7 +249,7 @@ static void uevent_init(void) { } fcntl(uevent_fd, F_SETFL, O_NONBLOCK); if (healthd_register_event(uevent_fd, uevent_event)) if (healthd_register_event(uevent_fd, uevent_event, EVENT_WAKEUP_FD)) KLOG_ERROR(LOG_TAG, "register for uevent events failed\n"); } Loading @@ -268,7 +272,7 @@ static void wakealarm_init(void) { return; } if (healthd_register_event(wakealarm_fd, wakealarm_event)) if (healthd_register_event(wakealarm_fd, wakealarm_event, EVENT_WAKEUP_FD)) KLOG_ERROR(LOG_TAG, "Registration of wakealarm event failed\n"); Loading @@ -286,7 +290,6 @@ static void healthd_mainloop(void) { if (timeout < 0 || (mode_timeout > 0 && mode_timeout < timeout)) timeout = mode_timeout; nevents = epoll_wait(epollfd, events, eventct, timeout); if (nevents == -1) { if (errno == EINTR) continue; Loading healthd/healthd_mode_charger.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -839,7 +839,7 @@ void healthd_mode_charger_init(struct healthd_config* config) ret = ev_init(input_callback, charger); if (!ret) { epollfd = ev_get_epollfd(); healthd_register_event(epollfd, charger_event_handler); healthd_register_event(epollfd, charger_event_handler, EVENT_WAKEUP_FD); } struct animation* anim = init_animation(); Loading healthd/include/healthd/healthd.h +6 −1 Original line number Diff line number Diff line Loading @@ -73,9 +73,14 @@ struct healthd_config { bool (*screen_on)(android::BatteryProperties *props); }; enum EventWakeup { EVENT_NO_WAKEUP_FD, EVENT_WAKEUP_FD, }; // Global helper functions int healthd_register_event(int fd, void (*handler)(uint32_t)); int healthd_register_event(int fd, void (*handler)(uint32_t), EventWakeup wakeup = EVENT_NO_WAKEUP_FD); void healthd_battery_update(); android::status_t healthd_get_property(int id, struct android::BatteryProperty *val); Loading Loading
healthd/healthd.cpp +8 −5 Original line number Diff line number Diff line Loading @@ -136,10 +136,14 @@ static void healthd_mode_nop_battery_update( struct android::BatteryProperties* /*props*/) { } int healthd_register_event(int fd, void (*handler)(uint32_t)) { int healthd_register_event(int fd, void (*handler)(uint32_t), EventWakeup wakeup) { struct epoll_event ev; ev.events = EPOLLIN | EPOLLWAKEUP; ev.events = EPOLLIN; if (wakeup == EVENT_WAKEUP_FD) ev.events |= EPOLLWAKEUP; ev.data.ptr = (void *)handler; if (epoll_ctl(epollfd, EPOLL_CTL_ADD, fd, &ev) == -1) { KLOG_ERROR(LOG_TAG, Loading Loading @@ -245,7 +249,7 @@ static void uevent_init(void) { } fcntl(uevent_fd, F_SETFL, O_NONBLOCK); if (healthd_register_event(uevent_fd, uevent_event)) if (healthd_register_event(uevent_fd, uevent_event, EVENT_WAKEUP_FD)) KLOG_ERROR(LOG_TAG, "register for uevent events failed\n"); } Loading @@ -268,7 +272,7 @@ static void wakealarm_init(void) { return; } if (healthd_register_event(wakealarm_fd, wakealarm_event)) if (healthd_register_event(wakealarm_fd, wakealarm_event, EVENT_WAKEUP_FD)) KLOG_ERROR(LOG_TAG, "Registration of wakealarm event failed\n"); Loading @@ -286,7 +290,6 @@ static void healthd_mainloop(void) { if (timeout < 0 || (mode_timeout > 0 && mode_timeout < timeout)) timeout = mode_timeout; nevents = epoll_wait(epollfd, events, eventct, timeout); if (nevents == -1) { if (errno == EINTR) continue; Loading
healthd/healthd_mode_charger.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -839,7 +839,7 @@ void healthd_mode_charger_init(struct healthd_config* config) ret = ev_init(input_callback, charger); if (!ret) { epollfd = ev_get_epollfd(); healthd_register_event(epollfd, charger_event_handler); healthd_register_event(epollfd, charger_event_handler, EVENT_WAKEUP_FD); } struct animation* anim = init_animation(); Loading
healthd/include/healthd/healthd.h +6 −1 Original line number Diff line number Diff line Loading @@ -73,9 +73,14 @@ struct healthd_config { bool (*screen_on)(android::BatteryProperties *props); }; enum EventWakeup { EVENT_NO_WAKEUP_FD, EVENT_WAKEUP_FD, }; // Global helper functions int healthd_register_event(int fd, void (*handler)(uint32_t)); int healthd_register_event(int fd, void (*handler)(uint32_t), EventWakeup wakeup = EVENT_NO_WAKEUP_FD); void healthd_battery_update(); android::status_t healthd_get_property(int id, struct android::BatteryProperty *val); Loading