-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvg_uinput.h
46 lines (32 loc) · 1.31 KB
/
vg_uinput.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
/*
* rubusd - A deamon for communicating with Joy-Con devices
* Copyright (C) 2020 TechnoElf
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef VG_UINPUT_H
#define VG_UINPUT_H
#include "vg_common.h"
#include <linux/input.h>
#define VG_UI_TRY(f) { int temp = (int) f; if (temp < 0) { return VG_ERR; } }
#define VG_UI_TRY_UNWRAP(n, f) { n = f; if ((int) n < 0) { return VG_ERR; } }
typedef struct VGUIDevice {
int dev;
} VGUIDevice;
VGUIDevice* vg_ui_create(uint16_t vid, uint16_t pid, const char* name);
VG_RESULT vg_ui_destroy(VGUIDevice* vg_ui);
VG_RESULT vg_ui_button(uint16_t code, uint8_t val, VGUIDevice* vg_ui);
VG_RESULT vg_ui_axis(uint16_t code, int8_t val, VGUIDevice* vg_ui);
VG_RESULT vg_ui_flush(VGUIDevice* vg_ui);
#endif