From 466f1a4db69b445a51f6a3f0cf3a826444491556 Mon Sep 17 00:00:00 2001 From: Denis Date: Sun, 17 Dec 2023 03:50:36 +0100 Subject: [PATCH 1/4] improving devices support --- dev_in.c | 10 ++++++++++ input_dev.h | 5 +++++ 2 files changed, 15 insertions(+) diff --git a/dev_in.c b/dev_in.c index c4104e1..c1a3da3 100644 --- a/dev_in.c +++ b/dev_in.c @@ -44,6 +44,8 @@ typedef struct dev_in_ev { struct ff_effect ff_effect; + void* user_data; + } dev_in_ev_t; typedef union dev_in_aggr { @@ -440,8 +442,10 @@ void* dev_in_thread_func(void *ptr) { &dev_in_data->input_dev_decl->dev[i]->filters.ev, &devices[i].dev.evdev ); + if (open_res == 0) { devices[i].type = DEV_IN_TYPE_EV; + devices[i].dev.evdev.user_data = dev_in_data->input_dev_decl->dev[i]->user_data; // device is now connected, query it in select FD_SET(libevdev_get_fd(devices[i].dev.evdev.evdev), &read_fds); @@ -457,6 +461,9 @@ void* dev_in_thread_func(void *ptr) { if (open_res == 0) { devices[i].type = DEV_IN_TYPE_IIO; + + // device is now connected, query it in select + FD_SET(dev_iio_get_buffer_fd(devices[i].dev.iio.iiodev), &read_fds); } } else if (d_type == input_dev_type_hidraw) { fprintf(stderr, "Device (hidraw) %zu not found -- Attempt reconnection for device %x:%x\n", i, dev_in_data->input_dev_decl->dev[i]->filters.hidraw.pid, dev_in_data->input_dev_decl->dev[i]->filters.hidraw.vid); @@ -471,6 +478,9 @@ void* dev_in_thread_func(void *ptr) { devices[i].dev.hidraw.callbacks = dev_in_data->input_dev_decl->dev[i]->map.hidraw_callbacks; devices[i].dev.hidraw.user_data = dev_in_data->input_dev_decl->dev[i]->user_data; devices[i].type = DEV_IN_TYPE_HIDRAW; + + // device is now connected, query it in select + FD_SET(dev_hidraw_get_fd(devices[i].dev.hidraw.hidrawdev), &read_fds); } } } diff --git a/input_dev.h b/input_dev.h index 377c689..f52e4be 100644 --- a/input_dev.h +++ b/input_dev.h @@ -55,6 +55,11 @@ typedef struct iio_settings { int8_t post_matrix[3][3]; } iio_settings_t; +typedef struct timer_filters { + char name[128]; + uint64_t ticktime_ms; +} timer_filters_t; + typedef struct input_dev { input_dev_type_t dev_type; From 71603dc4d60d5f70cfbedd21d067a827173fe6b5 Mon Sep 17 00:00:00 2001 From: Denis Date: Sun, 17 Dec 2023 15:48:17 +0100 Subject: [PATCH 2/4] WIP: timer implementation --- CMakeLists.txt | 2 ++ dev_in.c | 96 +++++++++++++++++++++++++++++++++++++++++++++++--- dev_timer.c | 60 +++++++++++++++++++++++++++++++ dev_timer.h | 18 ++++++++++ input_dev.h | 15 +++++++- legion_go.c | 4 ++- rog_ally.c | 39 +++++++++++++++++--- rogue_enemy.h | 1 + 8 files changed, 223 insertions(+), 12 deletions(-) create mode 100644 dev_timer.c create mode 100644 dev_timer.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 515d8aa..d662d5f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,6 +17,7 @@ set(THREADS_PREFER_PTHREAD_FLAG ON) find_package(Threads REQUIRED) add_executable(${ROGUE_EXECUTABLE_NAME} + dev_timer.c dev_evdev.c dev_iio.c dev_hidraw.c @@ -49,6 +50,7 @@ add_executable(${ALLINONE_EXECUTABLE_NAME} virt_mouse.c virt_kbd.c devices_status.c + dev_timer.c dev_evdev.c dev_iio.c dev_hidraw.c diff --git a/dev_in.c b/dev_in.c index c1a3da3..8ac7e0a 100644 --- a/dev_in.c +++ b/dev_in.c @@ -5,6 +5,7 @@ #include "message.h" #include "dev_evdev.h" #include "dev_iio.h" +#include "dev_timer.h" #include @@ -13,6 +14,7 @@ typedef enum dev_in_type { DEV_IN_TYPE_HIDRAW, DEV_IN_TYPE_IIO, DEV_IN_TYPE_EV, + DEV_IN_TYPE_TIMER, } dev_in_type_t; typedef struct dev_in_iio { @@ -44,14 +46,27 @@ typedef struct dev_in_ev { struct ff_effect ff_effect; + ev_callbacks_t callbacks; + void* user_data; } dev_in_ev_t; +typedef struct dev_in_timer { + + dev_timer_t* timer; + + timer_callbacks_t callbacks; + + void* user_data; + +} dev_in_timer_t; + typedef union dev_in_aggr { dev_in_ev_t evdev; dev_in_iio_t iio; dev_in_hidraw_t hidraw; + dev_in_timer_t timer; } dev_in_aggr_t; typedef struct dev_in { @@ -157,6 +172,23 @@ fill_message_from_evdev_err_completed: return res; } +static int timer_open_device( + const dev_in_settings_t *const in_settings, + const timer_filters_t *const in_filters, + dev_in_timer_t *const out_dev +) { + int res = dev_timer_open(in_filters, &out_dev->timer); + if (res != 0) { + fprintf(stderr, "Unable to open the timer device: %d\n", res); + goto timer_open_device_err; + } + + printf("Opened timer device: %s\n", in_filters->name); + +timer_open_device_err: + return res; +} + static int hidraw_open_device( const dev_in_settings_t *const in_settings, const hidraw_filters_t *const in_filters, @@ -272,6 +304,10 @@ static void hidraw_close_device(dev_in_hidraw_t *const out_hidraw) { dev_hidraw_close(out_hidraw->hidrawdev); } +static void timer_close_device(dev_in_timer_t *const out_hidraw) { + dev_timer_close(out_hidraw->timer); +} + static void handle_rumble_device(const dev_in_settings_t *const conf, dev_in_ev_t *const in_dev, const out_message_rumble_t *const in_rumble_msg) { if (!in_dev->has_rumble_support) { return; @@ -446,6 +482,7 @@ void* dev_in_thread_func(void *ptr) { if (open_res == 0) { devices[i].type = DEV_IN_TYPE_EV; devices[i].dev.evdev.user_data = dev_in_data->input_dev_decl->dev[i]->user_data; + devices[i].dev.evdev.callbacks = dev_in_data->input_dev_decl->dev[i]->map.ev_callbacks; // device is now connected, query it in select FD_SET(libevdev_get_fd(devices[i].dev.evdev.evdev), &read_fds); @@ -482,6 +519,23 @@ void* dev_in_thread_func(void *ptr) { // device is now connected, query it in select FD_SET(dev_hidraw_get_fd(devices[i].dev.hidraw.hidrawdev), &read_fds); } + } else if (d_type == input_dev_type_timer) { + fprintf(stderr, "Device (timer) %zu not found -- Attempt to create it with name %s\n", i, dev_in_data->input_dev_decl->dev[i]->filters.timer.name); + + const int open_res = timer_open_device( + &dev_in_data->settings, + &dev_in_data->input_dev_decl->dev[i]->filters.timer, + &devices[i].dev.timer + ); + + if (open_res == 0) { + devices[i].dev.timer.callbacks = dev_in_data->input_dev_decl->dev[i]->map.timer_callbacks; + devices[i].dev.timer.user_data = dev_in_data->input_dev_decl->dev[i]->user_data; + devices[i].type = DEV_IN_TYPE_TIMER; + + // device is now connected, query it in select + FD_SET(dev_timer_get_fd(devices[i].dev.timer.timer), &read_fds); + } } } } @@ -544,6 +598,8 @@ void* dev_in_thread_func(void *ptr) { fd = dev_iio_get_buffer_fd(devices[i].dev.iio.iiodev); } else if (devices[i].type == DEV_IN_TYPE_HIDRAW) { fd = dev_hidraw_get_fd(devices[i].dev.hidraw.hidrawdev); + } else if (devices[i].type == DEV_IN_TYPE_TIMER) { + fd = dev_timer_get_fd(devices[i].dev.timer.timer); } else { continue; } @@ -570,12 +626,12 @@ void* dev_in_thread_func(void *ptr) { continue; } - controller_msg_count = dev_in_data->input_dev_decl->dev[i]->map.ev_input_map_fn( + controller_msg_count = devices[i].dev.evdev.callbacks.input_map_fn( &dev_in_data->settings, &coll, &controller_msg[0], controller_msg_avail, - dev_in_data->input_dev_decl->dev[i]->user_data + devices[i].dev.evdev.user_data ); } else if (devices[i].type == DEV_IN_TYPE_IIO) { controller_msg_count = map_message_from_iio( @@ -583,6 +639,7 @@ void* dev_in_thread_func(void *ptr) { &controller_msg[0], controller_msg_avail ); + if (controller_msg_count < 0) { fprintf(stderr, "Error in reading iio buffer for device %zd: %d -- Will reconnect to the device\n", i, controller_msg_count); iio_close_device(&devices[i].dev.iio); @@ -590,19 +647,45 @@ void* dev_in_thread_func(void *ptr) { continue; } } else if (devices[i].type == DEV_IN_TYPE_HIDRAW) { - controller_msg_count = dev_in_data->input_dev_decl->dev[i]->map.hidraw_callbacks.map_callback( + controller_msg_count = devices[i].dev.hidraw.callbacks.map_callback( &dev_in_data->settings, - dev_hidraw_get_fd(devices[i].dev.hidraw.hidrawdev), + fd, &controller_msg[0], controller_msg_avail, - dev_in_data->input_dev_decl->dev[i]->user_data + devices[i].dev.hidraw.user_data ); + if (controller_msg_count < 0) { fprintf(stderr, "Error in performing operations for device %zd: %d -- Will reconnect to the device\n", i, controller_msg_count); hidraw_close_device(&devices[i].dev.hidraw); devices[i].type = DEV_IN_TYPE_NONE; continue; } + } else if (devices[i].type == DEV_IN_TYPE_TIMER) { + uint64_t expirations; + ssize_t num_read = read(fd, &expirations, sizeof(uint64_t)); + if (num_read != sizeof(uint64_t)) { + fprintf(stderr, "Error in reading expirations from timer device %zd: %d -- Will reconnect to the device\n", i, controller_msg_count); + timer_close_device(&devices[i].dev.timer); + devices[i].type = DEV_IN_TYPE_NONE; + continue; + } + + controller_msg_count = devices[i].dev.timer.callbacks.map_fn( + &dev_in_data->settings, + fd, + expirations, + &controller_msg[0], + controller_msg_avail, + devices[i].dev.timer.user_data + ); + + if (controller_msg_count < 0) { + fprintf(stderr, "Error in timer device %zd: %d -- Will reconnect to the device\n", i, controller_msg_count); + timer_close_device(&devices[i].dev.timer); + devices[i].type = DEV_IN_TYPE_NONE; + continue; + } } // send messages (if any) @@ -662,6 +745,9 @@ void* dev_in_thread_func(void *ptr) { } else if (devices[i].type == DEV_IN_TYPE_HIDRAW) { hidraw_close_device(&devices[i].dev.hidraw); devices[i].type = DEV_IN_TYPE_NONE; + } else if (devices[i].type == DEV_IN_TYPE_TIMER) { + timer_close_device(&devices[i].dev.timer); + devices[i].type = DEV_IN_TYPE_NONE; } } diff --git a/dev_timer.c b/dev_timer.c new file mode 100644 index 0000000..9fe0275 --- /dev/null +++ b/dev_timer.c @@ -0,0 +1,60 @@ +#include "dev_timer.h" + +int dev_timer_open( + const timer_filters_t *const in_filters, + dev_timer_t **const out_dev +) { + int res = -ENODEV; + + *out_dev = malloc(sizeof(dev_timer_t)); + if (*out_dev == NULL) { + res = -ENOMEM; + goto dev_timer_open_err; + } + + memset(*out_dev, 0, sizeof(dev_timer_t)); + + const int fd = timerfd_create(CLOCK_MONOTONIC, 0); + if (fd < 0) { + res = errno < 0 ? errno : -1 * errno; + if (res == 0) { + res = fd; + } + goto dev_timer_open_err; + } + + (*out_dev)->fd = fd; + (*out_dev)->timer_spec.it_value.tv_sec = in_filters->ticktime_ms / (__time_t)1000; + (*out_dev)->timer_spec.it_value.tv_nsec = (in_filters->ticktime_ms % (__syscall_slong_t)1000) * (__syscall_slong_t)1000; + (*out_dev)->timer_spec.it_interval.tv_sec = in_filters->ticktime_ms / (__time_t)1000; + (*out_dev)->timer_spec.it_interval.tv_nsec = (in_filters->ticktime_ms % (__syscall_slong_t)1000) * (__syscall_slong_t)1000; + + if (timerfd_settime((*out_dev)->fd, 0, &(*out_dev)->timer_spec, NULL) < 0) { + res = errno < 0 ? errno : -1 * errno; + if (res == 0) { + res = -EIO; + } + goto dev_timer_open_err; + } + + res = 0; + +dev_timer_open_err: + if (res != 0) { + if (fd > 0) { + close(fd); + } + + free(*out_dev); + } + + return res; +} + +void dev_timer_close(dev_timer_t *const inout_dev) { + close(inout_dev->fd); +} + +int dev_timer_get_fd(const dev_timer_t *const in_dev) { + return in_dev->fd; +} diff --git a/dev_timer.h b/dev_timer.h new file mode 100644 index 0000000..41c6ba5 --- /dev/null +++ b/dev_timer.h @@ -0,0 +1,18 @@ +#pragma once + +#include "input_dev.h" + +typedef struct dev_timer { + struct itimerspec timer_spec; + + int fd; +} dev_timer_t; + +int dev_timer_open( + const timer_filters_t *const in_filters, + dev_timer_t **const out_dev +); + +void dev_timer_close(dev_timer_t *const inout_dev); + +int dev_timer_get_fd(const dev_timer_t *const in_dev); diff --git a/input_dev.h b/input_dev.h index f52e4be..07558a9 100644 --- a/input_dev.h +++ b/input_dev.h @@ -24,6 +24,7 @@ typedef enum input_dev_type { input_dev_type_uinput, input_dev_type_iio, input_dev_type_hidraw, + input_dev_type_timer, } input_dev_type_t; typedef struct hidraw_filters { @@ -55,6 +56,16 @@ typedef struct iio_settings { int8_t post_matrix[3][3]; } iio_settings_t; +typedef int (*timer_map)(const dev_in_settings_t *const conf, int timer_fd, uint64_t expirations, in_message_t *const messages, size_t messages_len, void* user_data); + +typedef struct timer_callbacks { + timer_map map_fn; +} timer_callbacks_t; + +typedef struct ev_callbacks { + ev_map input_map_fn; +} ev_callbacks_t; + typedef struct timer_filters { char name[128]; uint64_t ticktime_ms; @@ -67,14 +78,16 @@ typedef struct input_dev { uinput_filters_t ev; iio_filters_t iio; hidraw_filters_t hidraw; + timer_filters_t timer; } filters; void* user_data; union input_dev_map { iio_settings_t iio_settings; - ev_map ev_input_map_fn; + ev_callbacks_t ev_callbacks; hidraw_callbacks_t hidraw_callbacks; + timer_callbacks_t timer_callbacks; } map; } input_dev_t; diff --git a/legion_go.c b/legion_go.c index 6f15eb0..6d5c33e 100644 --- a/legion_go.c +++ b/legion_go.c @@ -11,7 +11,9 @@ static input_dev_t in_xbox_dev = { } }, .map = { - .ev_input_map_fn = xbox360_ev_map, + .ev_callbacks = { + .input_map_fn = xbox360_ev_map, + }, } }; diff --git a/rog_ally.c b/rog_ally.c index 1b808e0..3c35e11 100644 --- a/rog_ally.c +++ b/rog_ally.c @@ -853,7 +853,9 @@ static input_dev_t in_asus_kb_1_dev = { }, .user_data = (void*)&asus_userdata, .map = { - .ev_input_map_fn = asus_kbd_ev_map, + .ev_callbacks = { + .input_map_fn = asus_kbd_ev_map, + }, } }; @@ -866,7 +868,9 @@ static input_dev_t in_asus_kb_2_dev = { }, .user_data = (void*)&asus_userdata, .map = { - .ev_input_map_fn = asus_kbd_ev_map, + .ev_callbacks = { + .input_map_fn = asus_kbd_ev_map, + }, } }; @@ -879,7 +883,9 @@ static input_dev_t in_asus_kb_3_dev = { }, .user_data = &asus_userdata, .map = { - .ev_input_map_fn = asus_kbd_ev_map, + .ev_callbacks = { + .input_map_fn = asus_kbd_ev_map, + }, } }; @@ -891,7 +897,9 @@ static input_dev_t in_xbox_dev = { } }, .map = { - .ev_input_map_fn = xbox360_ev_map, + .ev_callbacks = { + .input_map_fn = xbox360_ev_map, + }, } }; @@ -989,6 +997,26 @@ static int rc71l_platform_leds(const dev_in_settings_t *const conf, uint8_t r, u return 0; } +int rc71l_timer_map(const dev_in_settings_t *const conf, int timer_fd, uint64_t expirations, in_message_t *const messages, size_t messages_len, void* user_data) { + return 0; +} + +input_dev_t timer_dev = { + .dev_type = input_dev_type_timer, + .filters = { + .timer = { + .name = "RC71L_timer", + .ticktime_ms = 650, + } + }, + .user_data = NULL, + .map = { + .timer_callbacks = { + .map_fn = rc71l_timer_map, + } + } +}; + input_dev_composite_t rc71l_composite = { .dev = { &in_xbox_dev, @@ -997,8 +1025,9 @@ input_dev_composite_t rc71l_composite = { &in_asus_kb_2_dev, &in_asus_kb_3_dev, &nkey_dev, + &timer_dev, }, - .dev_count = 6, + .dev_count = 7, .init_fn = rc71l_platform_init, .deinit_fn = rc71l_platform_deinit, .leds_fn = rc71l_platform_leds, diff --git a/rogue_enemy.h b/rogue_enemy.h index 4d17389..00197be 100644 --- a/rogue_enemy.h +++ b/rogue_enemy.h @@ -28,6 +28,7 @@ #include #include #include +#include #include #include From 6eb684744458db4eb0de98ca97120ed920677ae0 Mon Sep 17 00:00:00 2001 From: Denis Date: Sun, 17 Dec 2023 16:43:45 +0100 Subject: [PATCH 3/4] using nanoseconds as such --- dev_timer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dev_timer.c b/dev_timer.c index 9fe0275..6c6e2e3 100644 --- a/dev_timer.c +++ b/dev_timer.c @@ -25,9 +25,9 @@ int dev_timer_open( (*out_dev)->fd = fd; (*out_dev)->timer_spec.it_value.tv_sec = in_filters->ticktime_ms / (__time_t)1000; - (*out_dev)->timer_spec.it_value.tv_nsec = (in_filters->ticktime_ms % (__syscall_slong_t)1000) * (__syscall_slong_t)1000; + (*out_dev)->timer_spec.it_value.tv_nsec = (in_filters->ticktime_ms % (__syscall_slong_t)1000) * (__syscall_slong_t)1000000; (*out_dev)->timer_spec.it_interval.tv_sec = in_filters->ticktime_ms / (__time_t)1000; - (*out_dev)->timer_spec.it_interval.tv_nsec = (in_filters->ticktime_ms % (__syscall_slong_t)1000) * (__syscall_slong_t)1000; + (*out_dev)->timer_spec.it_interval.tv_nsec = (in_filters->ticktime_ms % (__syscall_slong_t)1000) * (__syscall_slong_t)1000000; if (timerfd_settime((*out_dev)->fd, 0, &(*out_dev)->timer_spec, NULL) < 0) { res = errno < 0 ? errno : -1 * errno; From ea5f026e046600cb406bbfedbd5641edd31935b4 Mon Sep 17 00:00:00 2001 From: Denis Date: Sun, 17 Dec 2023 17:37:58 +0100 Subject: [PATCH 4/4] timer timeout to evdev --- dev_in.c | 30 ++++++++++++++++++++++++++++++ input_dev.h | 16 +++++++++++++++- rog_ally.c | 24 +++++++++++++++++++++++- 3 files changed, 68 insertions(+), 2 deletions(-) diff --git a/dev_in.c b/dev_in.c index 8ac7e0a..141f113 100644 --- a/dev_in.c +++ b/dev_in.c @@ -56,6 +56,8 @@ typedef struct dev_in_timer { dev_timer_t* timer; + const char* name; + timer_callbacks_t callbacks; void* user_data; @@ -384,6 +386,25 @@ static void handle_leds(const dev_in_settings_t *const conf, dev_in_t *const in_ } } +static void handle_timeout( + const dev_in_settings_t *const conf, + dev_in_t *const in_devs, + size_t in_devs_count, + const char* name, + uint64_t expirations +) { + for (size_t i = 0; i < in_devs_count; ++i) { + if (in_devs[i].type == DEV_IN_TYPE_EV) { + in_devs[i].dev.hidraw.callbacks.timeout_callback( + conf, + name, + expirations, + in_devs[i].dev.evdev.user_data + ); + } + } +} + static int open_socket(struct sockaddr_un *serveraddr) { int res = -ENODEV; @@ -531,6 +552,7 @@ void* dev_in_thread_func(void *ptr) { if (open_res == 0) { devices[i].dev.timer.callbacks = dev_in_data->input_dev_decl->dev[i]->map.timer_callbacks; devices[i].dev.timer.user_data = dev_in_data->input_dev_decl->dev[i]->user_data; + devices[i].dev.timer.name = dev_in_data->input_dev_decl->dev[i]->filters.timer.name; devices[i].type = DEV_IN_TYPE_TIMER; // device is now connected, query it in select @@ -686,6 +708,14 @@ void* dev_in_thread_func(void *ptr) { devices[i].type = DEV_IN_TYPE_NONE; continue; } + + handle_timeout( + &dev_in_data->settings, + devices, + max_devices, + devices[i].dev.timer.name, + expirations + ); } // send messages (if any) diff --git a/input_dev.h b/input_dev.h index 07558a9..c7cb973 100644 --- a/input_dev.h +++ b/input_dev.h @@ -18,7 +18,19 @@ typedef struct evdev_collected { * A function with this signature grapbs input_event data and sends to the pipe messages * constructed from that data. */ -typedef int (*ev_map)(const dev_in_settings_t *const conf, const evdev_collected_t *const e, in_message_t *const messages, size_t messages_len, void* user_data); +typedef int (*ev_map)( + const dev_in_settings_t *const conf, + const evdev_collected_t *const e, + in_message_t *const messages, + size_t messages_len, + void* user_data +); +typedef void (*ev_timer)( + const dev_in_settings_t *const conf, + const char* const timer_name, + uint64_t expired, + void* user_data +); typedef enum input_dev_type { input_dev_type_uinput, @@ -49,6 +61,7 @@ typedef struct hidraw_callbacks { hidraw_set_leds leds_callback; hidraw_rumble rumble_callback; hidraw_map map_callback; + ev_timer timeout_callback; } hidraw_callbacks_t; typedef struct iio_settings { @@ -64,6 +77,7 @@ typedef struct timer_callbacks { typedef struct ev_callbacks { ev_map input_map_fn; + ev_timer timeout_callback; } ev_callbacks_t; typedef struct timer_filters { diff --git a/rog_ally.c b/rog_ally.c index 3c35e11..59072a2 100644 --- a/rog_ally.c +++ b/rog_ally.c @@ -844,6 +844,15 @@ static input_dev_t in_iio_dev = { //.input_filter_fn = input_filter_imu_identity, }; +static void rc71l_timer_asus_kbd( + const dev_in_settings_t *const conf, + const char* const timer_name, + uint64_t expired, + void* user_data +) { + +} + static input_dev_t in_asus_kb_1_dev = { .dev_type = input_dev_type_uinput, .filters = { @@ -855,6 +864,7 @@ static input_dev_t in_asus_kb_1_dev = { .map = { .ev_callbacks = { .input_map_fn = asus_kbd_ev_map, + .timeout_callback = rc71l_timer_asus_kbd, }, } }; @@ -870,6 +880,7 @@ static input_dev_t in_asus_kb_2_dev = { .map = { .ev_callbacks = { .input_map_fn = asus_kbd_ev_map, + .timeout_callback = rc71l_timer_asus_kbd, }, } }; @@ -885,10 +896,20 @@ static input_dev_t in_asus_kb_3_dev = { .map = { .ev_callbacks = { .input_map_fn = asus_kbd_ev_map, + .timeout_callback = rc71l_timer_asus_kbd, }, } }; +static void rc71l_timer_xbox360( + const dev_in_settings_t *const conf, + const char* const timer_name, + uint64_t expired, + void* user_data +) { + +} + static input_dev_t in_xbox_dev = { .dev_type = input_dev_type_uinput, .filters = { @@ -899,6 +920,7 @@ static input_dev_t in_xbox_dev = { .map = { .ev_callbacks = { .input_map_fn = xbox360_ev_map, + .timeout_callback = rc71l_timer_xbox360, }, } }; @@ -1006,7 +1028,7 @@ input_dev_t timer_dev = { .filters = { .timer = { .name = "RC71L_timer", - .ticktime_ms = 650, + .ticktime_ms = 150, } }, .user_data = NULL,