1 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
3 * Copyright (C) 1996-2000 Vojtech Pavlik
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #ifndef _UAPI_LINUX_JOYSTICK_H
23 #define _UAPI_LINUX_JOYSTICK_H
27 #include <linux/types.h>
28 #include <linux/input.h>
34 #define JS_VERSION 0x020100
37 * Types and constants for reading from /dev/js
40 #define JS_EVENT_BUTTON 0x01 /* button pressed/released */
41 #define JS_EVENT_AXIS 0x02 /* joystick moved */
42 #define JS_EVENT_INIT 0x80 /* initial state of device */
45 __u32 time; /* event timestamp in milliseconds */
46 __s16 value; /* value */
47 __u8 type; /* event type */
48 __u8 number; /* axis/button number */
52 * IOCTL commands for joystick driver
55 #define JSIOCGVERSION _IOR('j', 0x01, __u32) /* get driver version */
57 #define JSIOCGAXES _IOR('j', 0x11, __u8) /* get number of axes */
58 #define JSIOCGBUTTONS _IOR('j', 0x12, __u8) /* get number of buttons */
59 #define JSIOCGNAME(len) _IOC(_IOC_READ, 'j', 0x13, len) /* get identifier string */
61 #define JSIOCSCORR _IOW('j', 0x21, struct js_corr) /* set correction values */
62 #define JSIOCGCORR _IOR('j', 0x22, struct js_corr) /* get correction values */
64 #define JSIOCSAXMAP _IOW('j', 0x31, __u8[ABS_CNT]) /* set axis mapping */
65 #define JSIOCGAXMAP _IOR('j', 0x32, __u8[ABS_CNT]) /* get axis mapping */
66 #define JSIOCSBTNMAP _IOW('j', 0x33, __u16[KEY_MAX - BTN_MISC + 1]) /* set button mapping */
67 #define JSIOCGBTNMAP _IOR('j', 0x34, __u16[KEY_MAX - BTN_MISC + 1]) /* get button mapping */
70 * Types and constants for get/set correction
73 #define JS_CORR_NONE 0x00 /* returns raw values */
74 #define JS_CORR_BROKEN 0x01 /* broken line */
83 * v0.x compatibility definitions
86 #define JS_RETURN sizeof(struct JS_DATA_TYPE)
95 #define JS_DEF_TIMEOUT 0x1300
97 #define JS_DEF_TIMELIMIT 10L
101 #define JS_SET_TIMEOUT 3
102 #define JS_GET_TIMEOUT 4
103 #define JS_SET_TIMELIMIT 5
104 #define JS_GET_TIMELIMIT 6
108 struct JS_DATA_TYPE {
114 struct JS_DATA_SAVE_TYPE_32 {
119 struct JS_DATA_TYPE JS_SAVE;
120 struct JS_DATA_TYPE JS_CORR;
123 struct JS_DATA_SAVE_TYPE_64 {
128 struct JS_DATA_TYPE JS_SAVE;
129 struct JS_DATA_TYPE JS_CORR;
133 #endif /* _UAPI_LINUX_JOYSTICK_H */