1 #ifndef _LINUX_JOYSTICK_H
2 #define _LINUX_JOYSTICK_H
5 * Copyright (C) 1996-2000 Vojtech Pavlik
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 * Should you need to contact me, the author, you can do so either by
26 * e-mail - mail your message to <vojtech@suse.cz>, or by paper mail:
27 * Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic
30 #include <asm/types.h>
31 #include <linux/input.h>
37 #define JS_VERSION 0x020100
40 * Types and constants for reading from /dev/js
43 #define JS_EVENT_BUTTON 0x01 /* button pressed/released */
44 #define JS_EVENT_AXIS 0x02 /* joystick moved */
45 #define JS_EVENT_INIT 0x80 /* initial state of device */
48 __u32 time; /* event timestamp in milliseconds */
49 __s16 value; /* value */
50 __u8 type; /* event type */
51 __u8 number; /* axis/button number */
55 * IOCTL commands for joystick driver
58 #define JSIOCGVERSION _IOR('j', 0x01, __u32) /* get driver version */
60 #define JSIOCGAXES _IOR('j', 0x11, __u8) /* get number of axes */
61 #define JSIOCGBUTTONS _IOR('j', 0x12, __u8) /* get number of buttons */
62 #define JSIOCGNAME(len) _IOC(_IOC_READ, 'j', 0x13, len) /* get identifier string */
64 #define JSIOCSCORR _IOW('j', 0x21, struct js_corr) /* set correction values */
65 #define JSIOCGCORR _IOR('j', 0x22, struct js_corr) /* get correction values */
67 #define JSIOCSAXMAP _IOW('j', 0x31, __u8[ABS_MAX + 1]) /* set axis mapping */
68 #define JSIOCGAXMAP _IOR('j', 0x32, __u8[ABS_MAX + 1]) /* get axis mapping */
69 #define JSIOCSBTNMAP _IOW('j', 0x33, __u16[KEY_MAX - BTN_MISC + 1]) /* set button mapping */
70 #define JSIOCGBTNMAP _IOR('j', 0x34, __u16[KEY_MAX - BTN_MISC + 1]) /* get button mapping */
73 * Types and constants for get/set correction
76 #define JS_CORR_NONE 0x00 /* returns raw values */
77 #define JS_CORR_BROKEN 0x01 /* broken line */
86 * v0.x compatibility definitions
89 #define JS_RETURN sizeof(struct JS_DATA_TYPE)
98 #define JS_DEF_TIMEOUT 0x1300
100 #define JS_DEF_TIMELIMIT 10L
104 #define JS_SET_TIMEOUT 3
105 #define JS_GET_TIMEOUT 4
106 #define JS_SET_TIMELIMIT 5
107 #define JS_GET_TIMELIMIT 6
111 struct JS_DATA_TYPE {
117 struct JS_DATA_SAVE_TYPE_32 {
122 struct JS_DATA_TYPE JS_SAVE;
123 struct JS_DATA_TYPE JS_CORR;
126 struct JS_DATA_SAVE_TYPE_64 {
131 struct JS_DATA_TYPE JS_SAVE;
132 struct JS_DATA_TYPE JS_CORR;
136 #if BITS_PER_LONG == 64
137 #define JS_DATA_SAVE_TYPE JS_DATA_SAVE_TYPE_64
138 #elif BITS_PER_LONG == 32
139 #define JS_DATA_SAVE_TYPE JS_DATA_SAVE_TYPE_32
141 #error Unexpected BITS_PER_LONG
145 #endif /* _LINUX_JOYSTICK_H */