annotate src/joystick/linux/SDL_sysjoystick_c.h @ 2490:be9b206d44af gsoc2008_force_feedback

Some more error checking. Implemented SDL_HapticOpenFromJoystick().
author Edgar Simo <bobbens@gmail.com>
date Wed, 02 Jul 2008 09:52:44 +0000
parents 96adc8025331
children
rev   line source
2489
96adc8025331 Exposed some of the joystick stuff to the haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
1 /*
96adc8025331 Exposed some of the joystick stuff to the haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
2 SDL - Simple DirectMedia Layer
96adc8025331 Exposed some of the joystick stuff to the haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
3 Copyright (C) 1997-2006 Sam Lantinga
96adc8025331 Exposed some of the joystick stuff to the haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
4
96adc8025331 Exposed some of the joystick stuff to the haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
5 This library is free software; you can redistribute it and/or
96adc8025331 Exposed some of the joystick stuff to the haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
6 modify it under the terms of the GNU Lesser General Public
96adc8025331 Exposed some of the joystick stuff to the haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
7 License as published by the Free Software Foundation; either
96adc8025331 Exposed some of the joystick stuff to the haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
8 version 2.1 of the License, or (at your option) any later version.
96adc8025331 Exposed some of the joystick stuff to the haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
9
96adc8025331 Exposed some of the joystick stuff to the haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
10 This library is distributed in the hope that it will be useful,
96adc8025331 Exposed some of the joystick stuff to the haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
96adc8025331 Exposed some of the joystick stuff to the haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
96adc8025331 Exposed some of the joystick stuff to the haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
13 Lesser General Public License for more details.
96adc8025331 Exposed some of the joystick stuff to the haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
14
96adc8025331 Exposed some of the joystick stuff to the haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
15 You should have received a copy of the GNU Lesser General Public
96adc8025331 Exposed some of the joystick stuff to the haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
16 License along with this library; if not, write to the Free Software
96adc8025331 Exposed some of the joystick stuff to the haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
96adc8025331 Exposed some of the joystick stuff to the haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
18
96adc8025331 Exposed some of the joystick stuff to the haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
19 Sam Lantinga
96adc8025331 Exposed some of the joystick stuff to the haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
20 slouken@libsdl.org
96adc8025331 Exposed some of the joystick stuff to the haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
21 */
96adc8025331 Exposed some of the joystick stuff to the haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
22
96adc8025331 Exposed some of the joystick stuff to the haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
23 #if SDL_INPUT_LINUXEV
96adc8025331 Exposed some of the joystick stuff to the haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
24 #include <linux/input.h>
96adc8025331 Exposed some of the joystick stuff to the haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
25 #endif
96adc8025331 Exposed some of the joystick stuff to the haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
26
96adc8025331 Exposed some of the joystick stuff to the haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
27 /* The private structure used to keep track of a joystick */
96adc8025331 Exposed some of the joystick stuff to the haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
28 struct joystick_hwdata
96adc8025331 Exposed some of the joystick stuff to the haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
29 {
96adc8025331 Exposed some of the joystick stuff to the haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
30 int fd;
2490
be9b206d44af Some more error checking.
Edgar Simo <bobbens@gmail.com>
parents: 2489
diff changeset
31 char *fname; /* Used in haptic subsystem */
be9b206d44af Some more error checking.
Edgar Simo <bobbens@gmail.com>
parents: 2489
diff changeset
32
2489
96adc8025331 Exposed some of the joystick stuff to the haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
33 /* The current linux joystick driver maps hats to two axes */
96adc8025331 Exposed some of the joystick stuff to the haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
34 struct hwdata_hat
96adc8025331 Exposed some of the joystick stuff to the haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
35 {
96adc8025331 Exposed some of the joystick stuff to the haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
36 int axis[2];
96adc8025331 Exposed some of the joystick stuff to the haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
37 } *hats;
96adc8025331 Exposed some of the joystick stuff to the haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
38 /* The current linux joystick driver maps balls to two axes */
96adc8025331 Exposed some of the joystick stuff to the haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
39 struct hwdata_ball
96adc8025331 Exposed some of the joystick stuff to the haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
40 {
96adc8025331 Exposed some of the joystick stuff to the haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
41 int axis[2];
96adc8025331 Exposed some of the joystick stuff to the haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
42 } *balls;
96adc8025331 Exposed some of the joystick stuff to the haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
43
96adc8025331 Exposed some of the joystick stuff to the haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
44 /* Support for the Linux 2.4 unified input interface */
96adc8025331 Exposed some of the joystick stuff to the haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
45 #if SDL_INPUT_LINUXEV
96adc8025331 Exposed some of the joystick stuff to the haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
46 SDL_bool is_hid;
96adc8025331 Exposed some of the joystick stuff to the haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
47 Uint8 key_map[KEY_MAX - BTN_MISC];
96adc8025331 Exposed some of the joystick stuff to the haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
48 Uint8 abs_map[ABS_MAX];
96adc8025331 Exposed some of the joystick stuff to the haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
49 struct axis_correct
96adc8025331 Exposed some of the joystick stuff to the haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
50 {
96adc8025331 Exposed some of the joystick stuff to the haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
51 int used;
96adc8025331 Exposed some of the joystick stuff to the haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
52 int coef[3];
96adc8025331 Exposed some of the joystick stuff to the haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
53 } abs_correct[ABS_MAX];
96adc8025331 Exposed some of the joystick stuff to the haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
54 #endif
96adc8025331 Exposed some of the joystick stuff to the haptic subsystem.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
55 };