1 /* SPDX-License-Identifier: GPL-2.0+ WITH Linu << 2 /* 1 /* 3 * Copyright (C) 1996-2000 Vojtech Pavlik 2 * Copyright (C) 1996-2000 Vojtech Pavlik 4 * 3 * 5 * Sponsored by SuSE 4 * Sponsored by SuSE 6 */ 5 */ 7 /* 6 /* 8 * This program is free software; you can redi 7 * This program is free software; you can redistribute it and/or modify 9 * it under the terms of the GNU General Publi 8 * it under the terms of the GNU General Public License as published by 10 * the Free Software Foundation; either versio 9 * the Free Software Foundation; either version 2 of the License, or 11 * (at your option) any later version. 10 * (at your option) any later version. 12 * 11 * 13 * This program is distributed in the hope tha 12 * This program is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * GNU General Public License for more details 15 * GNU General Public License for more details. 17 * 16 * 18 * You should have received a copy of the GNU 17 * You should have received a copy of the GNU General Public License 19 * along with this program; if not, write to t 18 * along with this program; if not, write to the Free Software 20 * Foundation, Inc., 59 Temple Place, Suite 33 19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA >> 20 * >> 21 * Should you need to contact me, the author, you can do so either by >> 22 * e-mail - mail your message to <vojtech@suse.cz>, or by paper mail: >> 23 * Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic 21 */ 24 */ 22 #ifndef _UAPI_LINUX_JOYSTICK_H 25 #ifndef _UAPI_LINUX_JOYSTICK_H 23 #define _UAPI_LINUX_JOYSTICK_H 26 #define _UAPI_LINUX_JOYSTICK_H 24 27 25 28 26 29 27 #include <linux/types.h> 30 #include <linux/types.h> 28 #include <linux/input.h> 31 #include <linux/input.h> 29 32 30 /* 33 /* 31 * Version 34 * Version 32 */ 35 */ 33 36 34 #define JS_VERSION 0x020100 37 #define JS_VERSION 0x020100 35 38 36 /* 39 /* 37 * Types and constants for reading from /dev/j 40 * Types and constants for reading from /dev/js 38 */ 41 */ 39 42 40 #define JS_EVENT_BUTTON 0x01 /* but 43 #define JS_EVENT_BUTTON 0x01 /* button pressed/released */ 41 #define JS_EVENT_AXIS 0x02 /* joy 44 #define JS_EVENT_AXIS 0x02 /* joystick moved */ 42 #define JS_EVENT_INIT 0x80 /* ini 45 #define JS_EVENT_INIT 0x80 /* initial state of device */ 43 46 44 struct js_event { 47 struct js_event { 45 __u32 time; /* event timestamp in 48 __u32 time; /* event timestamp in milliseconds */ 46 __s16 value; /* value */ 49 __s16 value; /* value */ 47 __u8 type; /* event type */ 50 __u8 type; /* event type */ 48 __u8 number; /* axis/button number 51 __u8 number; /* axis/button number */ 49 }; 52 }; 50 53 51 /* 54 /* 52 * IOCTL commands for joystick driver 55 * IOCTL commands for joystick driver 53 */ 56 */ 54 57 55 #define JSIOCGVERSION _IOR('j', 0x01 58 #define JSIOCGVERSION _IOR('j', 0x01, __u32) /* get driver version */ 56 59 57 #define JSIOCGAXES _IOR('j', 0x11 60 #define JSIOCGAXES _IOR('j', 0x11, __u8) /* get number of axes */ 58 #define JSIOCGBUTTONS _IOR('j', 0x12 61 #define JSIOCGBUTTONS _IOR('j', 0x12, __u8) /* get number of buttons */ 59 #define JSIOCGNAME(len) _IOC(_IOC_READ 62 #define JSIOCGNAME(len) _IOC(_IOC_READ, 'j', 0x13, len) /* get identifier string */ 60 63 61 #define JSIOCSCORR _IOW('j', 0x21 64 #define JSIOCSCORR _IOW('j', 0x21, struct js_corr) /* set correction values */ 62 #define JSIOCGCORR _IOR('j', 0x22 65 #define JSIOCGCORR _IOR('j', 0x22, struct js_corr) /* get correction values */ 63 66 64 #define JSIOCSAXMAP _IOW('j', 0x31 67 #define JSIOCSAXMAP _IOW('j', 0x31, __u8[ABS_CNT]) /* set axis mapping */ 65 #define JSIOCGAXMAP _IOR('j', 0x32 68 #define JSIOCGAXMAP _IOR('j', 0x32, __u8[ABS_CNT]) /* get axis mapping */ 66 #define JSIOCSBTNMAP _IOW('j', 0x33 69 #define JSIOCSBTNMAP _IOW('j', 0x33, __u16[KEY_MAX - BTN_MISC + 1]) /* set button mapping */ 67 #define JSIOCGBTNMAP _IOR('j', 0x34 70 #define JSIOCGBTNMAP _IOR('j', 0x34, __u16[KEY_MAX - BTN_MISC + 1]) /* get button mapping */ 68 71 69 /* 72 /* 70 * Types and constants for get/set correction 73 * Types and constants for get/set correction 71 */ 74 */ 72 75 73 #define JS_CORR_NONE 0x00 /* ret 76 #define JS_CORR_NONE 0x00 /* returns raw values */ 74 #define JS_CORR_BROKEN 0x01 /* bro 77 #define JS_CORR_BROKEN 0x01 /* broken line */ 75 78 76 struct js_corr { 79 struct js_corr { 77 __s32 coef[8]; 80 __s32 coef[8]; 78 __s16 prec; 81 __s16 prec; 79 __u16 type; 82 __u16 type; 80 }; 83 }; 81 84 82 /* 85 /* 83 * v0.x compatibility definitions 86 * v0.x compatibility definitions 84 */ 87 */ 85 88 86 #define JS_RETURN sizeof(struct 89 #define JS_RETURN sizeof(struct JS_DATA_TYPE) 87 #define JS_TRUE 1 90 #define JS_TRUE 1 88 #define JS_FALSE 0 91 #define JS_FALSE 0 89 #define JS_X_0 0x01 92 #define JS_X_0 0x01 90 #define JS_Y_0 0x02 93 #define JS_Y_0 0x02 91 #define JS_X_1 0x04 94 #define JS_X_1 0x04 92 #define JS_Y_1 0x08 95 #define JS_Y_1 0x08 93 #define JS_MAX 2 96 #define JS_MAX 2 94 97 95 #define JS_DEF_TIMEOUT 0x1300 98 #define JS_DEF_TIMEOUT 0x1300 96 #define JS_DEF_CORR 0 99 #define JS_DEF_CORR 0 97 #define JS_DEF_TIMELIMIT 10L 100 #define JS_DEF_TIMELIMIT 10L 98 101 99 #define JS_SET_CAL 1 102 #define JS_SET_CAL 1 100 #define JS_GET_CAL 2 103 #define JS_GET_CAL 2 101 #define JS_SET_TIMEOUT 3 104 #define JS_SET_TIMEOUT 3 102 #define JS_GET_TIMEOUT 4 105 #define JS_GET_TIMEOUT 4 103 #define JS_SET_TIMELIMIT 5 106 #define JS_SET_TIMELIMIT 5 104 #define JS_GET_TIMELIMIT 6 107 #define JS_GET_TIMELIMIT 6 105 #define JS_GET_ALL 7 108 #define JS_GET_ALL 7 106 #define JS_SET_ALL 8 109 #define JS_SET_ALL 8 107 110 108 struct JS_DATA_TYPE { 111 struct JS_DATA_TYPE { 109 __s32 buttons; 112 __s32 buttons; 110 __s32 x; 113 __s32 x; 111 __s32 y; 114 __s32 y; 112 }; 115 }; 113 116 114 struct JS_DATA_SAVE_TYPE_32 { 117 struct JS_DATA_SAVE_TYPE_32 { 115 __s32 JS_TIMEOUT; 118 __s32 JS_TIMEOUT; 116 __s32 BUSY; 119 __s32 BUSY; 117 __s32 JS_EXPIRETIME; 120 __s32 JS_EXPIRETIME; 118 __s32 JS_TIMELIMIT; 121 __s32 JS_TIMELIMIT; 119 struct JS_DATA_TYPE JS_SAVE; 122 struct JS_DATA_TYPE JS_SAVE; 120 struct JS_DATA_TYPE JS_CORR; 123 struct JS_DATA_TYPE JS_CORR; 121 }; 124 }; 122 125 123 struct JS_DATA_SAVE_TYPE_64 { 126 struct JS_DATA_SAVE_TYPE_64 { 124 __s32 JS_TIMEOUT; 127 __s32 JS_TIMEOUT; 125 __s32 BUSY; 128 __s32 BUSY; 126 __s64 JS_EXPIRETIME; 129 __s64 JS_EXPIRETIME; 127 __s64 JS_TIMELIMIT; 130 __s64 JS_TIMELIMIT; 128 struct JS_DATA_TYPE JS_SAVE; 131 struct JS_DATA_TYPE JS_SAVE; 129 struct JS_DATA_TYPE JS_CORR; 132 struct JS_DATA_TYPE JS_CORR; 130 }; 133 }; 131 134 132 135 133 #endif /* _UAPI_LINUX_JOYSTICK_H */ 136 #endif /* _UAPI_LINUX_JOYSTICK_H */ 134 137
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.