| 1 | #ifndef _LINUX_JOYSTICK_H |
|---|
| 2 | #define _LINUX_JOYSTICK_H |
|---|
| 3 | |
|---|
| 4 | /* |
|---|
| 5 | * |
|---|
| 6 | * Copyright (C) 1996-2000 Vojtech Pavlik |
|---|
| 7 | * |
|---|
| 8 | * Sponsored by SuSE |
|---|
| 9 | */ |
|---|
| 10 | |
|---|
| 11 | /* |
|---|
| 12 | * This program is free software; you can redistribute it and/or modify |
|---|
| 13 | * it under the terms of the GNU General Public License as published by |
|---|
| 14 | * the Free Software Foundation; either version 2 of the License, or |
|---|
| 15 | * (at your option) any later version. |
|---|
| 16 | * |
|---|
| 17 | * This program is distributed in the hope that it will be useful, |
|---|
| 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 20 | * GNU General Public License for more details. |
|---|
| 21 | * |
|---|
| 22 | * You should have received a copy of the GNU General Public License |
|---|
| 23 | * along with this program; if not, write to the Free Software |
|---|
| 24 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|---|
| 25 | * |
|---|
| 26 | * Should you need to contact me, the author, you can do so either by |
|---|
| 27 | * e-mail - mail your message to <vojtech@suse.cz>, or by paper mail: |
|---|
| 28 | * Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic |
|---|
| 29 | */ |
|---|
| 30 | |
|---|
| 31 | #include <asm/types.h> |
|---|
| 32 | #include <linux/input.h> |
|---|
| 33 | |
|---|
| 34 | /* |
|---|
| 35 | * Version |
|---|
| 36 | */ |
|---|
| 37 | |
|---|
| 38 | #define JS_VERSION 0x020100 |
|---|
| 39 | |
|---|
| 40 | /* |
|---|
| 41 | * Types and constants for reading from /dev/js |
|---|
| 42 | */ |
|---|
| 43 | |
|---|
| 44 | #define JS_EVENT_BUTTON 0x01 /* button pressed/released */ |
|---|
| 45 | #define JS_EVENT_AXIS 0x02 /* joystick moved */ |
|---|
| 46 | #define JS_EVENT_INIT 0x80 /* initial state of device */ |
|---|
| 47 | |
|---|
| 48 | struct js_event { |
|---|
| 49 | __u32 time; /* event timestamp in milliseconds */ |
|---|
| 50 | __s16 value; /* value */ |
|---|
| 51 | __u8 type; /* event type */ |
|---|
| 52 | __u8 number; /* axis/button number */ |
|---|
| 53 | }; |
|---|
| 54 | |
|---|
| 55 | /* |
|---|
| 56 | * IOCTL commands for joystick driver |
|---|
| 57 | */ |
|---|
| 58 | |
|---|
| 59 | #define JSIOCGVERSION _IOR('j', 0x01, __u32) /* get driver version */ |
|---|
| 60 | |
|---|
| 61 | #define JSIOCGAXES _IOR('j', 0x11, __u8) /* get number of axes */ |
|---|
| 62 | #define JSIOCGBUTTONS _IOR('j', 0x12, __u8) /* get number of buttons */ |
|---|
| 63 | #define JSIOCGNAME(len) _IOC(_IOC_READ, 'j', 0x13, len) /* get identifier string */ |
|---|
| 64 | |
|---|
| 65 | #define JSIOCSCORR _IOW('j', 0x21, struct js_corr) /* set correction values */ |
|---|
| 66 | #define JSIOCGCORR _IOR('j', 0x22, struct js_corr) /* get correction values */ |
|---|
| 67 | |
|---|
| 68 | #define JSIOCSAXMAP _IOW('j', 0x31, __u8[ABS_MAX + 1]) /* set axis mapping */ |
|---|
| 69 | #define JSIOCGAXMAP _IOR('j', 0x32, __u8[ABS_MAX + 1]) /* get axis mapping */ |
|---|
| 70 | #define JSIOCSBTNMAP _IOW('j', 0x33, __u16[KEY_MAX - BTN_MISC + 1]) /* set button mapping */ |
|---|
| 71 | #define JSIOCGBTNMAP _IOR('j', 0x34, __u16[KEY_MAX - BTN_MISC + 1]) /* get button mapping */ |
|---|
| 72 | |
|---|
| 73 | /* |
|---|
| 74 | * Types and constants for get/set correction |
|---|
| 75 | */ |
|---|
| 76 | |
|---|
| 77 | #define JS_CORR_NONE 0x00 /* returns raw values */ |
|---|
| 78 | #define JS_CORR_BROKEN 0x01 /* broken line */ |
|---|
| 79 | |
|---|
| 80 | struct js_corr { |
|---|
| 81 | __s32 coef[8]; |
|---|
| 82 | __s16 prec; |
|---|
| 83 | __u16 type; |
|---|
| 84 | }; |
|---|
| 85 | |
|---|
| 86 | /* |
|---|
| 87 | * v0.x compatibility definitions |
|---|
| 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 | |
|---|
| 112 | struct JS_DATA_TYPE { |
|---|
| 113 | int buttons; |
|---|
| 114 | int x; |
|---|
| 115 | int y; |
|---|
| 116 | }; |
|---|
| 117 | |
|---|
| 118 | struct JS_DATA_SAVE_TYPE { |
|---|
| 119 | int JS_TIMEOUT; |
|---|
| 120 | int BUSY; |
|---|
| 121 | long JS_EXPIRETIME; |
|---|
| 122 | long JS_TIMELIMIT; |
|---|
| 123 | struct JS_DATA_TYPE JS_SAVE; |
|---|
| 124 | struct JS_DATA_TYPE JS_CORR; |
|---|
| 125 | }; |
|---|
| 126 | |
|---|
| 127 | #endif /* _LINUX_JOYSTICK_H */ |
|---|