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