/*
* Copyright (C) 1996-2000 Vojtech Pavlik
*
* Sponsored by SuSE
*/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Should you need to contact me, the author, you can do so either by
* e-mail - mail your message to , or by paper mail:
* Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic
*/
#ifndef _UAPI_LINUX_JOYSTICK_H
#define _UAPI_LINUX_JOYSTICK_H
#include
#include
/*
* Version
*/
#define JS_VERSION0x020100
/*
* Types and constants for reading from /dev/js
*/
#define JS_EVENT_BUTTON0x01/* button pressed/released */
#define JS_EVENT_AXIS0x02/* joystick moved */
#define JS_EVENT_INIT0x80/* initial state of device */
struct js_event {
__u32 time;/* event timestamp in milliseconds */
__s16 value;/* value */
__u8 type;/* event type */
__u8 number;/* axis/button number */
};
/*
* IOCTL commands for joystick driver
*/
#define JSIOCGVERSION_IOR('j', 0x01, __u32)/* get driver version */
#define JSIOCGAXES_IOR('j', 0x11, __u8)/* get number of axes */
#define JSIOCGBUTTONS_IOR('j', 0x12, __u8)/* get number of buttons */
#define JSIOCGNAME(len)_IOC(_IOC_READ, 'j', 0x13, len)/* get identifier string */
#define JSIOCSCORR_IOW('j', 0x21, struct js_corr)/* set correction values */
#define JSIOCGCORR_IOR('j', 0x22, struct js_corr)/* get correction values */
#define JSIOCSAXMAP_IOW('j', 0x31, __u8[ABS_CNT])/* set axis mapping */
#define JSIOCGAXMAP_IOR('j', 0x32, __u8[ABS_CNT])/* get axis mapping */
#define JSIOCSBTNMAP_IOW('j', 0x33, __u16[KEY_MAX - BTN_MISC + 1])/* set button mapping */
#define JSIOCGBTNMAP_IOR('j', 0x34, __u16[KEY_MAX - BTN_MISC + 1])/* get button mapping */
/*
* Types and constants for get/set correction
*/
#define JS_CORR_NONE0x00/* returns raw values */
#define JS_CORR_BROKEN0x01/* broken line */
struct js_corr {
__s32 coef[8];
__s16 prec;
__u16 type;
};
/*
* v0.x compatibility definitions
*/
#define JS_RETURNsizeof(struct JS_DATA_TYPE)
#define JS_TRUE1
#define JS_FALSE0
#define JS_X_00x01
#define JS_Y_00x02
#define JS_X_10x04
#define JS_Y_10x08
#define JS_MAX2
#define JS_DEF_TIMEOUT0x1300
#define JS_DEF_CORR0
#define JS_DEF_TIMELIMIT10L
#define JS_SET_CAL1
#define JS_GET_CAL2
#define JS_SET_TIMEOUT3
#define JS_GET_TIMEOUT4
#define JS_SET_TIMELIMIT5
#define JS_GET_TIMELIMIT6
#define JS_GET_ALL7
#define JS_SET_ALL8
struct JS_DATA_TYPE {
__s32 buttons;
__s32 x;
__s32 y;
};
struct JS_DATA_SAVE_TYPE_32 {
__s32 JS_TIMEOUT;
__s32 BUSY;
__s32 JS_EXPIRETIME;
__s32 JS_TIMELIMIT;
struct JS_DATA_TYPE JS_SAVE;
struct JS_DATA_TYPE JS_CORR;
};
struct JS_DATA_SAVE_TYPE_64 {
__s32 JS_TIMEOUT;
__s32 BUSY;
__s64 JS_EXPIRETIME;
__s64 JS_TIMELIMIT;
struct JS_DATA_TYPE JS_SAVE;
struct JS_DATA_TYPE JS_CORR;
};
#endif /* _UAPI_LINUX_JOYSTICK_H */
一键复制
编辑
Web IDE
原始数据
按行查看
历史