Subversion Repositories shark

Compare Revisions

Ignore whitespace Rev 547 → Rev 548

/shark/trunk/drivers/input/handler/joystick.c
42,8 → 42,8
static struct input_handler joystick_handler;
 
struct joydev {
int exist;
int open;
/*int exist;
int open;*/
int minor;
char name[16];
struct js_corr corr[ABS_MAX];
75,7 → 75,7
*/
static unsigned jtail, jhead;
 
static int tmp_axe[4], axe[4];
//static int tmp_axe[4], axe[4];
 
/*
* Get data from the joystick
96,39 → 96,6
return 0;
}
 
int joystick_enable()
{
struct list_head *node;
 
list_for_each(node,&joystick_handler.h_list) {
struct input_handle *handle = to_handle_h(node);
struct joydev *joydev = handle->private;
 
joydev->open = 1;
 
input_open_device(handle);
}
 
return 0;
}
 
int joystick_disable()
{
struct list_head *node;
 
list_for_each(node,&joystick_handler.h_list) {
struct input_handle *handle = to_handle_h(node);
struct joydev *joydev = handle->private;
 
joydev->open = 0;
 
input_close_device(handle);
}
 
return 0;
}
 
static int joystick_correct(int value, struct js_corr *corr)
{
switch (corr->type) {
151,6 → 118,8
 
static void joystick_event(struct input_handle *handle, unsigned int type, unsigned int code, int value)
{
struct joydev *joydev = handle->private;
 
//printk(KERN_DEBUG "joystick.c: Event. Dev: %s, Type: %d, Code: %d, Value: %d\n", handle->dev->phys, type, code, value);
 
switch (type) {
162,7 → 131,7
#endif
if (jtail != jhead) {
jbuffer[jhead].type = JS_EVENT_BUTTON;
jbuffer[jhead].number = code - BTN_MISC; /* TODO */
jbuffer[jhead].number = joydev->keymap[code - BTN_MISC];
jbuffer[jhead].value = value;
jhead = (jhead+1) & JOY_BUFFERMASK;
} else
174,15 → 143,13
#ifdef DEBUG_JOY
printk(KERN_DEBUG "joystick.c: Event ABS. Code: %d, Value: %d\n", code, value);
#endif
tmp_axe[code] = value;
if (tmp_axe[code] == axe[code])
return;
axe[code] = tmp_axe[code];
 
if (jtail != jhead) {
jbuffer[jhead].type = JS_EVENT_AXIS;
jbuffer[jhead].number = code; /* TODO */
jbuffer[jhead].value = value;
jbuffer[jhead].number = joydev->absmap[code];
jbuffer[jhead].value = joystick_correct(value, joydev->corr + jbuffer[jhead].number);
if (jbuffer[jhead].value == joydev->abs[jbuffer[jhead].number])
return;
joydev->abs[jbuffer[jhead].number] = jbuffer[jhead].value;
jhead = (jhead+1) & JOY_BUFFERMASK;
} else
return;
231,7 → 198,6
handle->private = joydev;
joydev->minor = minor;
joydev->exist = 1;
sprintf26(joydev->name, "js%d", minor);
 
for (i = 0; i < ABS_MAX; i++)
275,7 → 241,7
 
joydev_table[minor] = joydev;
//input_open_device(handle);
input_open_device(handle);
 
#ifdef DEBUG_JOY
printk(KERN_DEBUG "joystick.c: Connected device: \"%s\", %s\n", dev->name, dev->phys);