Subversion Repositories shark

Compare Revisions

Ignore whitespace Rev 523 → Rev 538

/shark/trunk/drivers/input/handler/joystick.c
0,0 → 1,126
/*
* Input driver event debug module - dumps all events into syslog
*/
 
/*
* 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
*/
 
#include <linuxcomp.h>
 
#include <linux/slab.h>
#include <linux/module.h>
#include <linux/input.h>
#include <linux/init.h>
#include <linux/device.h>
 
//#define DEBUG_JOY
 
MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
MODULE_DESCRIPTION("Input driver joystick module");
MODULE_LICENSE("GPL");
 
static char joystick_name[] = "joystick";
static struct input_handler joystick_handler;
 
static void joystick_event(struct input_handle *handle, unsigned int type, unsigned int code, int value)
{
#ifdef DEBUG_JOY
printk(KERN_DEBUG "joystick.c: Event. Dev: %s, Type: %d, Code: %d, Value: %d\n", handle->dev->phys, type, code, value);
#endif
}
 
static struct input_handle *joystick_connect(struct input_handler *handler, struct input_dev *dev, struct input_device_id *id)
{
struct input_handle *handle;
 
/* Avoid tablets */
if (test_bit(EV_KEY, dev->evbit) && test_bit(BTN_TOUCH, dev->keybit))
return NULL;
 
if (!(handle = kmalloc(sizeof(struct input_handle), GFP_KERNEL)))
return NULL;
memset(handle, 0, sizeof(struct input_handle));
 
handle->dev = dev;
handle->handler = handler;
handle->name = joystick_name;
 
input_open_device(handle);
 
#ifdef DEBUG_JOY
printk(KERN_DEBUG "joystick.c: Connected device: \"%s\", %s\n", dev->name, dev->phys);
#endif
 
return handle;
}
 
static void joystick_disconnect(struct input_handle *handle)
{
#ifdef DEBUG_JOY
printk(KERN_DEBUG "joystick.c: Disconnected device: %s\n", handle->dev->phys);
#endif
input_close_device(handle);
 
kfree(handle);
}
 
/*static struct input_device_id joystick_ids[] = {
{ .driver_info = 1 }, // Matches all devices
{ }, // Terminating zero entry
};*/
 
static struct input_device_id joystick_ids[] = {
{
.flags = INPUT_DEVICE_ID_MATCH_EVBIT | INPUT_DEVICE_ID_MATCH_ABSBIT,
.evbit = { BIT(EV_ABS) },
.absbit = { BIT(ABS_X) },
},
{
.flags = INPUT_DEVICE_ID_MATCH_EVBIT | INPUT_DEVICE_ID_MATCH_ABSBIT,
.evbit = { BIT(EV_ABS) },
.absbit = { BIT(ABS_WHEEL) },
},
{
.flags = INPUT_DEVICE_ID_MATCH_EVBIT | INPUT_DEVICE_ID_MATCH_ABSBIT,
.evbit = { BIT(EV_ABS) },
.absbit = { BIT(ABS_THROTTLE) },
},
{ }, /* Terminating entry */
};
 
MODULE_DEVICE_TABLE(input, joystick_ids);
static struct input_handler joystick_handler = {
.event = joystick_event,
.connect = joystick_connect,
.disconnect = joystick_disconnect,
.name = "joystick",
.id_table = joystick_ids,
};
 
int __init joystick_init(void)
{
input_register_handler(&joystick_handler);
return 0;
}
 
void __exit joystick_exit(void)
{
input_unregister_handler(&joystick_handler);
}
 
module_init(joystick_init);
module_exit(joystick_exit);
/shark/trunk/drivers/input/handler/keyboard.c
1,14 → 1,8
/*
* $Id: keyboard.c,v 1.2 2004-03-23 15:37:21 mauro Exp $
*
* Copyright (c) 1999-2001 Vojtech Pavlik
* Input driver keyboard module
*/
 
/*
* Input driver event debug module - dumps all events into syslog
*/
 
/*
* 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
38,7 → 32,7
//#define DEBUG_KBD
 
MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
MODULE_DESCRIPTION("Input driver event debug module");
MODULE_DESCRIPTION("Input driver keyboard module");
MODULE_LICENSE("GPL");
 
extern void shark_kbd_exec(void);
/shark/trunk/drivers/input/handler/mouse.c
1,14 → 1,8
/*
* $Id: mouse.c,v 1.2 2004-03-25 10:37:48 mauro Exp $
*
* Copyright (c) 1999-2001 Vojtech Pavlik
* Input driver mouse module
*/
 
/*
* Input driver event debug module - dumps all events into syslog
*/
 
/*
* 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
31,7 → 25,7
//#define DEBUG_MOUSE
 
MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
MODULE_DESCRIPTION("Input driver event debug module");
MODULE_DESCRIPTION("Input driver mouse module");
MODULE_LICENSE("GPL");
 
extern void shark_mouse_exec(void);
/shark/trunk/drivers/input/handler/speaker.c
1,14 → 1,8
/*
* $Id: speaker.c,v 1.1 2004-03-22 14:48:15 mauro Exp $
*
* Copyright (c) 1999-2001 Vojtech Pavlik
* Input driver speaker module
*/
 
/*
* Input driver event debug module - dumps all events into syslog
*/
 
/*
* 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
35,7 → 29,7
//#define DEBUG_SPK
 
MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
MODULE_DESCRIPTION("Input driver event debug module");
MODULE_DESCRIPTION("Input driver joystick module");
MODULE_LICENSE("GPL");
 
static char speaker_name[] = "speaker";