Ejemplo n.º 1
0
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/stat.h>
#include <linux/module.h>
#include <linux/usb/input.h>

#define DRIVER_AUTHOR "Ingo Ruhnke <*****@*****.**>"
#define DRIVER_DESC "Xboxdrv kernel module"

static struct usb_device_id xboxdrv_table [] = {
  //{ USB_DEVICE( 0x045e, 0x028e ) },
  { USB_DEVICE_INTERFACE_PROTOCOL( 0x045e, 0x028e, 1 ) },
  { USB_DEVICE_INTERFACE_PROTOCOL( 0x045e, 0x028e, 2 ) },
  { }
};

MODULE_DEVICE_TABLE (usb, xboxdrv_table);

struct usb_xboxdrv {
  struct usb_device* udev;

  struct urb*    controller_urb;
  unsigned char* controller_idata;
  dma_addr_t     controller_idata_dma;

  struct urb*    chatpad_urb;
  unsigned char* chatpad_idata;
  dma_addr_t     chatpad_idata_dma;

  struct delayed_work worker;
Ejemplo n.º 2
0
};

static const int xpad360_absbit[] = {
	ABS_X, ABS_RX, 
	ABS_Y, ABS_RY,
	ABS_Z, ABS_RZ, 
	ABS_HAT0X, ABS_HAT0Y
};

/* This array corresponds exactly to xpad360_table. */
static const char* xpad360_device_names[] = {
	"Xbox 360 Wired Controller",
};

static struct usb_device_id xpad360_table[] = {
	{ USB_DEVICE_INTERFACE_PROTOCOL(0x045E, 0x028e, 1) },
	{}
};

struct xpad360_abs_params {
	unsigned int axis;
	int min; int max;
	int fuzz; int flat;
};

/* This array corresponds exactly to xpad360_absbit */
static const struct xpad360_abs_params xpad360_abs_params[] = {
	{ -32768, 32768, 16, 128 },
	{ -32768, 32768, 16, 128 },
	{ -32768, 32768, 16, 128 }, 
	{ -32768, 32768, 16, 128 },