|
From: Andy P. <at...@us...> - 2002-04-10 18:32:19
|
Update of /cvsroot/linux-vax/kernel-2.4/drivers/input
In directory usw-pr-cvs1:/tmp/cvs-serv1502/input
Modified Files:
Config.in evdev.c input.c joydev.c keybdev.c mousedev.c
Log Message:
synch 2.4.15 commit 49
Index: Config.in
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/input/Config.in,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- Config.in 14 Jan 2001 19:19:02 -0000 1.1.1.1
+++ Config.in 10 Apr 2002 15:32:21 -0000 1.2
@@ -6,15 +6,13 @@
comment 'Input core support'
tristate 'Input core support' CONFIG_INPUT
-if [ "$CONFIG_INPUT" != "n" ]; then
- dep_tristate ' Keyboard support' CONFIG_INPUT_KEYBDEV $CONFIG_INPUT
- dep_tristate ' Mouse support' CONFIG_INPUT_MOUSEDEV $CONFIG_INPUT
- if [ "$CONFIG_INPUT_MOUSEDEV" != "n" ]; then
- int ' Horizontal screen resolution' CONFIG_INPUT_MOUSEDEV_SCREEN_X 1024
- int ' Vertical screen resolution' CONFIG_INPUT_MOUSEDEV_SCREEN_Y 768
- fi
- dep_tristate ' Joystick support' CONFIG_INPUT_JOYDEV $CONFIG_INPUT
- dep_tristate ' Event interface support' CONFIG_INPUT_EVDEV $CONFIG_INPUT
+dep_tristate ' Keyboard support' CONFIG_INPUT_KEYBDEV $CONFIG_INPUT
+dep_tristate ' Mouse support' CONFIG_INPUT_MOUSEDEV $CONFIG_INPUT
+if [ "$CONFIG_INPUT_MOUSEDEV" != "n" ]; then
+ int ' Horizontal screen resolution' CONFIG_INPUT_MOUSEDEV_SCREEN_X 1024
+ int ' Vertical screen resolution' CONFIG_INPUT_MOUSEDEV_SCREEN_Y 768
fi
+dep_tristate ' Joystick support' CONFIG_INPUT_JOYDEV $CONFIG_INPUT
+dep_tristate ' Event interface support' CONFIG_INPUT_EVDEV $CONFIG_INPUT
endmenu
Index: evdev.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/input/evdev.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -u -r1.1.1.2 -r1.2
--- evdev.c 25 Feb 2001 23:15:16 -0000 1.1.1.2
+++ evdev.c 10 Apr 2002 15:32:21 -0000 1.2
@@ -1,7 +1,7 @@
/*
* $Id$
*
- * Copyright (c) 1999-2000 Vojtech Pavlik
+ * Copyright (c) 1999-2001 Vojtech Pavlik
*
* Event char devices, giving access to raw input device events.
*
@@ -11,18 +11,18 @@
/*
* 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
+ * 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
- *
+ *
* Should you need to contact me, the author, you can do so either by
* e-mail - mail your message to <vo...@su...>, or by paper mail:
* Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic
@@ -72,7 +72,7 @@
list->buffer[list->head].code = code;
list->buffer[list->head].value = value;
list->head = (list->head + 1) & (EVDEV_BUFFER_SIZE - 1);
-
+
kill_fasync(&list->fasync, SIGIO, POLL_IN);
list = list->next;
@@ -104,7 +104,7 @@
if (!--list->evdev->open) {
if (list->evdev->exist) {
- input_close_device(&list->evdev->handle);
+ input_close_device(&list->evdev->handle);
} else {
input_unregister_minor(list->evdev->devfs);
evdev_table[list->evdev->minor] = NULL;
@@ -138,14 +138,26 @@
if (!list->evdev->open++)
if (list->evdev->exist)
- input_open_device(&list->evdev->handle);
+ input_open_device(&list->evdev->handle);
return 0;
}
static ssize_t evdev_write(struct file * file, const char * buffer, size_t count, loff_t *ppos)
{
- return -EINVAL;
+ struct evdev_list *list = file->private_data;
+ struct input_event event;
+ int retval = 0;
+
+ while (retval < count) {
+
+ if (copy_from_user(&event, buffer + retval, sizeof(struct input_event)))
+ return -EFAULT;
+ input_event(list->evdev->handle.dev, event.type, event.code, event.value);
+ retval += sizeof(struct input_event);
+ }
+
+ return retval;
}
static ssize_t evdev_read(struct file * file, char * buffer, size_t count, loff_t *ppos)
@@ -161,6 +173,10 @@
while (list->head == list->tail) {
+ if (!list->evdev->exist) {
+ retval = -ENODEV;
+ break;
+ }
if (file->f_flags & O_NONBLOCK) {
retval = -EAGAIN;
break;
@@ -187,7 +203,7 @@
retval += sizeof(struct input_event);
}
- return retval;
+ return retval;
}
/* No kernel lock - fine */
@@ -219,6 +235,32 @@
if ((retval = put_user(dev->idversion, ((short *) arg) + 3))) return retval;
return 0;
+ case EVIOCSFF:
+ if (dev->upload_effect) {
+ struct ff_effect effect;
+ int err;
+
+ if (copy_from_user((void*)(&effect), (void*)arg, sizeof(effect))) {
+ return -EINVAL;
+ }
+ err = dev->upload_effect(dev, &effect);
+ if (put_user(effect.id, &(((struct ff_effect*)arg)->id))) {
+ return -EINVAL;
+ }
+ return err;
+ }
+ else return -ENOSYS;
+
+ case EVIOCRMFF:
+ if (dev->erase_effect) {
+ return dev->erase_effect(dev, (int)arg);
+ }
+ else return -ENOSYS;
+
+ case EVIOCGEFFECTS:
+ put_user(dev->ff_effects_max, (int*) arg);
+ return 0;
+
default:
if (_IOC_TYPE(cmd) != 'E' || _IOC_DIR(cmd) != _IOC_READ)
@@ -236,6 +278,7 @@
case EV_ABS: bits = dev->absbit; len = ABS_MAX; break;
case EV_LED: bits = dev->ledbit; len = LED_MAX; break;
case EV_SND: bits = dev->sndbit; len = SND_MAX; break;
+ case EV_FF: bits = dev->ffbit; len = FF_MAX; break;
default: return -EINVAL;
}
len = NBITS(len) * sizeof(long);
@@ -310,7 +353,7 @@
evdev->devfs = input_register_minor("event%d", minor, EVDEV_MINOR_BASE);
- printk(KERN_INFO "event%d: Event device for input%d\n", minor, dev->number);
+// printk(KERN_INFO "event%d: Event device for input%d\n", minor, dev->number);
return &evdev->handle;
}
@@ -323,13 +366,14 @@
if (evdev->open) {
input_close_device(handle);
+ wake_up_interruptible(&evdev->wait);
} else {
input_unregister_minor(evdev->devfs);
evdev_table[evdev->minor] = NULL;
kfree(evdev);
}
}
-
+
static struct input_handler evdev_handler = {
event: evdev_event,
connect: evdev_connect,
@@ -354,3 +398,5 @@
MODULE_AUTHOR("Vojtech Pavlik <vo...@su...>");
MODULE_DESCRIPTION("Event character device driver");
+MODULE_LICENSE("GPL");
+
Index: input.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/input/input.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- input.c 14 Jan 2001 19:19:02 -0000 1.1.1.1
+++ input.c 10 Apr 2002 15:32:21 -0000 1.2
@@ -1,7 +1,7 @@
/*
* $Id$
*
- * Copyright (c) 1999-2000 Vojtech Pavlik
+ * Copyright (c) 1999-2001 Vojtech Pavlik
*
* The input layer module itself
*
@@ -37,6 +37,8 @@
MODULE_AUTHOR("Vojtech Pavlik <vo...@su...>");
MODULE_DESCRIPTION("Input layer module");
+MODULE_LICENSE("GPL");
+
EXPORT_SYMBOL(input_register_device);
EXPORT_SYMBOL(input_unregister_device);
@@ -124,6 +126,13 @@
break;
+ case EV_MSC:
+
+ if (code > MSC_MAX || !test_bit(code, dev->mscbit))
+ return;
+
+ break;
+
case EV_LED:
if (code > LED_MAX || !test_bit(code, dev->ledbit) || !!test_bit(code, dev->led) == value)
@@ -152,14 +161,11 @@
if (dev->event) dev->event(dev, type, code, value);
break;
- }
-/*
- * Add randomness.
- */
-#if 0 /* BUG */
- add_input_randomness(((unsigned long) dev) ^ (type << 24) ^ (code << 16) ^ value);
-#endif
+ case EV_FF:
+ if (dev->event) dev->event(dev, type, code, value);
+ break;
+ }
/*
* Distribute the event to handler modules.
Index: joydev.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/input/joydev.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -u -r1.1.1.2 -r1.2
--- joydev.c 25 Feb 2001 23:15:16 -0000 1.1.1.2
+++ joydev.c 10 Apr 2002 15:32:21 -0000 1.2
@@ -84,6 +84,7 @@
MODULE_AUTHOR("Vojtech Pavlik <vo...@su...>");
MODULE_DESCRIPTION("Joystick device driver");
+MODULE_LICENSE("GPL");
MODULE_SUPPORTED_DEVICE("input/js");
static int joydev_correct(int value, struct js_corr *corr)
@@ -232,9 +233,10 @@
if (count == sizeof(struct JS_DATA_TYPE)) {
struct JS_DATA_TYPE data;
+ int i;
- data.buttons = ((joydev->nkey > 0 && test_bit(joydev->keypam[0], input->key)) ? 1 : 0) |
- ((joydev->nkey > 1 && test_bit(joydev->keypam[1], input->key)) ? 2 : 0);
+ for (data.buttons = i = 0; i < 32 && i < joydev->nkey; i++)
+ data.buttons |= test_bit(joydev->keypam[i], input->key) ? (1 << i) : 0;
data.x = (joydev->abs[0] / 256 + 128) >> joydev->glue.JS_CORR.x;
data.y = (joydev->abs[1] / 256 + 128) >> joydev->glue.JS_CORR.y;
@@ -323,7 +325,7 @@
struct joydev_list *list = file->private_data;
struct joydev *joydev = list->joydev;
struct input_dev *dev = joydev->handle.dev;
-
+ int i;
switch (cmd) {
@@ -360,6 +362,28 @@
case JSIOCGCORR:
return copy_to_user((struct js_corr *) arg, joydev->corr,
sizeof(struct js_corr) * joydev->nabs) ? -EFAULT : 0;
+ case JSIOCSAXMAP:
+ if (copy_from_user((__u8 *) arg, joydev->abspam, sizeof(__u8) * ABS_MAX))
+ return -EFAULT;
+ for (i = 0; i < ABS_MAX; i++) {
+ if (joydev->abspam[i] > ABS_MAX) return -EINVAL;
+ joydev->absmap[joydev->abspam[i]] = i;
+ }
+ return 0;
+ case JSIOCGAXMAP:
+ return copy_to_user((__u8 *) arg, joydev->abspam,
+ sizeof(__u8) * ABS_MAX) ? -EFAULT : 0;
+ case JSIOCSBTNMAP:
+ if (copy_from_user((__u16 *) arg, joydev->absmap, sizeof(__u16) * (KEY_MAX - BTN_MISC)))
+ return -EFAULT;
+ for (i = 0; i < KEY_MAX - BTN_MISC; i++); {
+ if (joydev->keypam[i] > KEY_MAX || joydev->keypam[i] < BTN_MISC) return -EINVAL;
+ joydev->keymap[joydev->abspam[i - BTN_MISC]] = i;
+ }
+ return 0;
+ case JSIOCGBTNMAP:
+ return copy_to_user((__u16 *) arg, joydev->keypam,
+ sizeof(__u16) * (KEY_MAX - BTN_MISC)) ? -EFAULT : 0;
default:
if ((cmd & ~(_IOC_SIZEMASK << _IOC_SIZESHIFT)) == JSIOCGNAME(0)) {
int len;
@@ -454,7 +478,7 @@
joydev->devfs = input_register_minor("js%d", minor, JOYDEV_MINOR_BASE);
- printk(KERN_INFO "js%d: Joystick device for input%d\n", minor, dev->number);
+// printk(KERN_INFO "js%d: Joystick device for input%d\n", minor, dev->number);
return &joydev->handle;
}
Index: keybdev.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/input/keybdev.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -u -r1.1.1.2 -r1.2
--- keybdev.c 25 Feb 2001 23:15:16 -0000 1.1.1.2
+++ keybdev.c 10 Apr 2002 15:32:21 -0000 1.2
@@ -37,9 +37,18 @@
#include <linux/module.h>
#include <linux/kbd_kern.h>
-#if defined(CONFIG_X86) || defined(CONFIG_IA64) || defined(__alpha__) || defined(__mips__)
+#if defined(CONFIG_X86) || defined(CONFIG_IA64) || defined(__alpha__) || \
+ defined(__mips__) || defined(CONFIG_SPARC64) || defined(CONFIG_SUPERH) || \
+ defined(CONFIG_PPC) || defined(__mc68000__) || defined(__hppa__) || \
+ defined(__arm__)
static int x86_sysrq_alt = 0;
+#ifdef CONFIG_SPARC64
+static int sparc_l1_a_state = 0;
+extern void batten_down_hatches(void);
+#endif
+
+static int jp_kbd_109 = 1; /* Yes, .jp is the default. See 51142. */
static unsigned short x86_keycodes[256] =
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
@@ -58,8 +67,46 @@
308,310,313,314,315,317,318,319,320,321,322,323,324,325,326,330,
332,340,341,342,343,344,345,346,356,359,365,368,369,370,371,372 };
+#ifdef CONFIG_MAC_EMUMOUSEBTN
+extern int mac_hid_mouse_emulate_buttons(int, int, int);
+#endif /* CONFIG_MAC_EMUMOUSEBTN */
+#ifdef CONFIG_MAC_ADBKEYCODES
+extern int mac_hid_keyboard_sends_linux_keycodes(void);
+#else
+#define mac_hid_keyboard_sends_linux_keycodes() 0
+#endif /* CONFIG_MAC_ADBKEYCODES */
+#if defined(CONFIG_MAC_ADBKEYCODES) || defined(CONFIG_ADB_KEYBOARD)
+static unsigned char mac_keycodes[256] = {
+ 0, 53, 18, 19, 20, 21, 23, 22, 26, 28, 25, 29, 27, 24, 51, 48,
+ 12, 13, 14, 15, 17, 16, 32, 34, 31, 35, 33, 30, 36, 54,128, 1,
+ 2, 3, 5, 4, 38, 40, 37, 41, 39, 50, 56, 42, 6, 7, 8, 9,
+ 11, 45, 46, 43, 47, 44,123, 67, 58, 49, 57,122,120, 99,118, 96,
+ 97, 98,100,101,109, 71,107, 89, 91, 92, 78, 86, 87, 88, 69, 83,
+ 84, 85, 82, 65, 42, 0, 10,103,111, 0, 0, 0, 0, 0, 0, 0,
+ 76,125, 75,105,124,110,115, 62,116, 59, 60,119, 61,121,114,117,
+ 0, 0, 0, 0,127, 81, 0,113, 0, 0, 0, 0, 95, 55, 55, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 94, 0, 93, 0, 0, 0, 0, 0, 0,104,102 };
+#endif /* CONFIG_MAC_ADBKEYCODES || CONFIG_ADB_KEYBOARD */
+
static int emulate_raw(unsigned int keycode, int down)
{
+#ifdef CONFIG_MAC_EMUMOUSEBTN
+ if (mac_hid_mouse_emulate_buttons(1, keycode, down))
+ return 0;
+#endif /* CONFIG_MAC_EMUMOUSEBTN */
+#if defined(CONFIG_MAC_ADBKEYCODES) || defined(CONFIG_ADB_KEYBOARD)
+ if (!mac_hid_keyboard_sends_linux_keycodes()) {
+ if (keycode > 255 || !mac_keycodes[keycode])
+ return -1;
+
+ handle_scancode((mac_keycodes[keycode] & 0x7f), down);
+ return 0;
+ }
+#endif /* CONFIG_MAC_ADBKEYCODES || CONFIG_ADB_KEYBOARD */
+
if (keycode > 255 || !x86_keycodes[keycode])
return -1;
@@ -72,9 +119,17 @@
if (keycode == KEY_SYSRQ && x86_sysrq_alt) {
handle_scancode(0x54, down);
+
return 0;
}
+#ifdef CONFIG_SPARC64
+ if (keycode == KEY_A && sparc_l1_a_state) {
+ sparc_l1_a_state = 0;
+ batten_down_hatches();
+ }
+#endif
+
if (x86_keycodes[keycode] & 0x100)
handle_scancode(0xe0, 1);
@@ -87,33 +142,15 @@
if (keycode == KEY_LEFTALT || keycode == KEY_RIGHTALT)
x86_sysrq_alt = down;
+#ifdef CONFIG_SPARC64
+ if (keycode == KEY_STOP)
+ sparc_l1_a_state = down;
+#endif
return 0;
}
-#elif defined(CONFIG_ADB_KEYBOARD)
-
-static unsigned char mac_keycodes[128] =
- { 0, 53, 18, 19, 20, 21, 23, 22, 26, 28, 25, 29, 27, 24, 51, 48,
- 12, 13, 14, 15, 17, 16, 32, 34, 31, 35, 33, 30, 36, 54,128, 1,
- 2, 3, 5, 4, 38, 40, 37, 41, 39, 50, 56, 42, 6, 7, 8, 9,
- 11, 45, 46, 43, 47, 44,123, 67, 58, 49, 57,122,120, 99,118, 96,
- 97, 98,100,101,109, 71,107, 89, 91, 92, 78, 86, 87, 88, 69, 83,
- 84, 85, 82, 65, 42, 0, 10,103,111, 0, 0, 0, 0, 0, 0, 0,
- 76,125, 75,105,124, 0,115, 62,116, 59, 60,119, 61,121,114,117,
- 0, 0, 0, 0,127, 81, 0,113, 0, 0, 0, 0, 0, 55, 55 };
-
-static int emulate_raw(unsigned int keycode, int down)
-{
- if (keycode > 127 || !mac_keycodes[keycode])
- return -1;
-
- handle_scancode(mac_keycodes[keycode] & 0x7f, down);
-
- return 0;
-}
-
-#endif
+#endif /* CONFIG_X86 || CONFIG_IA64 || __alpha__ || __mips__ || CONFIG_PPC */
static struct input_handler keybdev_handler;
@@ -163,14 +200,14 @@
input_open_device(handle);
- printk(KERN_INFO "keybdev.c: Adding keyboard: input%d\n", dev->number);
+// printk(KERN_INFO "keybdev.c: Adding keyboard: input%d\n", dev->number);
return handle;
}
static void keybdev_disconnect(struct input_handle *handle)
{
- printk(KERN_INFO "keybdev.c: Removing keyboard: input%d\n", handle->dev->number);
+// printk(KERN_INFO "keybdev.c: Removing keyboard: input%d\n", handle->dev->number);
input_close_device(handle);
kfree(handle);
}
@@ -185,6 +222,15 @@
{
input_register_handler(&keybdev_handler);
kbd_ledfunc = keybdev_ledfunc;
+
+ if (jp_kbd_109) {
+ x86_keycodes[0xb5] = 0x73; /* backslash, underscore */
+ x86_keycodes[0xb6] = 0x70;
+ x86_keycodes[0xb7] = 0x7d; /* Yen, pipe */
+ x86_keycodes[0xb8] = 0x79;
+ x86_keycodes[0xb9] = 0x7b;
+ }
+
return 0;
}
@@ -199,3 +245,5 @@
MODULE_AUTHOR("Vojtech Pavlik <vo...@su...>");
MODULE_DESCRIPTION("Input driver to keyboard driver binding");
+MODULE_PARM(jp_kbd_109, "i");
+MODULE_LICENSE("GPL");
Index: mousedev.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/input/mousedev.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -u -r1.1.1.2 -r1.2
--- mousedev.c 25 Feb 2001 23:15:16 -0000 1.1.1.2
+++ mousedev.c 10 Apr 2002 15:32:21 -0000 1.2
@@ -3,7 +3,7 @@
*
* Copyright (c) 1999-2000 Vojtech Pavlik
*
- * Input driver to PS/2 or ImPS/2 device driver module.
+ * Input driver to ImExPS/2 device driver module.
*
* Sponsored by SuSE
*/
@@ -66,20 +66,22 @@
signed char ps2[6];
unsigned long buttons;
unsigned char ready, buffer, bufsiz;
- unsigned char mode, genseq, impseq;
+ unsigned char mode, imexseq, impsseq;
};
-#define MOUSEDEV_GENIUS_LEN 5
-#define MOUSEDEV_IMPS_LEN 6
+#define MOUSEDEV_SEQ_LEN 6
-static unsigned char mousedev_genius_seq[] = { 0xe8, 3, 0xe6, 0xe6, 0xe6 };
static unsigned char mousedev_imps_seq[] = { 0xf3, 200, 0xf3, 100, 0xf3, 80 };
+static unsigned char mousedev_imex_seq[] = { 0xf3, 200, 0xf3, 200, 0xf3, 80 };
static struct input_handler mousedev_handler;
static struct mousedev *mousedev_table[MOUSEDEV_MINORS];
static struct mousedev mousedev_mix;
+static int xres = CONFIG_INPUT_MOUSEDEV_SCREEN_X;
+static int yres = CONFIG_INPUT_MOUSEDEV_SCREEN_Y;
+
static void mousedev_event(struct input_handle *handle, unsigned int type, unsigned int code, int value)
{
struct mousedev *mousedevs[3] = { handle->private, &mousedev_mix, NULL };
@@ -99,12 +101,12 @@
switch (code) {
case ABS_X:
size = handle->dev->absmax[ABS_X] - handle->dev->absmin[ABS_X];
- list->dx += (value * CONFIG_INPUT_MOUSEDEV_SCREEN_X - list->oldx) / size;
+ list->dx += (value * xres - list->oldx) / size;
list->oldx += list->dx * size;
break;
case ABS_Y:
size = handle->dev->absmax[ABS_Y] - handle->dev->absmin[ABS_Y];
- list->dy -= (value * CONFIG_INPUT_MOUSEDEV_SCREEN_Y - list->oldy) / size;
+ list->dy -= (value * yres - list->oldy) / size;
list->oldy -= list->dy * size;
break;
}
@@ -124,12 +126,12 @@
case BTN_TOUCH:
case BTN_LEFT: index = 0; break;
case BTN_4:
- case BTN_EXTRA: if (list->mode > 1) { index = 4; break; }
+ case BTN_EXTRA: if (list->mode == 2) { index = 4; break; }
case BTN_STYLUS:
case BTN_1:
case BTN_RIGHT: index = 1; break;
case BTN_3:
- case BTN_SIDE: if (list->mode > 1) { index = 3; break; }
+ case BTN_SIDE: if (list->mode == 2) { index = 3; break; }
case BTN_2:
case BTN_STYLUS2:
case BTN_MIDDLE: index = 2; break;
@@ -257,14 +259,19 @@
list->dy -= list->ps2[off + 2];
list->bufsiz = off + 3;
- if (list->mode > 1)
- list->ps2[off] |= ((list->buttons & 0x18) << 3);
+ if (list->mode == 2) {
+ list->ps2[off + 3] = (list->dz > 7 ? 7 : (list->dz < -7 ? -7 : list->dz));
+ list->dz -= list->ps2[off + 3];
+ list->ps2[off + 3] = (list->ps2[off + 3] & 0x0f) | ((list->buttons & 0x18) << 1);
+ list->bufsiz++;
+ }
- if (list->mode) {
+ if (list->mode == 1) {
list->ps2[off + 3] = (list->dz > 127 ? 127 : (list->dz < -127 ? -127 : list->dz));
- list->bufsiz++;
list->dz -= list->ps2[off + 3];
+ list->bufsiz++;
}
+
if (!list->dx && !list->dy && (!list->mode || !list->dz)) list->ready = 0;
list->buffer = list->bufsiz;
}
@@ -278,26 +285,26 @@
for (i = 0; i < count; i++) {
- c = buffer[i];
+ if (get_user(c, buffer + i))
+ return -EFAULT;
- if (c == mousedev_genius_seq[list->genseq]) {
- if (++list->genseq == MOUSEDEV_GENIUS_LEN) {
- list->genseq = 0;
- list->ready = 1;
+ if (c == mousedev_imex_seq[list->imexseq]) {
+ if (++list->imexseq == MOUSEDEV_SEQ_LEN) {
+ list->imexseq = 0;
list->mode = 2;
}
- } else list->genseq = 0;
+ } else list->imexseq = 0;
- if (c == mousedev_imps_seq[list->impseq]) {
- if (++list->impseq == MOUSEDEV_IMPS_LEN) {
- list->impseq = 0;
- list->ready = 1;
+ if (c == mousedev_imps_seq[list->impsseq]) {
+ if (++list->impsseq == MOUSEDEV_SEQ_LEN) {
+ list->impsseq = 0;
list->mode = 1;
}
- } else list->impseq = 0;
+ } else list->impsseq = 0;
list->ps2[0] = 0xfa;
list->bufsiz = 1;
+ list->ready = 1;
switch (c) {
@@ -306,16 +313,16 @@
break;
case 0xf2: /* Get ID */
- list->ps2[1] = (list->mode == 1) ? 3 : 0;
+ switch (list->mode) {
+ case 0: list->ps2[1] = 0; break;
+ case 1: list->ps2[1] = 3; break;
+ case 2: list->ps2[1] = 4; break;
+ }
list->bufsiz = 2;
break;
case 0xe9: /* Get info */
- if (list->mode == 2) {
- list->ps2[1] = 0x00; list->ps2[2] = 0x33; list->ps2[3] = 0x55;
- } else {
- list->ps2[1] = 0x60; list->ps2[2] = 3; list->ps2[3] = 200;
- }
+ list->ps2[1] = 0x60; list->ps2[2] = 3; list->ps2[3] = 200;
list->bufsiz = 4;
break;
}
@@ -433,7 +440,7 @@
if (mousedev_mix.open)
input_open_device(&mousedev->handle);
- printk(KERN_INFO "mouse%d: PS/2 mouse device for input%d\n", minor, dev->number);
+// printk(KERN_INFO "mouse%d: PS/2 mouse device for input%d\n", minor, dev->number);
return &mousedev->handle;
}
@@ -490,3 +497,9 @@
MODULE_AUTHOR("Vojtech Pavlik <vo...@su...>");
MODULE_DESCRIPTION("Input driver to PS/2 or ImPS/2 device driver");
+MODULE_LICENSE("GPL");
+
+MODULE_PARM(xres, "i");
+MODULE_PARM_DESC(xres, "Horizontal screen resolution");
+MODULE_PARM(yres, "i");
+MODULE_PARM_DESC(yres, "Vertical screen resolution");
|