Re: [patch] Problem with mousedev.c

Vojtech Pavlik (vojtech@suse.cz)
Mon, 28 Oct 2002 18:40:08 +0100


On Sat, Oct 26, 2002 at 09:05:38PM -0400, Zephaniah E. Hull wrote:
> To make a long story short, mousedev.c does not properly implement the
> EXPS/2 protocol, specificly dealing with the wheel.
>
> The lower 8 bits of the 4th byte are supposed to be 0x1 or 0xf to
> indicate movement of the first wheel, and 0x2 or 0xe for the second
> wheel.

No, see microsoft documentation. They're expected to be a 4-bit signed
binary complement value that indicates the amount of movement.

> Attached is a patch to correct this.
>
> This does not get my two wheel mouse working perfectly yet, sadly that
> will take a bit of a hack, and I'm not sure where the best place to put
> it is yet, but this gets it back to generating correct data.

PS/2 A4-Tech mouse do the ugly trick you describe above to stuff two
wheel information into a single-wheel oriented ImExPS/2 protocol. USB
A4-Tech mouse do another ugly trick (additional button which specifies
which wheel is rotating). I'm not interested in supporting these ugly
tricks.

If you want to support the H-Wheel in GPM, then please add
/dev/input/event support into GPM. (simple patch attached, you may need
to do more changes, namely for h-wheel).

--- mice.c Mon Jan 24 17:01:13 2000
+++ mice.c.new Mon Jan 24 17:01:30 2000
@@ -1405,6 +1405,46 @@
return type;
}

+static int M_evdev(Gpm_Event *state, unsigned char *data)
+{
+ struct input_event *event = (struct input_event *)data;
+ switch (event->type) {
+ case EV_KEY:
+ switch (event->code) {
+ case BTN_LEFT:
+ state->buttons = (state->buttons & ~GPM_B_LEFT) | (GPM_B_LEFT*event->value);
+ break;
+ case BTN_RIGHT:
+ state->buttons = (state->buttons & ~GPM_B_RIGHT) | (GPM_B_RIGHT*event->value);
+ break;
+ case BTN_MIDDLE:
+ state->buttons = (state->buttons & ~GPM_B_MIDDLE) | (GPM_B_MIDDLE*event->value);
+ break;
+ default:
+ break;
+ }
+ break;
+ case EV_REL:
+ switch (event->code) {
+ case REL_X:
+ state->dx = event->value;
+ break;
+ case REL_Y:
+ state->dy = event->value;
+ break;
+ case REL_WHEEL:
+ state->wdx = event->value;
+ break;
+ default:
+ break;
+ }
+ break;
+ default:
+ break;
+ }
+ return 0;
+}
+



@@ -1550,6 +1590,9 @@
" connector with 6 pins), 3 buttons.",
"", M_kmiabps2, I_kmiabps2, STD_FLG,
{0x00, 0x00, 0x00, 0x00}, 3, 1, 0, 0, 0},
+
+ {"evdev", "Linux input event device", "", M_evdev, NULL, STD_FLG,
+ {0x00, 0x00, 0x00, 0x00}, sizeof(struct input_event),
+ sizeof(struct input_event), 0, 0, 0},

{"", "",
"", NULL, NULL, 0,
--- mice.c Mon Jan 24 17:02:09 2000
+++ mice.c.new Mon Jan 24 17:04:00 2000
@@ -69,6 +69,7 @@
#include <linux/joystick.h>
#endif

+#include <linux/input.h>

#include "gpmInt.h"
#include "twiddler.h"

-- 
Vojtech Pavlik
SuSE Labs
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/