linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* Patch to fix imps2 emulation for usb mice in stable 2.2.X series
@ 2000-03-04 14:09 Kevin Hendricks
  2000-03-04 18:18 ` Michael Schmitz
  0 siblings, 1 reply; 4+ messages in thread
From: Kevin Hendricks @ 2000-03-04 14:09 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc-dev

[-- Attachment #1: Type: text/plain, Size: 1615 bytes --]

Hi Paul,

According to the XFree 4.0 developers bit 3 in the first character from all
imps/2 mice must be set.  This was not the case in early 2.3.X kernels but this
bug was found and fixed in later 2.3.XX kernels.

The Xfree 4.0 Xserver uses this fact to determine if characters read from a
imps/2 mouse are out-of-sync or not.

Because our 2.2.X kernel usb mouse.c code never properly sets this bit in the
first character, the XFree 4.0 Xservers are throwing out the first character
read from the mouse umaking for mouse mayhem.

Will you please install this patch into the 2.2.X stable kernel series?  It
will make our imps2 usb mouse properly follow the conventions for imps2 mice
and make it more like what the 2.3.XX kernels are doing right now

I have tried this patch with the latest XFree 3.9.18 Xserver, and with Xpmac
(rev 9) and an older Mac-On-Linux and it does not cause any problems.

Thanks.

Kevin


--- drivers/usb/mouse.c.prev	Fri Mar  3 17:18:37 2000
+++ drivers/usb/mouse.c	Fri Mar  3 17:19:56 2000
@@ -183,6 +183,7 @@
 		switch (state) {
 		case 0: { /* buttons and sign */
 			int buttons = mouse->buttons;
+                        buttons = buttons | 0x08; // set bit 3 to fit imps/2
 			mouse->buttons = 0;
 			if (mouse->dx < 0)
 				buttons |= 0x10;


p.s. In case the e-mail mangles this, I have attached the patch as a file also.

Thanks,

Kevin


--
Kevin B. Hendricks
Associate Professor of Operations and Information Technology
Richard Ivey School of Business, University of Western Ontario
London, Ontario  N6A-3K7  CANADA
khendricks@ivey.uwo.ca, (519) 661-3874, fax: 519-661-3959


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: usb_imps2.patch --]
[-- Type: text/x-c++; name="usb_imps2.patch", Size: 360 bytes --]

--- drivers/usb/mouse.c.prev	Fri Mar  3 17:18:37 2000
+++ drivers/usb/mouse.c	Fri Mar  3 17:19:56 2000
@@ -183,6 +183,7 @@
 		switch (state) {
 		case 0: { /* buttons and sign */
 			int buttons = mouse->buttons;
+                        buttons = buttons | 0x08; // set bit 3 to fit imps/2
 			mouse->buttons = 0;
 			if (mouse->dx < 0)
 				buttons |= 0x10;

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Patch to fix imps2 emulation for usb mice in stable 2.2.X series
  2000-03-04 14:09 Patch to fix imps2 emulation for usb mice in stable 2.2.X series Kevin Hendricks
@ 2000-03-04 18:18 ` Michael Schmitz
  2000-03-06  7:25   ` Paul Mackerras
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Schmitz @ 2000-03-04 18:18 UTC (permalink / raw)
  To: Kevin Hendricks; +Cc: Paul Mackerras, linuxppc-dev


> Will you please install this patch into the 2.2.X stable kernel series?  It
> will make our imps2 usb mouse properly follow the conventions for imps2 mice
> and make it more like what the 2.3.XX kernels are doing right now

You remind me of another USB mouse issue I stumbled on with 2.2.15: I had
happily set up X to use the USB mouse as secondary mouse in the Xinput
section for some time, when suddenly 2.2.15 changed the USB mouse
behavior. All USB mouse clicks were doubled or tripled ...

Just feeding USB mouse events to ADB might seem like a cute hack, but what
happens if somebody actually opens the USB mouse device (horror) and wants
to feed mouse events to X for his own purpose ? This patch makes the hack
a config option; what's missing is a test to determine whether the mouse
device has already been opened, so we get redirection of mouse events to
ADB as long as the mouse isn't in use for something else. mouse->active=1
is already used to enable the hack, so we probably need to check for
mouse->active < 2 before calling adb_mouse_interrupt (haven't tested
that).

Works For Me (tm) with XFree 3.3.3.1 ...

	Michael

--- drivers/usb/mouse.c.org	Wed Mar  1 13:59:15 2000
+++ drivers/usb/mouse.c	Sat Mar  4 18:52:31 2000
@@ -117,7 +117,7 @@
 	if (mouse->fasync)
 		kill_fasync(mouse->fasync, SIGIO, POLL_IN);

-#ifdef CONFIG_ADBMOUSE
+#ifdef CONFIG_USB_ADBMOUSE
 	/* XXX send the movement/buttons to the ADB mouse code as well */
 	{
 		extern void adb_mouse_interrupt(unsigned char *, int);
@@ -130,7 +130,7 @@
 		buf[3] = ((~data[0] << 6) & 0x80);
 		adb_mouse_interrupt(buf, 4);
 	}
-#endif /* CONFIG_ADBMOUSE */
+#endif /* CONFIG_USB_ADBMOUSE */

 	return 1;
 }
@@ -418,11 +418,11 @@

 	printk(KERN_INFO "USB HID boot protocol mouse driver registered.\n");

-#ifdef CONFIG_ADBMOUSE
+#ifdef CONFIG_USB_ADBMOUSE
 	/* make the mouse(s) work as an adb mouse even when
 	   the usb mouse device isn't open */
 	mouse->active = 1;
-#endif /* CONFIG_ADBMOUSE */
+#endif /* CONFIG_USB_ADBMOUSE */

 	return 0;
 }
--- drivers/usb/Config.in.org	Sat Mar  4 18:51:42 2000
+++ drivers/usb/Config.in	Sat Mar  4 18:51:30 2000
@@ -31,6 +31,9 @@
 comment 'USB Devices'
    dep_tristate '  USB hub support (Required!)' CONFIG_USB_HUB $CONFIG_USB
    dep_tristate '  USB mouse support' CONFIG_USB_MOUSE $CONFIG_USB
+   if [ "$CONFIG_USB_MOUSE" != "n" -a "$CONFIG_ADBMOUSE" != "n" ]; then
+      bool '    Feed USB mouse packets to ADB mouse driver?' CONFIG_USB_ADBMOUSE
+   fi
    dep_tristate '  USB HP scanner support' CONFIG_USB_HP_SCANNER $CONFIG_USB
    dep_tristate '  USB keyboard support' CONFIG_USB_KBD $CONFIG_USB
    dep_tristate '  USB Audio support' CONFIG_USB_AUDIO $CONFIG_USB

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Patch to fix imps2 emulation for usb mice in stable 2.2.X series
  2000-03-04 18:18 ` Michael Schmitz
@ 2000-03-06  7:25   ` Paul Mackerras
  2000-03-06 13:02     ` Michael Schmitz
  0 siblings, 1 reply; 4+ messages in thread
From: Paul Mackerras @ 2000-03-06  7:25 UTC (permalink / raw)
  To: Michael Schmitz, Kevin Hendricks; +Cc: Linux/PPC Developer list


On Sun, 05 Mar 2000, Michael Schmitz wrote:

> You remind me of another USB mouse issue I stumbled on with 2.2.15: I had
> happily set up X to use the USB mouse as secondary mouse in the Xinput
> section for some time, when suddenly 2.2.15 changed the USB mouse
> behavior. All USB mouse clicks were doubled or tripled ...

My fault, I'm sorry, it seemed like a good idea at the time... :-)
That was before I knew how to tell XFree86 to use two mice.  I have
changed the #ifdef now.  If someone really wants this they can change the
ifdef or something.

Paul.

--
Paul Mackerras, Senior Open Source Researcher, Linuxcare, Inc.
+61 2 6262 8990 tel, +61 2 6262 8991 fax
paulus@linuxcare.com.au, http://www.linuxcare.com.au/
Linuxcare.  Support for the revolution.

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Patch to fix imps2 emulation for usb mice in stable 2.2.X series
  2000-03-06  7:25   ` Paul Mackerras
@ 2000-03-06 13:02     ` Michael Schmitz
  0 siblings, 0 replies; 4+ messages in thread
From: Michael Schmitz @ 2000-03-06 13:02 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: Kevin Hendricks, Linux/PPC Developer list


> > You remind me of another USB mouse issue I stumbled on with 2.2.15: I had
> > happily set up X to use the USB mouse as secondary mouse in the Xinput
> > section for some time, when suddenly 2.2.15 changed the USB mouse
> > behavior. All USB mouse clicks were doubled or tripled ...
>
> My fault, I'm sorry, it seemed like a good idea at the time... :-)
> That was before I knew how to tell XFree86 to use two mice.  I have
> changed the #ifdef now.  If someone really wants this they can change the
> ifdef or something.

Thank. Turns out my other idea about testing the mouse active count didn't
work out for some reason so changing the ifdef is the only solution right
now.

	Michael


** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2000-03-06 13:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2000-03-04 14:09 Patch to fix imps2 emulation for usb mice in stable 2.2.X series Kevin Hendricks
2000-03-04 18:18 ` Michael Schmitz
2000-03-06  7:25   ` Paul Mackerras
2000-03-06 13:02     ` Michael Schmitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).