All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vojtech Pavlik <vojtech@suse.cz>
To: vojtech@suse.cz, linux-kernel@vger.kernel.org
Subject: Re: [patch] Problem with mousedev.c
Date: Mon, 28 Oct 2002 18:40:08 +0100	[thread overview]
Message-ID: <20021028184008.B32183@ucw.cz> (raw)
In-Reply-To: <20021027010538.GA1690@babylon.d2dc.net>; from warp@mercury.d2dc.net on Sat, Oct 26, 2002 at 09:05:38PM -0400

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

  parent reply	other threads:[~2002-10-28 17:47 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-27  1:05 [patch] Problem with mousedev.c Zephaniah E. Hull
2002-10-28 13:27 ` Petr Vandrovec
2002-10-28 17:00   ` Zephaniah E. Hull
2002-10-28 17:40 ` Vojtech Pavlik [this message]
2002-10-30 15:32   ` Zephaniah E. Hull
2002-10-30 15:59     ` Vojtech Pavlik
2002-10-30 16:04       ` Zephaniah E. Hull
2002-10-30 16:11         ` Vojtech Pavlik
2002-10-30 16:21           ` Zephaniah E. Hull
  -- strict thread matches above, loose matches on Subject: below --
2002-10-30 16:46 Petr Vandrovec
2002-10-30 18:37 ` Zephaniah E. Hull

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20021028184008.B32183@ucw.cz \
    --to=vojtech@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.