diff --git a/power/Android.mk b/power/Android.mk index f581ccd..3901072 100644 --- a/power/Android.mk +++ b/power/Android.mk @@ -20,6 +20,9 @@ include $(CLEAR_VARS) LOCAL_SRC_FILES := power-feature.c LOCAL_SHARED_LIBRARIES := liblog libcutils +LOCAL_HEADER_LIBRARIES := \ + generated_kernel_headers \ + libhardware_headers LOCAL_MODULE := libpower_feature.davinci LOCAL_MODULE_TAGS := optional diff --git a/power/power-feature.c b/power/power-feature.c index a9c8878..1834c35 100644 --- a/power/power-feature.c +++ b/power/power-feature.c @@ -14,10 +14,25 @@ * limitations under the License. */ +#include +#include + #include "power-feature.h" +#include +#include #include void set_device_specific_feature(feature_t feature, int state) { - // stub + switch (feature) { + case POWER_FEATURE_DOUBLE_TAP_TO_WAKE: { + int fd = open(TAP_TO_WAKE_EVENT_NODE, O_WRONLY); + struct input_event ev; + ev.type = EV_SYN; + ev.code = SYN_CONFIG; + ev.value = state ? INPUT_EVENT_WAKUP_MODE_ON : INPUT_EVENT_WAKUP_MODE_OFF; + write(fd, &ev, sizeof(ev)); + close(fd); + } + } } diff --git a/power/power-feature.h b/power/power-feature.h index 1d9e7db..3f2ab19 100644 --- a/power/power-feature.h +++ b/power/power-feature.h @@ -15,3 +15,8 @@ */ #define LOG_TAG "libpower_feature.davinci" + +#define TAP_TO_WAKE_EVENT_NODE "/dev/input/event2" + +#define INPUT_EVENT_WAKUP_MODE_OFF 4 +#define INPUT_EVENT_WAKUP_MODE_ON 5