Dr Andrew Scott G7VAV

My photo
 
June 2025
Mo Tu We Th Fr Sa Su
26 27 28 29 30 31 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 27 28 29
30 1 2 3 4 5 6


joystick.h
001: #ifndef _LINUX_JOYSTICK_H
002: #define _LINUX_JOYSTICK_H
003: 
004: /*
005:  *  Copyright (C) 1996-2000 Vojtech Pavlik
006:  *
007:  *  Sponsored by SuSE
008:  */
009: 
010: /*
011:  * This program is free software; you can redistribute it and/or modify
012:  * it under the terms of the GNU General Public License as published by
013:  * the Free Software Foundation; either version 2 of the License, or 
014:  * (at your option) any later version.
015:  * 
016:  * This program is distributed in the hope that it will be useful,
017:  * but WITHOUT ANY WARRANTY; without even the implied warranty of
018:  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
019:  * GNU General Public License for more details.
020:  * 
021:  * You should have received a copy of the GNU General Public License
022:  * along with this program; if not, write to the Free Software
023:  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
024:  * 
025:  * Should you need to contact me, the author, you can do so either by
026:  * e-mail - mail your message to <vojtech@suse.cz>, or by paper mail:
027:  * Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic
028:  */
029: 
030: #include <linux/types.h>
031: #include <linux/input.h>
032: 
033: /*
034:  * Version
035:  */
036: 
037: #define JS_VERSION              0x020100
038: 
039: /*
040:  * Types and constants for reading from /dev/js
041:  */
042: 
043: #define JS_EVENT_BUTTON         0x01    /* button pressed/released */
044: #define JS_EVENT_AXIS           0x02    /* joystick moved */
045: #define JS_EVENT_INIT           0x80    /* initial state of device */
046: 
047: struct js_event {
048:         __u32 time;     /* event timestamp in milliseconds */
049:         __s16 value;    /* value */
050:         __u8 type;      /* event type */
051:         __u8 number;    /* axis/button number */
052: };
053: 
054: /*
055:  * IOCTL commands for joystick driver
056:  */
057: 
058: #define JSIOCGVERSION           _IOR('j', 0x01, __u32)                          /* get driver version */
059: 
060: #define JSIOCGAXES              _IOR('j', 0x11, __u8)                           /* get number of axes */
061: #define JSIOCGBUTTONS           _IOR('j', 0x12, __u8)                           /* get number of buttons */
062: #define JSIOCGNAME(len)         _IOC(_IOC_READ, 'j', 0x13, len)                 /* get identifier string */
063: 
064: #define JSIOCSCORR              _IOW('j', 0x21, struct js_corr)                 /* set correction values */
065: #define JSIOCGCORR              _IOR('j', 0x22, struct js_corr)                 /* get correction values */
066: 
067: #define JSIOCSAXMAP             _IOW('j', 0x31, __u8[ABS_CNT])                  /* set axis mapping */
068: #define JSIOCGAXMAP             _IOR('j', 0x32, __u8[ABS_CNT])                  /* get axis mapping */
069: #define JSIOCSBTNMAP            _IOW('j', 0x33, __u16[KEY_MAX - BTN_MISC + 1])  /* set button mapping */
070: #define JSIOCGBTNMAP            _IOR('j', 0x34, __u16[KEY_MAX - BTN_MISC + 1])  /* get button mapping */
071: 
072: /*
073:  * Types and constants for get/set correction
074:  */
075: 
076: #define JS_CORR_NONE            0x00    /* returns raw values */
077: #define JS_CORR_BROKEN          0x01    /* broken line */
078: 
079: struct js_corr {
080:         __s32 coef[8];
081:         __s16 prec;
082:         __u16 type;
083: };
084: 
085: /*
086:  * v0.x compatibility definitions
087:  */
088: 
089: #define JS_RETURN               sizeof(struct JS_DATA_TYPE)
090: #define JS_TRUE                 1
091: #define JS_FALSE                0
092: #define JS_X_0                  0x01
093: #define JS_Y_0                  0x02
094: #define JS_X_1                  0x04
095: #define JS_Y_1                  0x08
096: #define JS_MAX                  2
097: 
098: #define JS_DEF_TIMEOUT          0x1300
099: #define JS_DEF_CORR             0
100: #define JS_DEF_TIMELIMIT        10L
101: 
102: #define JS_SET_CAL              1
103: #define JS_GET_CAL              2
104: #define JS_SET_TIMEOUT          3
105: #define JS_GET_TIMEOUT          4
106: #define JS_SET_TIMELIMIT        5
107: #define JS_GET_TIMELIMIT        6
108: #define JS_GET_ALL              7
109: #define JS_SET_ALL              8
110: 
111: struct JS_DATA_TYPE {
112:         __s32 buttons;
113:         __s32 x;
114:         __s32 y;
115: };
116: 
117: struct JS_DATA_SAVE_TYPE_32 {
118:         __s32 JS_TIMEOUT;
119:         __s32 BUSY;
120:         __s32 JS_EXPIRETIME;
121:         __s32 JS_TIMELIMIT;
122:         struct JS_DATA_TYPE JS_SAVE;
123:         struct JS_DATA_TYPE JS_CORR;
124: };
125: 
126: struct JS_DATA_SAVE_TYPE_64 {
127:         __s32 JS_TIMEOUT;
128:         __s32 BUSY;
129:         __s64 JS_EXPIRETIME;
130:         __s64 JS_TIMELIMIT;
131:         struct JS_DATA_TYPE JS_SAVE;
132:         struct JS_DATA_TYPE JS_CORR;
133: };
134: 
135: 
136: #endif /* _LINUX_JOYSTICK_H */
137: 


for client (none)
© Andrew Scott 2006 - 2025,
All Rights Reserved
http://www.andrew-scott.uk/
Andrew Scott
http://www.andrew-scott.co.uk/