/shark/trunk/drivers/input/joystick/analog.c |
---|
1,5 → 1,5 |
/* |
* $Id: analog.c,v 1.2 2004-03-29 18:27:43 mauro Exp $ |
* $Id: analog.c,v 1.3 2004-03-31 11:27:13 mauro Exp $ |
* |
* Copyright (c) 1996-2001 Vojtech Pavlik |
*/ |
85,7 → 85,7 |
#define ANALOG_GAMEPAD 0x80000 |
#define ANALOG_MAX_TIME 3 /* 3 ms */ |
#define ANALOG_LOOP_TIME 2000 /* 2 * loop */ |
#define ANALOG_LOOP_TIME 2 /* 2 * loop */ |
#define ANALOG_REFRESH_TIME HZ/100 /* 10 ms */ |
#define ANALOG_SAITEK_DELAY 200 /* 200 us */ |
#define ANALOG_SAITEK_TIME 2000 /* 2000 us */ |
140,12 → 140,13 |
#ifdef __i386__ |
/* !!! Added by Nino !!! */ |
#define GET_TIME(x) (x = get_time_pit()) |
extern TIME sys_gettime(struct timespec *t); |
#define GET_TIME(x) (x = sys_gettime(NULL)) |
#define DELTA(x,y) ((y)-(x)) |
#define TIME_NAME ("Shark") |
/*#define GET_TIME(x) do { if (cpu_has_tsc) rdtscl(x); else x = get_time_pit(); } while (0) |
#define DELTA(x,y) (cpu_has_tsc?((y)-(x)):((x)-(y)+((x)<(y)?1193182L/HZ:0))) |
#define TIME_NAME (cpu_has_tsc?"TSC":"PIT")*/ |
#define TIME_NAME (cpu_has_tsc?"TSC":"PIT") |
static unsigned int get_time_pit(void) |
{ |
extern spinlock_t i8253_lock; |
159,7 → 160,7 |
spin_unlock_irqrestore(&i8253_lock, flags); |
return count; |
} |
}*/ |
#elif __x86_64__ |
#define GET_TIME(x) rdtscl(x) |
#define DELTA(x,y) ((y)-(x)) |
237,7 → 238,7 |
unsigned long flags; |
int i, j; |
loopout = (ANALOG_LOOP_TIME * port->loop) / 1000; |
loopout = ANALOG_LOOP_TIME * port->loop; |
timeout = ANALOG_MAX_TIME * port->speed; |
local_irq_save(flags); |
376,7 → 377,7 |
unsigned int i, t, tx, t1, t2, t3; |
unsigned long flags; |
local_irq_save(flags); |
/*local_irq_save(flags); |
GET_TIME(t1); |
#ifdef FAKE_TIME |
analog_faketime += 830; |
386,8 → 387,11 |
GET_TIME(t3); |
local_irq_restore(flags); |
port->speed = DELTA(t1, t2) - DELTA(t2, t3); |
port->speed = DELTA(t1, t2) - DELTA(t2, t3);*/ |
/* !!! Added by Nino !!! */ |
port->speed = 1000; |
tx = ~0; |
for (i = 0; i < 50; i++) { |
401,7 → 405,7 |
if (t < tx) tx = t; |
} |
port->loop = tx / 50; |
port->loop = tx / 5; /* !!! In Linux is set to 50 !!! */ |
} |
/* |
/shark/trunk/drivers/input/include/drivers/shark_keyb26.h |
---|
19,25 → 19,6 |
* http://shark.sssup.it |
*/ |
/* |
* Copyright (C) 2000 Giuseppe Lipari |
* |
* 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 |
* |
*/ |
#ifndef __KEYB_H__ |
#define __KEYB_H__ |
/shark/trunk/drivers/input/include/drivers/shark_spk26.h |
---|
16,25 → 16,6 |
* http://shark.sssup.it |
*/ |
/* |
* Copyright (C) 2000 Paolo Gai |
* |
* 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 |
* |
*/ |
/* Glue Layer Header Linux Input Driver*/ |
#ifndef __SHARK_SPK26_H__ |
/shark/trunk/drivers/input/include/drivers/shark_input26.h |
---|
16,25 → 16,6 |
* http://shark.sssup.it |
*/ |
/* |
* Copyright (C) 2000 Paolo Gai |
* |
* 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 |
* |
*/ |
/* Glue Layer Header Linux Input Driver*/ |
#ifndef __SHARK_INPUT26_H__ |
/shark/trunk/drivers/input/include/drivers/shark_joy26.h |
---|
16,30 → 16,14 |
* http://shark.sssup.it |
*/ |
/* |
* Copyright (C) 2000 Paolo Gai |
* |
* 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 |
* |
*/ |
/* Game Header Linux Input Driver*/ |
#ifndef __SHARK_JOY26_H__ |
#define __SHARK_JOY26_H__ |
void joy_enable(void); |
void joy_disable(void); |
int JOY26_init(void); |
int JOY26_close(void); |
#endif |
/shark/trunk/drivers/input/include/drivers/keycode.h |
---|
19,25 → 19,6 |
* http://shark.sssup.it |
*/ |
/* |
* Copyright (C) 2000 Paolo Gai |
* |
* 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 |
* |
*/ |
#ifndef __KEYCODE_H__ |
#define __KEYCODE_H__ |
/shark/trunk/drivers/input/include/drivers/shark_mouse26.h |
---|
19,25 → 19,6 |
* http://shark.sssup.it |
*/ |
/* |
* Copyright (C) 2000 Paolo Gai |
* |
* 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 |
* |
*/ |
/* Glue Layer Header Linux Input Driver*/ |
#ifndef __SHARK_MOUSE26_H__ |
/shark/trunk/drivers/input/shark/shark_keymap.c |
---|
16,25 → 16,6 |
* http://shark.sssup.it |
*/ |
/* |
* Copyright (C) 2000 Paolo Gai |
* |
* 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 <kernel/kern.h> |
#include "../include/drivers/shark_keyb26.h" |
/shark/trunk/drivers/input/shark/shark_keyb.c |
---|
19,25 → 19,6 |
* http://shark.sssup.it |
*/ |
/* |
* Copyright (C) 2000 Paolo Gai |
* |
* 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 |
* |
*/ |
//#define __KEYB_DEBUG__ |
#define KEYB_TASK |
/shark/trunk/drivers/input/shark/shark_spk.c |
---|
16,25 → 16,6 |
* http://shark.sssup.it |
*/ |
/* |
* Copyright (C) 2000 Paolo Gai |
* |
* 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 |
* |
*/ |
//#define __MOUSE_DEBUG__ 1 |
#include <kernel/kern.h> |
/shark/trunk/drivers/input/shark/mcurtxt.c |
---|
20,26 → 20,7 |
*/ |
/* |
* Copyright (C) 2000 Paolo Gai |
* |
* 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 |
* |
*/ |
/* |
* |
* Auto Pointer management |
* |
*/ |
/shark/trunk/drivers/input/shark/mcurgrx.c |
---|
18,25 → 18,6 |
* http://shark.sssup.it |
*/ |
/* |
* Copyright (C) 2000 Paolo Gai |
* |
* 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 |
* |
*/ |
/*---------------* |
* GRX Management* |
*---------------*/ |
/shark/trunk/drivers/input/shark/shark_input.c |
---|
16,25 → 16,6 |
* http://shark.sssup.it |
*/ |
/* |
* Copyright (C) 2000 Paolo Gai |
* |
* 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 <kernel/func.h> |
/* System */ |
/shark/trunk/drivers/input/shark/shark_joy.c |
---|
16,25 → 16,6 |
* http://shark.sssup.it |
*/ |
/* |
* Copyright (C) 2000 Paolo Gai |
* |
* 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 |
* |
*/ |
#define __JOY_DEBUG__ |
//#define __JOY_DUMP__ |
59,10 → 40,55 |
extern int joystick_init(void); |
extern int joystick_exit(void); |
/* Functions */ |
extern int joystick_enable(void); |
extern int joystick_disable(void); |
extern int joystick_get(int *type, int *number, int *value); |
extern int input_installed; |
#define JS_EVENT_BUTTON 0x01 /* button pressed/released */ |
#define JS_EVENT_AXIS 0x02 /* joystick moved */ |
#define JS_EVENT_INIT 0x80 /* initial state of device */ |
/* joystick driver currently installed */ |
static int joystick_installed = FALSE; |
static int axis[4], button; |
/* Called by handler */ |
void shark_joy_exec(void) { |
int type, number, value; |
if (joystick_get(&type, &number, &value)) |
return; |
switch (type) { |
case JS_EVENT_BUTTON: |
button = number; /* TODO */ |
break; |
case JS_EVENT_AXIS: |
axis[number] = value; /* TODO */ |
break; |
default: |
return; |
} |
#ifdef __JOY_DEBUG__ |
printk(KERN_DEBUG "shark_joy.c: (%4d,%4d) (%4d,%4d) %4d\n", axis[0], axis[1], axis[2], axis[3], button); |
#endif |
} |
/* User Functions */ |
void joy_enable(void) |
{ |
joystick_enable(); |
} |
void joy_disable(void) |
{ |
joystick_disable(); |
} |
/* Init the Linux Joystick Driver */ |
int JOY26_init() { |
96,11 → 122,16 |
return -1; |
} |
joy_enable(); |
joystick_installed = TRUE; |
return 0; |
} |
int JOY26_close() { |
if (!joystick_installed) |
return -1; |
joy_disable(); |
joystick_exit(); |
#ifdef __JOY_DUMP__ |
joydump_exit(); |
108,5 → 139,7 |
analog_exit(); |
#endif |
ns558_exit(); |
joystick_installed = FALSE; |
return 0; |
} |
/shark/trunk/drivers/input/handler/joystick.c |
---|
25,31 → 25,202 |
#include <linux/input.h> |
#include <linux/init.h> |
#include <linux/device.h> |
#include <linux/joystick.h> |
//#define DEBUG_JOY |
extern void shark_joy_exec(void); |
MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>"); |
MODULE_DESCRIPTION("Input driver joystick module"); |
MODULE_LICENSE("GPL"); |
#define JOYDEV_MINOR_BASE 0 |
#define JOYDEV_MINORS 4 |
static char joystick_name[] = "joystick"; |
static struct input_handler joystick_handler; |
struct joydev { |
int exist; |
int open; |
int minor; |
char name[16]; |
struct js_corr corr[ABS_MAX]; |
int nabs; |
int nkey; |
__u16 keymap[KEY_MAX - BTN_MISC]; |
__u16 keypam[KEY_MAX - BTN_MISC]; |
__u8 absmap[ABS_MAX]; |
__u8 abspam[ABS_MAX]; |
__s16 abs[ABS_MAX]; |
}; |
static struct joydev *joydev_table[JOYDEV_MINORS]; |
/* Buffer Ssize */ |
#define JOY_BUFFERSIZE 256 |
/* Buffer Mask ( i=(i+1)&MASK is better than i=(i+1)%SIZE ) */ |
#define JOY_BUFFERMASK 0xff |
/* Circular Buffer */ |
static struct js_event jbuffer[JOY_BUFFERSIZE]; |
/* |
* Buffer Pointers |
* data is inserted to jhead |
* data is kept from jtail+1 |
* (jhead point to jtail+1 when buffer is empty) |
*/ |
static unsigned jtail, jhead; |
static int tmp_axe[4], axe[4]; |
/* |
* Get data from the joystick |
*/ |
int joystick_get(int *type, int *number, int *value) |
{ |
if ( ((jtail+1) & JOY_BUFFERMASK) == ((jhead) & JOY_BUFFERMASK) ) |
return -1; |
jtail = (jtail+1) & JOY_BUFFERMASK; |
*type = jbuffer[jtail].type; |
*number = jbuffer[jtail].number; |
*value = jbuffer[jtail].value; |
#ifdef DEBUG_JOY |
printk(KERN_DEBUG "joystick.c: ( %3d %3d %3d)\n", *type, *number, *value); |
#endif |
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) { |
case JS_CORR_NONE: |
break; |
case JS_CORR_BROKEN: |
value = value > corr->coef[0] ? (value < corr->coef[1] ? 0 : |
((corr->coef[3] * (value - corr->coef[1])) >> 14)) : |
((corr->coef[2] * (value - corr->coef[0])) >> 14); |
break; |
default: |
return 0; |
} |
if (value < -32767) return -32767; |
if (value > 32767) return 32767; |
return value; |
} |
static void joystick_event(struct input_handle *handle, unsigned int type, unsigned int code, int value) |
{ |
//printk(KERN_DEBUG "joystick.c: Event. Dev: %s, Type: %d, Code: %d, Value: %d\n", handle->dev->phys, type, code, value); |
switch (type) { |
case EV_KEY: |
if (code < BTN_MISC || value == 2) return; |
#ifdef DEBUG_JOY |
printk(KERN_DEBUG "joystick.c: Event. Dev: %s, Type: %d, Code: %d, Value: %d\n", handle->dev->phys, type, code, value); |
printk(KERN_DEBUG "joystick.c: Event KEY. Code: %d, Value: %d\n", code, value); |
#endif |
if (jtail != jhead) { |
jbuffer[jhead].type = JS_EVENT_BUTTON; |
jbuffer[jhead].number = code - BTN_MISC; /* TODO */ |
jbuffer[jhead].value = value; |
jhead = (jhead+1) & JOY_BUFFERMASK; |
} else |
return; |
break; |
case EV_ABS: |
#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; |
jhead = (jhead+1) & JOY_BUFFERMASK; |
} else |
return; |
break; |
case EV_SYN: |
#ifdef DEBUG_JOY |
printk(KERN_DEBUG "joystick.c: Event SYN\n"); |
#endif |
return; |
default: |
return; |
} |
shark_joy_exec(); |
} |
static struct input_handle *joystick_connect(struct input_handler *handler, struct input_dev *dev, struct input_device_id *id) |
{ |
struct input_handle *handle; |
struct joydev *joydev; |
int i, j, t, minor; |
/* Avoid tablets */ |
if (test_bit(EV_KEY, dev->evbit) && test_bit(BTN_TOUCH, dev->keybit)) |
return NULL; |
for (minor = 0; minor < JOYDEV_MINORS && joydev_table[minor]; minor++); |
if (minor == JOYDEV_MINORS) { |
printk(KERN_ERR "joydev: no more free joydev devices\n"); |
return NULL; |
} |
if (!(joydev = kmalloc(sizeof(struct joydev), GFP_KERNEL))) |
return NULL; |
memset(joydev, 0, sizeof(struct joydev)); |
if (!(handle = kmalloc(sizeof(struct input_handle), GFP_KERNEL))) |
return NULL; |
memset(handle, 0, sizeof(struct input_handle)); |
57,9 → 228,55 |
handle->dev = dev; |
handle->handler = handler; |
handle->name = joystick_name; |
handle->private = joydev; |
input_open_device(handle); |
joydev->minor = minor; |
joydev->exist = 1; |
sprintf26(joydev->name, "js%d", minor); |
for (i = 0; i < ABS_MAX; i++) |
if (test_bit(i, dev->absbit)) { |
joydev->absmap[i] = joydev->nabs; |
joydev->abspam[joydev->nabs] = i; |
joydev->nabs++; |
} |
for (i = BTN_JOYSTICK - BTN_MISC; i < KEY_MAX - BTN_MISC; i++) |
if (test_bit(i + BTN_MISC, dev->keybit)) { |
joydev->keymap[i] = joydev->nkey; |
joydev->keypam[joydev->nkey] = i + BTN_MISC; |
joydev->nkey++; |
} |
for (i = 0; i < BTN_JOYSTICK - BTN_MISC; i++) |
if (test_bit(i + BTN_MISC, dev->keybit)) { |
joydev->keymap[i] = joydev->nkey; |
joydev->keypam[joydev->nkey] = i + BTN_MISC; |
joydev->nkey++; |
} |
for (i = 0; i < joydev->nabs; i++) { |
j = joydev->abspam[i]; |
if (dev->absmax[j] == dev->absmin[j]) { |
joydev->corr[i].type = JS_CORR_NONE; |
continue; |
} |
joydev->corr[i].type = JS_CORR_BROKEN; |
joydev->corr[i].prec = dev->absfuzz[j]; |
joydev->corr[i].coef[0] = (dev->absmax[j] + dev->absmin[j]) / 2 - dev->absflat[j]; |
joydev->corr[i].coef[1] = (dev->absmax[j] + dev->absmin[j]) / 2 + dev->absflat[j]; |
if (!(t = ((dev->absmax[j] - dev->absmin[j]) / 2 - 2 * dev->absflat[j]))) |
continue; |
joydev->corr[i].coef[2] = (1 << 29) / t; |
joydev->corr[i].coef[3] = (1 << 29) / t; |
joydev->abs[i] = joystick_correct(dev->abs[j], joydev->corr + i); |
} |
joydev_table[minor] = joydev; |
//input_open_device(handle); |
#ifdef DEBUG_JOY |
printk(KERN_DEBUG "joystick.c: Connected device: \"%s\", %s\n", dev->name, dev->phys); |
#endif |
69,19 → 286,20 |
static void joystick_disconnect(struct input_handle *handle) |
{ |
struct joydev *joydev = handle->private; |
joydev_table[joydev->minor] = NULL; |
kfree(joydev); |
input_close_device(handle); |
kfree(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, |
113,6 → 331,10 |
int __init joystick_init(void) |
{ |
/* Initialize Buffer Variables */ |
jhead=1; |
jtail=0; |
input_register_handler(&joystick_handler); |
return 0; |
} |
/shark/trunk/drivers/input/handler/keyboard.c |
---|
79,7 → 79,6 |
} |
return 0; |
} |
int kbd_disable(void) |
96,7 → 95,6 |
} |
return 0; |
} |
/* |
/shark/trunk/drivers/input/handler/mouse.c |
---|
76,8 → 76,6 |
/* |
* Get data from the mouse |
* |
* it's follow the port_receive() semantic |
*/ |
int mouse_get(int *dx, int *dy, int *dz, unsigned long *buttons) |
{ |
92,7 → 90,6 |
*buttons = mbuffer[mtail].buttons; |
#ifdef DEBUG_MOUSE |
printk(KERN_DEBUG "mouse.c: ( %3d %3d %3d - %6x)\n", mbuffer[mtail].dx, mbuffer[mtail].dy, mbuffer[mtail].dz, (int)mbuffer[mtail].buttons); |
printk(KERN_DEBUG "mouse.c: ( %3d %3d %3d - %6x)\n", *dx, *dy, *dz, *(int *)buttons); |
#endif |
return 0; |