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