2
* Xbox Controller driver for Linux - v0.1.5
4
* header file containing ioctl definitions
6
* Copyright (c) 2003 Marko Friedemann <mfr@bmx-chemnitz.de>
9
* This program is free software; you can redistribute it and/or
10
* modify it under the terms of the GNU General Public License as
11
* published by the Free Software Foundation; either version 2 of
12
* the License, or (at your option) any later version.
14
* This program is distributed in the hope that it will be useful,
15
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
* GNU General Public License for more details.
19
* You should have received a copy of the GNU General Public License
20
* along with this program; if not, write to the Free Software
21
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28
/*********** ioctl stuff, can be used outside of the driver ***********/
29
#define USB_XPAD_IOC_MAGIC 'x'
31
#define USB_XPAD_IOCRESET _IO( USB_XPAD_IOC_MAGIC, 0 )
32
#define USB_XPAD_IOCSRUMBLE _IOW( USB_XPAD_IOC_MAGIC, 3, int )
33
#define USB_XPAD_IOCGRUMBLE _IOR( USB_XPAD_IOC_MAGIC, 4, int )
35
#define USB_XPAD_IOCSIR _IOW( USB_XPAD_IOC_MAGIC, 5, int )
36
#define USB_XPAD_IOCGIR _IOR( USB_XPAD_IOC_MAGIC, 6, int )
38
#define USB_XPAD_IOC_MAXNR 6
40
/************************* driver internals ***************************/
43
#include <linux/input.h>
44
#include <linux/circ_buf.h>
46
/****************** driver description and version ********************/
47
#define DRIVER_VERSION "v0.1.6"
48
#define DRIVER_AUTHOR "Marko Friedemann <mfr@bmx-chemnitz.de>,\
49
Oliver Schwartz <Oliver.Schwartz@gmx.de>, Georg Lukas <georg@op-co.de>,\
50
Thomas Pedley <Gentoox@shallax.com>, Edgar Hucek <hostmaster@ed-soft.at>"
52
#define DRIVER_DESC "driver for Xbox controllers"
54
/****************************** constants *****************************/
55
#define XPAD_MAX_DEVICES 4
56
#define XPAD_PKT_LEN 32 /* input packet size */
57
#define XPAD_PKT_LEN_FF 6 /* output packet size - rumble */
59
#define XPAD_TX_BUFSIZE XPAD_PKT_LEN_FF * 8 /* max. 8 requests */
61
/************************* the device struct **************************/
63
struct input_dev *dev; /* input device interface */
64
struct usb_device *udev; /* usb device */
66
struct urb *irq_in; /* urb for int. in report */
67
unsigned char *idata; /* input data */
70
char phys[65]; /* physical input dev path */
72
unsigned char offsetset_compensation;
78
int isMat; /* is this a dancepad/mat? */
79
int is360; /* is this a Xbox 360 Controller */
81
#ifdef CONFIG_USB_XPAD_RUMBLE
82
int rumble_enabled; /* ioctl can toggle rumble */
84
int ep_out_adr; /* number of out endpoint */
85
unsigned char tx_data[XPAD_PKT_LEN_FF]; /* output data (rumble) */
86
int strong_rumble, play_strong; /* strong rumbling */
87
int weak_rumble, play_weak; /* weak rumbling */
88
struct timer_list rumble_timer; /* timed urb out retry */
89
wait_queue_head_t wait; /* wait for URBs on queue */
93
unsigned char tx_buf[XPAD_TX_BUFSIZE];
94
long tx_flags[1]; /* transmit flags */
98
/* for the list of know devices */
108
/************************ rumble function stubs ***********************/
109
#ifndef CONFIG_USB_XPAD_RUMBLE
110
#define xpad_rumble_ioctl(dev, cmd, arg) -ENOTTY
111
#define xpad_rumble_open(xpad) {}
112
#define xpad_rumble_probe(udev, xpad, ifnum) 0
113
#define xpad_rumble_close(xpad) {}
114
#define xpad_rumble_disconnect(xpad) {}
115
#else /* CONFIG_USB_XPAD_RUMBLE */
117
#define XPAD_TX_RUNNING 0
118
#define XPAD_TX_INC(var, n) (var) += n; (var) %= XPAD_TX_BUFSIZE
120
#ifndef __USB_XPAD_RUMBLE
121
extern int xpad_rumble_ioctl(struct input_dev *dev, unsigned int cmd, unsigned long arg);
122
extern void xpad_rumble_open(struct usb_xpad *xpad);
123
extern int xpad_rumble_probe(struct usb_device *udev, struct usb_xpad *xpad, unsigned int ifnum);
124
extern void xpad_rumble_close(struct usb_xpad *xpad);
125
extern void xpad_rumble_disconnect(struct usb_xpad *xpad);
126
#endif /* __USB_XPAD_RUMBLE */
127
#endif /* CONFIG_USB_XPAD_RUMBLE */
129
#endif /* __KERNEL__ */
131
#endif /* __XPAD_h */