Rename hid_event to hid_input

The sc_hid_event structure represents HID input data. Rename it so that
we can add other hid event structs without confusion.
This commit is contained in:
Romain Vimont 2024-09-06 23:08:08 +02:00
parent 5841650aa0
commit b633614d36
11 changed files with 114 additions and 113 deletions

View file

@ -7,7 +7,7 @@
#define SC_HID_MAX_SIZE 8 #define SC_HID_MAX_SIZE 8
struct sc_hid_event { struct sc_hid_input {
uint16_t hid_id; uint16_t hid_id;
uint8_t data[SC_HID_MAX_SIZE]; uint8_t data[SC_HID_MAX_SIZE];
uint8_t size; uint8_t size;

View file

@ -21,7 +21,7 @@
// keyboard support, though OS could support more keys via modifying the report // keyboard support, though OS could support more keys via modifying the report
// desc. 6 should be enough for scrcpy. // desc. 6 should be enough for scrcpy.
#define SC_HID_KEYBOARD_MAX_KEYS 6 #define SC_HID_KEYBOARD_MAX_KEYS 6
#define SC_HID_KEYBOARD_EVENT_SIZE \ #define SC_HID_KEYBOARD_INPUT_SIZE \
(SC_HID_KEYBOARD_INDEX_KEYS + SC_HID_KEYBOARD_MAX_KEYS) (SC_HID_KEYBOARD_INDEX_KEYS + SC_HID_KEYBOARD_MAX_KEYS)
#define SC_HID_RESERVED 0x00 #define SC_HID_RESERVED 0x00
@ -199,11 +199,11 @@ const size_t SC_HID_KEYBOARD_REPORT_DESC_LEN =
*/ */
static void static void
sc_hid_keyboard_event_init(struct sc_hid_event *hid_event) { sc_hid_keyboard_input_init(struct sc_hid_input *hid_input) {
hid_event->hid_id = SC_HID_ID_KEYBOARD; hid_input->hid_id = SC_HID_ID_KEYBOARD;
hid_event->size = SC_HID_KEYBOARD_EVENT_SIZE; hid_input->size = SC_HID_KEYBOARD_INPUT_SIZE;
uint8_t *data = hid_event->data; uint8_t *data = hid_input->data;
data[SC_HID_KEYBOARD_INDEX_MODS] = SC_HID_MOD_NONE; data[SC_HID_KEYBOARD_INDEX_MODS] = SC_HID_MOD_NONE;
data[1] = SC_HID_RESERVED; data[1] = SC_HID_RESERVED;
@ -251,8 +251,8 @@ scancode_is_modifier(enum sc_scancode scancode) {
} }
bool bool
sc_hid_keyboard_event_from_key(struct sc_hid_keyboard *hid, sc_hid_keyboard_generate_input_from_key(struct sc_hid_keyboard *hid,
struct sc_hid_event *hid_event, struct sc_hid_input *hid_input,
const struct sc_key_event *event) { const struct sc_key_event *event) {
enum sc_scancode scancode = event->scancode; enum sc_scancode scancode = event->scancode;
assert(scancode >= 0); assert(scancode >= 0);
@ -265,7 +265,7 @@ sc_hid_keyboard_event_from_key(struct sc_hid_keyboard *hid,
return false; return false;
} }
sc_hid_keyboard_event_init(hid_event); sc_hid_keyboard_input_init(hid_input);
uint16_t mods = sc_hid_mod_from_sdl_keymod(event->mods_state); uint16_t mods = sc_hid_mod_from_sdl_keymod(event->mods_state);
@ -276,9 +276,9 @@ sc_hid_keyboard_event_from_key(struct sc_hid_keyboard *hid,
hid->keys[scancode] ? "true" : "false"); hid->keys[scancode] ? "true" : "false");
} }
hid_event->data[SC_HID_KEYBOARD_INDEX_MODS] = mods; hid_input->data[SC_HID_KEYBOARD_INDEX_MODS] = mods;
uint8_t *keys_data = &hid_event->data[SC_HID_KEYBOARD_INDEX_KEYS]; uint8_t *keys_data = &hid_input->data[SC_HID_KEYBOARD_INDEX_KEYS];
// Re-calculate pressed keys every time // Re-calculate pressed keys every time
int keys_pressed_count = 0; int keys_pressed_count = 0;
for (int i = 0; i < SC_HID_KEYBOARD_KEYS; ++i) { for (int i = 0; i < SC_HID_KEYBOARD_KEYS; ++i) {
@ -309,7 +309,7 @@ end:
} }
bool bool
sc_hid_keyboard_event_from_mods(struct sc_hid_event *event, sc_hid_keyboard_generate_input_from_mods(struct sc_hid_input *hid_input,
uint16_t mods_state) { uint16_t mods_state) {
bool capslock = mods_state & SC_MOD_CAPS; bool capslock = mods_state & SC_MOD_CAPS;
bool numlock = mods_state & SC_MOD_NUM; bool numlock = mods_state & SC_MOD_NUM;
@ -318,15 +318,15 @@ sc_hid_keyboard_event_from_mods(struct sc_hid_event *event,
return false; return false;
} }
sc_hid_keyboard_event_init(event); sc_hid_keyboard_input_init(hid_input);
unsigned i = 0; unsigned i = 0;
if (capslock) { if (capslock) {
event->data[SC_HID_KEYBOARD_INDEX_KEYS + i] = SC_SCANCODE_CAPSLOCK; hid_input->data[SC_HID_KEYBOARD_INDEX_KEYS + i] = SC_SCANCODE_CAPSLOCK;
++i; ++i;
} }
if (numlock) { if (numlock) {
event->data[SC_HID_KEYBOARD_INDEX_KEYS + i] = SC_SCANCODE_NUMLOCK; hid_input->data[SC_HID_KEYBOARD_INDEX_KEYS + i] = SC_SCANCODE_NUMLOCK;
++i; ++i;
} }

View file

@ -39,12 +39,12 @@ void
sc_hid_keyboard_init(struct sc_hid_keyboard *hid); sc_hid_keyboard_init(struct sc_hid_keyboard *hid);
bool bool
sc_hid_keyboard_event_from_key(struct sc_hid_keyboard *hid, sc_hid_keyboard_generate_input_from_key(struct sc_hid_keyboard *hid,
struct sc_hid_event *hid_event, struct sc_hid_input *hid_input,
const struct sc_key_event *event); const struct sc_key_event *event);
bool bool
sc_hid_keyboard_event_from_mods(struct sc_hid_event *event, sc_hid_keyboard_generate_input_from_mods(struct sc_hid_input *hid_input,
uint16_t mods_state); uint16_t mods_state);
#endif #endif

View file

@ -2,7 +2,7 @@
// 1 byte for buttons + padding, 1 byte for X position, 1 byte for Y position, // 1 byte for buttons + padding, 1 byte for X position, 1 byte for Y position,
// 1 byte for wheel motion // 1 byte for wheel motion
#define SC_HID_MOUSE_EVENT_SIZE 4 #define SC_HID_MOUSE_INPUT_SIZE 4
/** /**
* Mouse descriptor from the specification: * Mouse descriptor from the specification:
@ -125,11 +125,10 @@ const size_t SC_HID_MOUSE_REPORT_DESC_LEN =
*/ */
static void static void
sc_hid_mouse_event_init(struct sc_hid_event *hid_event) { sc_hid_mouse_input_init(struct sc_hid_input *hid_input) {
hid_event->hid_id = SC_HID_ID_MOUSE; hid_input->hid_id = SC_HID_ID_MOUSE;
hid_event->size = SC_HID_MOUSE_EVENT_SIZE; hid_input->size = SC_HID_MOUSE_INPUT_SIZE;
// Leave hid_event->data uninitialized, it will be fully initialized by // Leave ->data uninitialized, it will be fully initialized by callers
// callers
} }
static uint8_t static uint8_t
@ -154,11 +153,11 @@ sc_hid_buttons_from_buttons_state(uint8_t buttons_state) {
} }
void void
sc_hid_mouse_event_from_motion(struct sc_hid_event *hid_event, sc_hid_mouse_generate_input_from_motion(struct sc_hid_input *hid_input,
const struct sc_mouse_motion_event *event) { const struct sc_mouse_motion_event *event) {
sc_hid_mouse_event_init(hid_event); sc_hid_mouse_input_init(hid_input);
uint8_t *data = hid_event->data; uint8_t *data = hid_input->data;
data[0] = sc_hid_buttons_from_buttons_state(event->buttons_state); data[0] = sc_hid_buttons_from_buttons_state(event->buttons_state);
data[1] = CLAMP(event->xrel, -127, 127); data[1] = CLAMP(event->xrel, -127, 127);
data[2] = CLAMP(event->yrel, -127, 127); data[2] = CLAMP(event->yrel, -127, 127);
@ -166,11 +165,11 @@ sc_hid_mouse_event_from_motion(struct sc_hid_event *hid_event,
} }
void void
sc_hid_mouse_event_from_click(struct sc_hid_event *hid_event, sc_hid_mouse_generate_input_from_click(struct sc_hid_input *hid_input,
const struct sc_mouse_click_event *event) { const struct sc_mouse_click_event *event) {
sc_hid_mouse_event_init(hid_event); sc_hid_mouse_input_init(hid_input);
uint8_t *data = hid_event->data; uint8_t *data = hid_input->data;
data[0] = sc_hid_buttons_from_buttons_state(event->buttons_state); data[0] = sc_hid_buttons_from_buttons_state(event->buttons_state);
data[1] = 0; // no x motion data[1] = 0; // no x motion
data[2] = 0; // no y motion data[2] = 0; // no y motion
@ -178,11 +177,11 @@ sc_hid_mouse_event_from_click(struct sc_hid_event *hid_event,
} }
void void
sc_hid_mouse_event_from_scroll(struct sc_hid_event *hid_event, sc_hid_mouse_generate_input_from_scroll(struct sc_hid_input *hid_input,
const struct sc_mouse_scroll_event *event) { const struct sc_mouse_scroll_event *event) {
sc_hid_mouse_event_init(hid_event); sc_hid_mouse_input_init(hid_input);
uint8_t *data = hid_event->data; uint8_t *data = hid_input->data;
data[0] = 0; // buttons state irrelevant (and unknown) data[0] = 0; // buttons state irrelevant (and unknown)
data[1] = 0; // no x motion data[1] = 0; // no x motion
data[2] = 0; // no y motion data[2] = 0; // no y motion

View file

@ -14,15 +14,15 @@ extern const uint8_t SC_HID_MOUSE_REPORT_DESC[];
extern const size_t SC_HID_MOUSE_REPORT_DESC_LEN; extern const size_t SC_HID_MOUSE_REPORT_DESC_LEN;
void void
sc_hid_mouse_event_from_motion(struct sc_hid_event *hid_event, sc_hid_mouse_generate_input_from_motion(struct sc_hid_input *hid_input,
const struct sc_mouse_motion_event *event); const struct sc_mouse_motion_event *event);
void void
sc_hid_mouse_event_from_click(struct sc_hid_event *hid_event, sc_hid_mouse_generate_input_from_click(struct sc_hid_input *hid_input,
const struct sc_mouse_click_event *event); const struct sc_mouse_click_event *event);
void void
sc_hid_mouse_event_from_scroll(struct sc_hid_event *hid_event, sc_hid_mouse_generate_input_from_scroll(struct sc_hid_input *hid_input,
const struct sc_mouse_scroll_event *event); const struct sc_mouse_scroll_event *event);
#endif #endif

View file

@ -11,14 +11,14 @@
static void static void
sc_keyboard_uhid_send_input(struct sc_keyboard_uhid *kb, sc_keyboard_uhid_send_input(struct sc_keyboard_uhid *kb,
const struct sc_hid_event *event) { const struct sc_hid_input *hid_input) {
struct sc_control_msg msg; struct sc_control_msg msg;
msg.type = SC_CONTROL_MSG_TYPE_UHID_INPUT; msg.type = SC_CONTROL_MSG_TYPE_UHID_INPUT;
msg.uhid_input.id = event->hid_id; msg.uhid_input.id = hid_input->hid_id;
assert(event->size <= SC_HID_MAX_SIZE); assert(hid_input->size <= SC_HID_MAX_SIZE);
memcpy(msg.uhid_input.data, event->data, event->size); memcpy(msg.uhid_input.data, hid_input->data, hid_input->size);
msg.uhid_input.size = event->size; msg.uhid_input.size = hid_input->size;
if (!sc_controller_push_msg(kb->controller, &msg)) { if (!sc_controller_push_msg(kb->controller, &msg)) {
LOGE("Could not send UHID_INPUT message (key)"); LOGE("Could not send UHID_INPUT message (key)");
@ -37,12 +37,12 @@ sc_keyboard_uhid_synchronize_mod(struct sc_keyboard_uhid *kb) {
// or HID output anyway // or HID output anyway
kb->device_mod = mod; kb->device_mod = mod;
struct sc_hid_event hid_event; struct sc_hid_input hid_input;
sc_hid_keyboard_event_from_mods(&hid_event, diff); sc_hid_keyboard_generate_input_from_mods(&hid_input, diff);
LOGV("HID keyboard state synchronized"); LOGV("HID keyboard state synchronized");
sc_keyboard_uhid_send_input(kb, &hid_event); sc_keyboard_uhid_send_input(kb, &hid_input);
} }
} }
@ -62,10 +62,10 @@ sc_key_processor_process_key(struct sc_key_processor *kp,
struct sc_keyboard_uhid *kb = DOWNCAST(kp); struct sc_keyboard_uhid *kb = DOWNCAST(kp);
struct sc_hid_event hid_event; struct sc_hid_input hid_input;
// Not all keys are supported, just ignore unsupported keys // Not all keys are supported, just ignore unsupported keys
if (sc_hid_keyboard_event_from_key(&kb->hid, &hid_event, event)) { if (sc_hid_keyboard_generate_input_from_key(&kb->hid, &hid_input, event)) {
if (event->scancode == SC_SCANCODE_CAPSLOCK) { if (event->scancode == SC_SCANCODE_CAPSLOCK) {
kb->device_mod ^= SC_MOD_CAPS; kb->device_mod ^= SC_MOD_CAPS;
} else if (event->scancode == SC_SCANCODE_NUMLOCK) { } else if (event->scancode == SC_SCANCODE_NUMLOCK) {
@ -75,7 +75,7 @@ sc_key_processor_process_key(struct sc_key_processor *kp,
// change the modifiers) // change the modifiers)
sc_keyboard_uhid_synchronize_mod(kb); sc_keyboard_uhid_synchronize_mod(kb);
} }
sc_keyboard_uhid_send_input(kb, &hid_event); sc_keyboard_uhid_send_input(kb, &hid_input);
} }
} }

View file

@ -9,14 +9,15 @@
static void static void
sc_mouse_uhid_send_input(struct sc_mouse_uhid *mouse, sc_mouse_uhid_send_input(struct sc_mouse_uhid *mouse,
const struct sc_hid_event *event, const char *name) { const struct sc_hid_input *hid_input,
const char *name) {
struct sc_control_msg msg; struct sc_control_msg msg;
msg.type = SC_CONTROL_MSG_TYPE_UHID_INPUT; msg.type = SC_CONTROL_MSG_TYPE_UHID_INPUT;
msg.uhid_input.id = event->hid_id; msg.uhid_input.id = hid_input->hid_id;
assert(event->size <= SC_HID_MAX_SIZE); assert(hid_input->size <= SC_HID_MAX_SIZE);
memcpy(msg.uhid_input.data, event->data, event->size); memcpy(msg.uhid_input.data, hid_input->data, hid_input->size);
msg.uhid_input.size = event->size; msg.uhid_input.size = hid_input->size;
if (!sc_controller_push_msg(mouse->controller, &msg)) { if (!sc_controller_push_msg(mouse->controller, &msg)) {
LOGE("Could not send UHID_INPUT message (%s)", name); LOGE("Could not send UHID_INPUT message (%s)", name);
@ -28,10 +29,10 @@ sc_mouse_processor_process_mouse_motion(struct sc_mouse_processor *mp,
const struct sc_mouse_motion_event *event) { const struct sc_mouse_motion_event *event) {
struct sc_mouse_uhid *mouse = DOWNCAST(mp); struct sc_mouse_uhid *mouse = DOWNCAST(mp);
struct sc_hid_event hid_event; struct sc_hid_input hid_input;
sc_hid_mouse_event_from_motion(&hid_event, event); sc_hid_mouse_generate_input_from_motion(&hid_input, event);
sc_mouse_uhid_send_input(mouse, &hid_event, "mouse motion"); sc_mouse_uhid_send_input(mouse, &hid_input, "mouse motion");
} }
static void static void
@ -39,10 +40,10 @@ sc_mouse_processor_process_mouse_click(struct sc_mouse_processor *mp,
const struct sc_mouse_click_event *event) { const struct sc_mouse_click_event *event) {
struct sc_mouse_uhid *mouse = DOWNCAST(mp); struct sc_mouse_uhid *mouse = DOWNCAST(mp);
struct sc_hid_event hid_event; struct sc_hid_input hid_input;
sc_hid_mouse_event_from_click(&hid_event, event); sc_hid_mouse_generate_input_from_click(&hid_input, event);
sc_mouse_uhid_send_input(mouse, &hid_event, "mouse click"); sc_mouse_uhid_send_input(mouse, &hid_input, "mouse click");
} }
static void static void
@ -50,10 +51,10 @@ sc_mouse_processor_process_mouse_scroll(struct sc_mouse_processor *mp,
const struct sc_mouse_scroll_event *event) { const struct sc_mouse_scroll_event *event) {
struct sc_mouse_uhid *mouse = DOWNCAST(mp); struct sc_mouse_uhid *mouse = DOWNCAST(mp);
struct sc_hid_event hid_event; struct sc_hid_input hid_input;
sc_hid_mouse_event_from_scroll(&hid_event, event); sc_hid_mouse_generate_input_from_scroll(&hid_input, event);
sc_mouse_uhid_send_input(mouse, &hid_event, "mouse scroll"); sc_mouse_uhid_send_input(mouse, &hid_input, "mouse scroll");
} }
bool bool

View file

@ -20,14 +20,14 @@
#define SC_AOA_EVENT_QUEUE_LIMIT 60 #define SC_AOA_EVENT_QUEUE_LIMIT 60
static void static void
sc_hid_event_log(const struct sc_hid_event *event) { sc_hid_input_log(const struct sc_hid_input *hid_input) {
// HID Event: [00] FF FF FF FF... // HID input: [00] FF FF FF FF...
assert(event->size); assert(hid_input->size);
char *hex = sc_str_to_hex_string(event->data, event->size); char *hex = sc_str_to_hex_string(hid_input->data, hid_input->size);
if (!hex) { if (!hex) {
return; return;
} }
LOGV("HID Event: [%" PRIu16 "] %s", event->hid_id, hex); LOGV("HID input: [%" PRIu16 "] %s", hid_input->hid_id, hex);
free(hex); free(hex);
} }
@ -129,16 +129,17 @@ sc_aoa_set_hid_report_desc(struct sc_aoa *aoa, uint16_t accessory_id,
} }
static bool static bool
sc_aoa_send_hid_event(struct sc_aoa *aoa, const struct sc_hid_event *event) { sc_aoa_send_hid_event(struct sc_aoa *aoa,
const struct sc_hid_input *hid_input) {
uint8_t request_type = LIBUSB_ENDPOINT_OUT | LIBUSB_REQUEST_TYPE_VENDOR; uint8_t request_type = LIBUSB_ENDPOINT_OUT | LIBUSB_REQUEST_TYPE_VENDOR;
uint8_t request = ACCESSORY_SEND_HID_EVENT; uint8_t request = ACCESSORY_SEND_HID_EVENT;
// <https://source.android.com/devices/accessories/aoa2.html#hid-support> // <https://source.android.com/devices/accessories/aoa2.html#hid-support>
// value (arg0): accessory assigned ID for the HID device // value (arg0): accessory assigned ID for the HID device
// index (arg1): 0 (unused) // index (arg1): 0 (unused)
uint16_t value = event->hid_id; uint16_t value = hid_input->hid_id;
uint16_t index = 0; uint16_t index = 0;
unsigned char *data = (uint8_t *) event->data; // discard const unsigned char *data = (uint8_t *) hid_input->data; // discard const
uint16_t length = event->size; uint16_t length = hid_input->size;
int result = libusb_control_transfer(aoa->usb->handle, request_type, int result = libusb_control_transfer(aoa->usb->handle, request_type,
request, value, index, data, length, request, value, index, data, length,
DEFAULT_TIMEOUT); DEFAULT_TIMEOUT);
@ -195,11 +196,11 @@ sc_aoa_setup_hid(struct sc_aoa *aoa, uint16_t accessory_id,
} }
bool bool
sc_aoa_push_hid_event_with_ack_to_wait(struct sc_aoa *aoa, sc_aoa_push_input_with_ack_to_wait(struct sc_aoa *aoa,
const struct sc_hid_event *event, const struct sc_hid_input *hid_input,
uint64_t ack_to_wait) { uint64_t ack_to_wait) {
if (sc_get_log_level() <= SC_LOG_LEVEL_VERBOSE) { if (sc_get_log_level() <= SC_LOG_LEVEL_VERBOSE) {
sc_hid_event_log(event); sc_hid_input_log(hid_input);
} }
sc_mutex_lock(&aoa->mutex); sc_mutex_lock(&aoa->mutex);
@ -210,7 +211,7 @@ sc_aoa_push_hid_event_with_ack_to_wait(struct sc_aoa *aoa,
struct sc_aoa_event *aoa_event = struct sc_aoa_event *aoa_event =
sc_vecdeque_push_hole_noresize(&aoa->queue); sc_vecdeque_push_hole_noresize(&aoa->queue);
aoa_event->type = SC_AOA_EVENT_TYPE_INPUT; aoa_event->type = SC_AOA_EVENT_TYPE_INPUT;
aoa_event->input.hid = *event; aoa_event->input.hid = *hid_input;
aoa_event->input.ack_to_wait = ack_to_wait; aoa_event->input.ack_to_wait = ack_to_wait;
if (was_empty) { if (was_empty) {

View file

@ -31,7 +31,7 @@ struct sc_aoa_event {
uint16_t hid_id; uint16_t hid_id;
} close; } close;
struct { struct {
struct sc_hid_event hid; struct sc_hid_input hid;
uint64_t ack_to_wait; uint64_t ack_to_wait;
} input; } input;
}; };
@ -82,13 +82,13 @@ bool
sc_aoa_push_close(struct sc_aoa *aoa, uint16_t accessory_id); sc_aoa_push_close(struct sc_aoa *aoa, uint16_t accessory_id);
bool bool
sc_aoa_push_hid_event_with_ack_to_wait(struct sc_aoa *aoa, sc_aoa_push_input_with_ack_to_wait(struct sc_aoa *aoa,
const struct sc_hid_event *event, const struct sc_hid_input *hid_input,
uint64_t ack_to_wait); uint64_t ack_to_wait);
static inline bool static inline bool
sc_aoa_push_hid_event(struct sc_aoa *aoa, const struct sc_hid_event *event) { sc_aoa_push_input(struct sc_aoa *aoa, const struct sc_hid_input *hid_input) {
return sc_aoa_push_hid_event_with_ack_to_wait(aoa, event, return sc_aoa_push_input_with_ack_to_wait(aoa, hid_input,
SC_SEQUENCE_INVALID); SC_SEQUENCE_INVALID);
} }

View file

@ -10,14 +10,14 @@
static bool static bool
push_mod_lock_state(struct sc_keyboard_aoa *kb, uint16_t mods_state) { push_mod_lock_state(struct sc_keyboard_aoa *kb, uint16_t mods_state) {
struct sc_hid_event hid_event; struct sc_hid_input hid_input;
if (!sc_hid_keyboard_event_from_mods(&hid_event, mods_state)) { if (!sc_hid_keyboard_generate_input_from_mods(&hid_input, mods_state)) {
// Nothing to do // Nothing to do
return true; return true;
} }
if (!sc_aoa_push_hid_event(kb->aoa, &hid_event)) { if (!sc_aoa_push_input(kb->aoa, &hid_input)) {
LOGW("Could not request HID event (mod lock state)"); LOGW("Could not push HID input (mod lock state)");
return false; return false;
} }
@ -38,10 +38,10 @@ sc_key_processor_process_key(struct sc_key_processor *kp,
struct sc_keyboard_aoa *kb = DOWNCAST(kp); struct sc_keyboard_aoa *kb = DOWNCAST(kp);
struct sc_hid_event hid_event; struct sc_hid_input hid_input;
// Not all keys are supported, just ignore unsupported keys // Not all keys are supported, just ignore unsupported keys
if (sc_hid_keyboard_event_from_key(&kb->hid, &hid_event, event)) { if (sc_hid_keyboard_generate_input_from_key(&kb->hid, &hid_input, event)) {
if (!kb->mod_lock_synchronized) { if (!kb->mod_lock_synchronized) {
// Inject CAPSLOCK and/or NUMLOCK if necessary to synchronize // Inject CAPSLOCK and/or NUMLOCK if necessary to synchronize
// keyboard state // keyboard state
@ -55,9 +55,9 @@ sc_key_processor_process_key(struct sc_key_processor *kp,
// synchronization is acknowledged by the server, otherwise it could // synchronization is acknowledged by the server, otherwise it could
// paste the old clipboard content. // paste the old clipboard content.
if (!sc_aoa_push_hid_event_with_ack_to_wait(kb->aoa, &hid_event, if (!sc_aoa_push_input_with_ack_to_wait(kb->aoa, &hid_input,
ack_to_wait)) { ack_to_wait)) {
LOGW("Could not request HID event (key)"); LOGW("Could not push HID input (key)");
} }
} }
} }

View file

@ -14,11 +14,11 @@ sc_mouse_processor_process_mouse_motion(struct sc_mouse_processor *mp,
const struct sc_mouse_motion_event *event) { const struct sc_mouse_motion_event *event) {
struct sc_mouse_aoa *mouse = DOWNCAST(mp); struct sc_mouse_aoa *mouse = DOWNCAST(mp);
struct sc_hid_event hid_event; struct sc_hid_input hid_input;
sc_hid_mouse_event_from_motion(&hid_event, event); sc_hid_mouse_generate_input_from_motion(&hid_input, event);
if (!sc_aoa_push_hid_event(mouse->aoa, &hid_event)) { if (!sc_aoa_push_input(mouse->aoa, &hid_input)) {
LOGW("Could not request HID event (mouse motion)"); LOGW("Could not push HID input (mouse motion)");
} }
} }
@ -27,11 +27,11 @@ sc_mouse_processor_process_mouse_click(struct sc_mouse_processor *mp,
const struct sc_mouse_click_event *event) { const struct sc_mouse_click_event *event) {
struct sc_mouse_aoa *mouse = DOWNCAST(mp); struct sc_mouse_aoa *mouse = DOWNCAST(mp);
struct sc_hid_event hid_event; struct sc_hid_input hid_input;
sc_hid_mouse_event_from_click(&hid_event, event); sc_hid_mouse_generate_input_from_click(&hid_input, event);
if (!sc_aoa_push_hid_event(mouse->aoa, &hid_event)) { if (!sc_aoa_push_input(mouse->aoa, &hid_input)) {
LOGW("Could not request HID event (mouse click)"); LOGW("Could not push HID input (mouse click)");
} }
} }
@ -40,11 +40,11 @@ sc_mouse_processor_process_mouse_scroll(struct sc_mouse_processor *mp,
const struct sc_mouse_scroll_event *event) { const struct sc_mouse_scroll_event *event) {
struct sc_mouse_aoa *mouse = DOWNCAST(mp); struct sc_mouse_aoa *mouse = DOWNCAST(mp);
struct sc_hid_event hid_event; struct sc_hid_input hid_input;
sc_hid_mouse_event_from_scroll(&hid_event, event); sc_hid_mouse_generate_input_from_scroll(&hid_input, event);
if (!sc_aoa_push_hid_event(mouse->aoa, &hid_event)) { if (!sc_aoa_push_input(mouse->aoa, &hid_input)) {
LOGW("Could not request HID event (mouse scroll)"); LOGW("Could not push HID input (mouse scroll)");
} }
} }