Blame view

include/linux/joystick.h 3.71 KB
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1
2
3
4
  #ifndef _LINUX_JOYSTICK_H
  #define _LINUX_JOYSTICK_H
  
  /*
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
   *  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 <vojtech@suse.cz>, or by paper mail:
   * Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic
   */
00bfddaf7   Jaswinder Singh Rajput   include of <linux...
29
  #include <linux/types.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
  #include <linux/input.h>
  
  /*
   * Version
   */
  
  #define JS_VERSION		0x020100
  
  /*
   * Types and constants for reading from /dev/js
   */
  
  #define JS_EVENT_BUTTON		0x01	/* button pressed/released */
  #define JS_EVENT_AXIS		0x02	/* joystick moved */
  #define JS_EVENT_INIT		0x80	/* 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 */
81c2a3ba4   Daniel Mack   Input: use ABS_CN...
65
66
  #define JSIOCSAXMAP		_IOW('j', 0x31, __u8[ABS_CNT])			/* set axis mapping */
  #define JSIOCGAXMAP		_IOR('j', 0x32, __u8[ABS_CNT])			/* get axis mapping */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
  #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_NONE		0x00	/* returns raw values */
  #define JS_CORR_BROKEN		0x01	/* broken line */
  
  struct js_corr {
  	__s32 coef[8];
  	__s16 prec;
  	__u16 type;
  };
  
  /*
   * v0.x compatibility definitions
   */
  
  #define JS_RETURN		sizeof(struct JS_DATA_TYPE)
  #define JS_TRUE			1
  #define JS_FALSE		0
  #define JS_X_0			0x01
  #define JS_Y_0			0x02
  #define JS_X_1			0x04
  #define JS_Y_1			0x08
  #define JS_MAX			2
  
  #define JS_DEF_TIMEOUT		0x1300
  #define JS_DEF_CORR		0
  #define JS_DEF_TIMELIMIT	10L
  
  #define JS_SET_CAL		1
  #define JS_GET_CAL		2
  #define JS_SET_TIMEOUT		3
  #define JS_GET_TIMEOUT		4
  #define JS_SET_TIMELIMIT	5
  #define JS_GET_TIMELIMIT	6
  #define JS_GET_ALL		7
  #define JS_SET_ALL		8
  
  struct JS_DATA_TYPE {
d27317657   David Woodhouse   Switch to __s32 t...
110
111
112
  	__s32 buttons;
  	__s32 x;
  	__s32 y;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
113
  };
024ac44c7   Jeremy Fitzhardinge   Input: This patch...
114
  struct JS_DATA_SAVE_TYPE_32 {
d27317657   David Woodhouse   Switch to __s32 t...
115
116
117
118
  	__s32 JS_TIMEOUT;
  	__s32 BUSY;
  	__s32 JS_EXPIRETIME;
  	__s32 JS_TIMELIMIT;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
119
120
121
  	struct JS_DATA_TYPE JS_SAVE;
  	struct JS_DATA_TYPE JS_CORR;
  };
024ac44c7   Jeremy Fitzhardinge   Input: This patch...
122
  struct JS_DATA_SAVE_TYPE_64 {
d27317657   David Woodhouse   Switch to __s32 t...
123
124
125
126
  	__s32 JS_TIMEOUT;
  	__s32 BUSY;
  	__s64 JS_EXPIRETIME;
  	__s64 JS_TIMELIMIT;
024ac44c7   Jeremy Fitzhardinge   Input: This patch...
127
128
129
  	struct JS_DATA_TYPE JS_SAVE;
  	struct JS_DATA_TYPE JS_CORR;
  };
f647e08a5   Andrew Morton   [PATCH] joystick-...
130
  #ifdef __KERNEL__
024ac44c7   Jeremy Fitzhardinge   Input: This patch...
131
132
133
134
135
136
137
  #if BITS_PER_LONG == 64
  #define JS_DATA_SAVE_TYPE JS_DATA_SAVE_TYPE_64
  #elif BITS_PER_LONG == 32
  #define JS_DATA_SAVE_TYPE JS_DATA_SAVE_TYPE_32
  #else
  #error Unexpected BITS_PER_LONG
  #endif
f647e08a5   Andrew Morton   [PATCH] joystick-...
138
  #endif
024ac44c7   Jeremy Fitzhardinge   Input: This patch...
139

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
140
  #endif /* _LINUX_JOYSTICK_H */