Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
0002 /*
0003  *  Copyright (C) 1996-2000 Vojtech Pavlik
0004  *
0005  *  Sponsored by SuSE
0006  */
0007 /*
0008  * This program is free software; you can redistribute it and/or modify
0009  * it under the terms of the GNU General Public License as published by
0010  * the Free Software Foundation; either version 2 of the License, or 
0011  * (at your option) any later version.
0012  * 
0013  * This program is distributed in the hope that it will be useful,
0014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0016  * GNU General Public License for more details.
0017  * 
0018  * You should have received a copy of the GNU General Public License
0019  * along with this program; if not, write to the Free Software
0020  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
0021  */
0022 #ifndef _UAPI_LINUX_JOYSTICK_H
0023 #define _UAPI_LINUX_JOYSTICK_H
0024 
0025 
0026 
0027 #include <linux/types.h>
0028 #include <linux/input.h>
0029 
0030 /*
0031  * Version
0032  */
0033 
0034 #define JS_VERSION      0x020100
0035 
0036 /*
0037  * Types and constants for reading from /dev/js
0038  */
0039 
0040 #define JS_EVENT_BUTTON     0x01    /* button pressed/released */
0041 #define JS_EVENT_AXIS       0x02    /* joystick moved */
0042 #define JS_EVENT_INIT       0x80    /* initial state of device */
0043 
0044 struct js_event {
0045     __u32 time; /* event timestamp in milliseconds */
0046     __s16 value;    /* value */
0047     __u8 type;  /* event type */
0048     __u8 number;    /* axis/button number */
0049 };
0050 
0051 /*
0052  * IOCTL commands for joystick driver
0053  */
0054 
0055 #define JSIOCGVERSION       _IOR('j', 0x01, __u32)              /* get driver version */
0056 
0057 #define JSIOCGAXES      _IOR('j', 0x11, __u8)               /* get number of axes */
0058 #define JSIOCGBUTTONS       _IOR('j', 0x12, __u8)               /* get number of buttons */
0059 #define JSIOCGNAME(len)     _IOC(_IOC_READ, 'j', 0x13, len)         /* get identifier string */
0060 
0061 #define JSIOCSCORR      _IOW('j', 0x21, struct js_corr)         /* set correction values */
0062 #define JSIOCGCORR      _IOR('j', 0x22, struct js_corr)         /* get correction values */
0063 
0064 #define JSIOCSAXMAP     _IOW('j', 0x31, __u8[ABS_CNT])          /* set axis mapping */
0065 #define JSIOCGAXMAP     _IOR('j', 0x32, __u8[ABS_CNT])          /* get axis mapping */
0066 #define JSIOCSBTNMAP        _IOW('j', 0x33, __u16[KEY_MAX - BTN_MISC + 1])  /* set button mapping */
0067 #define JSIOCGBTNMAP        _IOR('j', 0x34, __u16[KEY_MAX - BTN_MISC + 1])  /* get button mapping */
0068 
0069 /*
0070  * Types and constants for get/set correction
0071  */
0072 
0073 #define JS_CORR_NONE        0x00    /* returns raw values */
0074 #define JS_CORR_BROKEN      0x01    /* broken line */
0075 
0076 struct js_corr {
0077     __s32 coef[8];
0078     __s16 prec;
0079     __u16 type;
0080 };
0081 
0082 /*
0083  * v0.x compatibility definitions
0084  */
0085 
0086 #define JS_RETURN       sizeof(struct JS_DATA_TYPE)
0087 #define JS_TRUE         1
0088 #define JS_FALSE        0
0089 #define JS_X_0          0x01
0090 #define JS_Y_0          0x02
0091 #define JS_X_1          0x04
0092 #define JS_Y_1          0x08
0093 #define JS_MAX          2
0094 
0095 #define JS_DEF_TIMEOUT      0x1300
0096 #define JS_DEF_CORR     0
0097 #define JS_DEF_TIMELIMIT    10L
0098 
0099 #define JS_SET_CAL      1
0100 #define JS_GET_CAL      2
0101 #define JS_SET_TIMEOUT      3
0102 #define JS_GET_TIMEOUT      4
0103 #define JS_SET_TIMELIMIT    5
0104 #define JS_GET_TIMELIMIT    6
0105 #define JS_GET_ALL      7
0106 #define JS_SET_ALL      8
0107 
0108 struct JS_DATA_TYPE {
0109     __s32 buttons;
0110     __s32 x;
0111     __s32 y;
0112 };
0113 
0114 struct JS_DATA_SAVE_TYPE_32 {
0115     __s32 JS_TIMEOUT;
0116     __s32 BUSY;
0117     __s32 JS_EXPIRETIME;
0118     __s32 JS_TIMELIMIT;
0119     struct JS_DATA_TYPE JS_SAVE;
0120     struct JS_DATA_TYPE JS_CORR;
0121 };
0122 
0123 struct JS_DATA_SAVE_TYPE_64 {
0124     __s32 JS_TIMEOUT;
0125     __s32 BUSY;
0126     __s64 JS_EXPIRETIME;
0127     __s64 JS_TIMELIMIT;
0128     struct JS_DATA_TYPE JS_SAVE;
0129     struct JS_DATA_TYPE JS_CORR;
0130 };
0131 
0132 
0133 #endif /* _UAPI_LINUX_JOYSTICK_H */