There was a registration mechanism to listen to HID outputs with a specific HID id. However, the UHID gamepad processor handles several ids, so it cannot work. We could complexify the registration mechanism, but instead, directly dispatch to the expected processor based on the UHID id. Concretely, instead of passing a sc_uhid_devices instance to construct a sc_keyboard_uhid, so that it can register itself, construct the sc_uhid_devices with all the UHID instances (currently only sc_keyboard_uhid) so that it can dispatch HID outputs directly. PR #5270 <https://github.com/Genymobile/scrcpy/pull/5270>
29 lines
641 B
C
29 lines
641 B
C
#ifndef SC_KEYBOARD_UHID_H
|
|
#define SC_KEYBOARD_UHID_H
|
|
|
|
#include "common.h"
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include "controller.h"
|
|
#include "hid/hid_keyboard.h"
|
|
#include "trait/key_processor.h"
|
|
|
|
struct sc_keyboard_uhid {
|
|
struct sc_key_processor key_processor; // key processor trait
|
|
|
|
struct sc_hid_keyboard hid;
|
|
struct sc_controller *controller;
|
|
uint16_t device_mod;
|
|
};
|
|
|
|
bool
|
|
sc_keyboard_uhid_init(struct sc_keyboard_uhid *kb,
|
|
struct sc_controller *controller);
|
|
|
|
void
|
|
sc_keyboard_uhid_process_hid_output(struct sc_keyboard_uhid *kb,
|
|
const uint8_t *data, size_t size);
|
|
|
|
#endif
|