1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22#ifndef _UAPI_LINUX_JOYSTICK_H
23#define _UAPI_LINUX_JOYSTICK_H
24
25
26
27#include <linux/types.h>
28#include <linux/input.h>
29
30
31
32
33
34#define JS_VERSION 0x020100
35
36
37
38
39
40#define JS_EVENT_BUTTON 0x01
41#define JS_EVENT_AXIS 0x02
42#define JS_EVENT_INIT 0x80
43
44struct js_event {
45 __u32 time;
46 __s16 value;
47 __u8 type;
48 __u8 number;
49};
50
51
52
53
54
55#define JSIOCGVERSION _IOR('j', 0x01, __u32)
56
57#define JSIOCGAXES _IOR('j', 0x11, __u8)
58#define JSIOCGBUTTONS _IOR('j', 0x12, __u8)
59#define JSIOCGNAME(len) _IOC(_IOC_READ, 'j', 0x13, len)
60
61#define JSIOCSCORR _IOW('j', 0x21, struct js_corr)
62#define JSIOCGCORR _IOR('j', 0x22, struct js_corr)
63
64#define JSIOCSAXMAP _IOW('j', 0x31, __u8[ABS_CNT])
65#define JSIOCGAXMAP _IOR('j', 0x32, __u8[ABS_CNT])
66#define JSIOCSBTNMAP _IOW('j', 0x33, __u16[KEY_MAX - BTN_MISC + 1])
67#define JSIOCGBTNMAP _IOR('j', 0x34, __u16[KEY_MAX - BTN_MISC + 1])
68
69
70
71
72
73#define JS_CORR_NONE 0x00
74#define JS_CORR_BROKEN 0x01
75
76struct js_corr {
77 __s32 coef[8];
78 __s16 prec;
79 __u16 type;
80};
81
82
83
84
85
86#define JS_RETURN sizeof(struct JS_DATA_TYPE)
87#define JS_TRUE 1
88#define JS_FALSE 0
89#define JS_X_0 0x01
90#define JS_Y_0 0x02
91#define JS_X_1 0x04
92#define JS_Y_1 0x08
93#define JS_MAX 2
94
95#define JS_DEF_TIMEOUT 0x1300
96#define JS_DEF_CORR 0
97#define JS_DEF_TIMELIMIT 10L
98
99#define JS_SET_CAL 1
100#define JS_GET_CAL 2
101#define JS_SET_TIMEOUT 3
102#define JS_GET_TIMEOUT 4
103#define JS_SET_TIMELIMIT 5
104#define JS_GET_TIMELIMIT 6
105#define JS_GET_ALL 7
106#define JS_SET_ALL 8
107
108struct JS_DATA_TYPE {
109 __s32 buttons;
110 __s32 x;
111 __s32 y;
112};
113
114struct JS_DATA_SAVE_TYPE_32 {
115 __s32 JS_TIMEOUT;
116 __s32 BUSY;
117 __s32 JS_EXPIRETIME;
118 __s32 JS_TIMELIMIT;
119 struct JS_DATA_TYPE JS_SAVE;
120 struct JS_DATA_TYPE JS_CORR;
121};
122
123struct JS_DATA_SAVE_TYPE_64 {
124 __s32 JS_TIMEOUT;
125 __s32 BUSY;
126 __s64 JS_EXPIRETIME;
127 __s64 JS_TIMELIMIT;
128 struct JS_DATA_TYPE JS_SAVE;
129 struct JS_DATA_TYPE JS_CORR;
130};
131
132
133#endif
134