2022-08-29 18:06:25 -05:00
|
|
|
// vi: set ft=c
|
2022-08-27 19:29:43 -05:00
|
|
|
#ifndef HID_H
|
|
|
|
#define HID_H
|
2022-08-30 08:37:34 -05:00
|
|
|
#include "net.h"
|
2022-08-29 17:27:03 -05:00
|
|
|
#include "vec.h"
|
2022-08-30 08:37:34 -05:00
|
|
|
#include <linux/input.h>
|
|
|
|
#include <pthread.h>
|
|
|
|
#include <stdint.h>
|
2022-08-27 19:29:43 -05:00
|
|
|
|
2022-08-29 17:27:03 -05:00
|
|
|
typedef uint64_t uniq_t;
|
2022-08-27 19:29:43 -05:00
|
|
|
|
2022-08-29 17:27:03 -05:00
|
|
|
typedef struct {
|
2022-08-30 08:37:34 -05:00
|
|
|
uint8_t abs_indices[ABS_CNT];
|
|
|
|
uint8_t rel_indices[REL_CNT];
|
|
|
|
uint8_t key_indices[KEY_CNT];
|
|
|
|
} DeviceMap;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
int event;
|
|
|
|
int hidraw;
|
|
|
|
uniq_t uniq;
|
|
|
|
char *name;
|
|
|
|
DeviceMap mapping;
|
|
|
|
MessageDeviceInfo device_info;
|
2022-08-29 17:27:03 -05:00
|
|
|
} PhysicalDevice;
|
|
|
|
|
2022-08-30 08:37:34 -05:00
|
|
|
void *hid_thread();
|
|
|
|
void return_device(PhysicalDevice *dev);
|
2022-08-29 17:27:03 -05:00
|
|
|
PhysicalDevice get_device();
|
2022-08-30 08:37:34 -05:00
|
|
|
void apply_controller_state(PhysicalDevice *dev, MessageControllerState *state);
|
2022-08-27 19:29:43 -05:00
|
|
|
|
|
|
|
#endif
|