diff options
-rw-r--r-- | hw/touchscreen/touchscreen.c | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/hw/touchscreen/touchscreen.c b/hw/touchscreen/touchscreen.c index 27cb139..3d718e2 100644 --- a/hw/touchscreen/touchscreen.c +++ b/hw/touchscreen/touchscreen.c @@ -25,7 +25,7 @@ #include <linux/limits.h> #include <dirent.h> -#include <hal/hal-touchscreen-interface.h> +#include <hal/hal-device-touchscreen-interface.h> #include <hal/hal-common-interface.h> #include <libsyscommon/file.h> @@ -36,7 +36,7 @@ #define TURNON_TOUCHSCREEN 1 #define TURNOFF_TOUCHSCREEN 0 -static int touchscreen_get_state(enum touchscreen_state *state) +static int touchscreen_get_state(hal_device_touchscreen_state_e *state) { int ret; int val; @@ -56,10 +56,10 @@ static int touchscreen_get_state(enum touchscreen_state *state) switch (val) { case TURNOFF_TOUCHSCREEN: - *state = TOUCHSCREEN_OFF; + *state = HAL_DEVICE_TOUCHSCREEN_OFF; break; case TURNON_TOUCHSCREEN: - *state = TOUCHSCREEN_ON; + *state = HAL_DEVICE_TOUCHSCREEN_ON; break; default: _E("Failed to get touchscreen state (%d)", val); @@ -69,7 +69,7 @@ static int touchscreen_get_state(enum touchscreen_state *state) return 0; } -static int touchscreen_set_state(enum touchscreen_state state) +static int touchscreen_set_state(hal_device_touchscreen_state_e state) { int ret; int val; @@ -79,10 +79,10 @@ static int touchscreen_set_state(enum touchscreen_state state) return -ENODEV; switch (state) { - case TOUCHSCREEN_OFF: + case HAL_DEVICE_TOUCHSCREEN_OFF: val = TURNOFF_TOUCHSCREEN; break; - case TOUCHSCREEN_ON: + case HAL_DEVICE_TOUCHSCREEN_ON: val = TURNON_TOUCHSCREEN; break; default: @@ -99,16 +99,19 @@ static int touchscreen_set_state(enum touchscreen_state state) static int touchscreen_init(void **data) { - hal_backend_touchscreen_funcs *touchscreen_funcs; + hal_backend_device_touchscreen_funcs *device_touchscreen_funcs; - touchscreen_funcs = calloc(1, sizeof(hal_backend_touchscreen_funcs)); - if (!touchscreen_funcs) - return -ENOMEM; + if (!data) { + _E("Invalid parameter"); + return -EINVAL; + } - touchscreen_funcs->get_state = touchscreen_get_state; - touchscreen_funcs->set_state = touchscreen_set_state; + device_touchscreen_funcs = *(hal_backend_device_touchscreen_funcs **) data; + if (!device_touchscreen_funcs) + return -EINVAL; - *data = (void *)touchscreen_funcs; + device_touchscreen_funcs->get_state = touchscreen_get_state; + device_touchscreen_funcs->set_state = touchscreen_set_state; return 0; } |