-
Notifications
You must be signed in to change notification settings - Fork 4
/
virt_ds5.h
64 lines (48 loc) · 1.35 KB
/
virt_ds5.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#pragma once
#include "message.h"
#include "devices_status.h"
/**
* Emulator of the DualSense controller at USB level using USB UHID ( https://www.kernel.org/doc/html/latest/hid/uhid.html ) kernel APIs.
*
* See https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/hid/uhid.txt?id=refs/tags/v4.10-rc3
*/
typedef struct virt_dualsense {
int fd;
bool debug;
bool bluetooth;
bool edge_model;
uint8_t seq_num;
uint32_t dt_sum;
uint8_t dt_buffer_current;
uint32_t dt_buffer[30];
uint32_t empty_reports;
int64_t last_time;
int64_t gyro_to_analog_activation_treshold;
int64_t gyro_to_analog_mapping;
} virt_dualsense_t;
int virt_dualsense_init(
virt_dualsense_t *const gamepad,
bool bluetooth,
bool dualsense_edge,
int64_t gyro_to_analog_activation_treshold,
int64_t gyro_to_analog_mapping
);
int virt_dualsense_get_fd(
virt_dualsense_t *const gamepad
);
int virt_dualsense_event(
virt_dualsense_t *const gamepad,
gamepad_status_t *const out_device_status
);
void virt_dualsense_compose(
virt_dualsense_t *const gamepad,
gamepad_status_t *const in_device_status,
uint8_t *const out_buf
);
int virt_dualsense_send(
virt_dualsense_t *const gamepad,
uint8_t *const out_buf
);
void virt_dualsense_close(
virt_dualsense_t *const gamepad
);