public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: mouse problems in 2.4.2 -> lost byte
@ 2001-03-27 20:29 James Simmons
  2001-03-27 20:48 ` Gunther Mayer
  2001-03-27 20:50 ` linas
  0 siblings, 2 replies; 14+ messages in thread
From: James Simmons @ 2001-03-27 20:29 UTC (permalink / raw)
  To: Gunther Mayer; +Cc: linas, Linux Kernel Mailing List


>This is easily explained: some byte of the mouse protocol was lost.
>(Some mouse protocols are even designed to allow
>easy resync/recovery by fixed bit patterns!)
>
>Write an intelligent mouse driver for XFree86 to compensate for
>lost bytes.

Or write a kernel input device driver. In fact I probable have a mouse
driver for you. What kind of mouse do you have? Then set your X config to
have the following:

Section "Pointer"
            Protocol    "ImPS/2"
            Device      "/dev/input/mice"
            ZAxisMapping 4 5
EndSection

This way you don't have to wait a few months before the bug is fixed by
XFree86.

MS: (n) 1. A debilitating and surprisingly widespread affliction that
renders the sufferer barely able to perform the simplest task. 2. A disease.

James Simmons  [jsimmons@linux-fbdev.org]               ____/|
fbdev/console/gfx developer                             \ o.O|
http://www.linux-fbdev.org                               =(_)=
http://linuxgfx.sourceforge.net                            U
http://linuxconsole.sourceforge.net


^ permalink raw reply	[flat|nested] 14+ messages in thread
* Re: mouse problems in 2.4.2 -> lost byte
@ 2001-03-29  4:43 James Simmons
  0 siblings, 0 replies; 14+ messages in thread
From: James Simmons @ 2001-03-29  4:43 UTC (permalink / raw)
  To: linas; +Cc: Vojtech Pavlik, Gunther Mayer, linas, Linux Kernel Mailing List


>> The new input psmouse driver can resync when bytes are lost and also
>> shouldn't lose any bytes if there are not transmission problems on the
>> wire. But this is 2.5 stuff.
>
>umm linux kernel 2.5? Umm, given that a stable linux 2.6/3.0 might be
>years away ... and this seems 'minor', wouldn't it be better to
>submit this as a teeny-weeny new kind of mouse device driver as a 2.4.x
>patch?  e.g. CONFIG_MOUSE_PSAUX_SUPERSYNC or something?   I mean this
>cant be more than a few hundred lines of code? Requireing no other
>changes to the kernel?

Its more than a few hundred lines. Mind you it wouldn't be hard to patch
2.4.X to use the new PS/2 drivers but it is a pretty big change. I
seriously don't it would go in. Your welcomed to try out these drivers. I
have personally been using these new PS/2 drivers for several months now
with now problems. In fact this driver can trick my i8042 chipset to allow
me to plug two PS/2 keyboards in :-)

MS: (n) 1. A debilitating and surprisingly widespread affliction that
renders the sufferer barely able to perform the simplest task. 2. A disease.

James Simmons  [jsimmons@linux-fbdev.org]               ____/|
fbdev/console/gfx developer                             \ o.O|
http://www.linux-fbdev.org                               =(_)=
http://linuxgfx.sourceforge.net                            U
http://linuxconsole.sourceforge.net


^ permalink raw reply	[flat|nested] 14+ messages in thread
* Re: mouse problems in 2.4.2 -> lost byte
@ 2001-03-29  3:47 James Simmons
  0 siblings, 0 replies; 14+ messages in thread
From: James Simmons @ 2001-03-29  3:47 UTC (permalink / raw)
  To: Gunther Mayer; +Cc: Linux Kernel Mailing List


>So you recommend to connect the mouse to USB (instead of psaux) because
>psaux+Xfree86 are losing bytes under circumstances (e.g. some load
>pattern).
>
>This is a fine solution for users with dual protocol mice, but doesn't
>resolve the problem for other poor ps/2 mouse owners !

You misunderstood me. For 2.4.X it is:

Real PS/2 mouse -> /dev/psaux -> PS/2 protocol -> X server

All mice using /dev/input/mice -> PS/2 protocol -> X server

Yes mice. I have had 5 mice attached and going to the X server. It was no
problem. Multiple keyboards, well that is another story :-( It doesn't
matter to the X server if two different devices are sending the same
protocol. Since the protocol is coming in from two different devices theri
is no conflict. I believe we was having problems with another type of
mouse.

>Even with PS/2 mouse support in the "new input" driver I wouldn't expect
>the psaux-byte-lost bug to disappear magically.

I see Vojtech has answered this already.

MS: (n) 1. A debilitating and surprisingly widespread affliction that
renders the sufferer barely able to perform the simplest task. 2. A disease.

James Simmons  [jsimmons@linux-fbdev.org]               ____/|
fbdev/console/gfx developer                             \ o.O|
http://www.linux-fbdev.org                               =(_)=
http://linuxgfx.sourceforge.net                            U
http://linuxconsole.sourceforge.net


^ permalink raw reply	[flat|nested] 14+ messages in thread
* Re: mouse problems in 2.4.2 -> lost byte
@ 2001-03-28 15:32 James Simmons
  2001-03-28 18:21 ` Gunther Mayer
  0 siblings, 1 reply; 14+ messages in thread
From: James Simmons @ 2001-03-28 15:32 UTC (permalink / raw)
  To: Gunther Mayer; +Cc: Linux Kernel Mailing List


>Where can I get your driver?

I attach it to the other posting to this thread. I also have it in CVS at
http://linuxconsole.sourceforge.net with a bunch of other input drivers.

>> Section "Pointer"
>>             Protocol    "ImPS/2"
>>             Device      "/dev/input/mice"
>
>What is better in using /dev/input/mice than /dev/psaux
>on this problem exactly?

The reason to use /dev/input/mice is the PS/2 mouse driver itself has not
been ported over to the input suite for 2.4.X. You can use the above for
the USB mouse now. Now if you have a USB mouse plus a PS/2 mouse then
having both use /dev/psaux would require a reworking of the PS/2 driver.
I rather port over the PS/2 mouse to use /dev/input/mice. I have done this
for my CVS but since the PS/2 mouse shares the same chipset as the PS/2
keyboard you have to use both input drivers. It would be better if XFree86
would have a /dev/eventX driver but we would wait a long time for that to
happen :-(

MS: (n) 1. A debilitating and surprisingly widespread affliction that
renders the sufferer barely able to perform the simplest task. 2. A disease.

James Simmons  [jsimmons@linux-fbdev.org]               ____/|
fbdev/console/gfx developer                             \ o.O|
http://www.linux-fbdev.org                               =(_)=
http://linuxgfx.sourceforge.net                            U
http://linuxconsole.sourceforge.net


^ permalink raw reply	[flat|nested] 14+ messages in thread
* Re: mouse problems in 2.4.2 -> lost byte
@ 2001-03-28 15:22 James Simmons
  0 siblings, 0 replies; 14+ messages in thread
From: James Simmons @ 2001-03-28 15:22 UTC (permalink / raw)
  To: linas; +Cc: Gunther Mayer, Linux Kernel Mailing List

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1003 bytes --]



>logitech trackman marble wheel.
>
>send me the driver.

Attached :-) I'm assuming you use the logitech busmouse driver. Logitech
makes many kinds of mice.

>Are you working on getting the thing incorporated
>into xf86? should I pester someone over there about it?  should I assume
>that 'everything will be OK', if I wait long enough?

This is a kernel driver so it is independent of XFree86. Use the
configuration I told you about with X and it will work. Well as long as
XFree86 doesn't break its PS/2 driver.

If you have any problems setting it up let me know.

MS: (n) 1. A debilitating and surprisingly widespread affliction that
renders the sufferer barely able to perform the simplest task. 2. A disease.

James Simmons  [jsimmons@linux-fbdev.org]               ____/|
fbdev/console/gfx developer                             \ o.O|
http://www.linux-fbdev.org                               =(_)=
http://linuxgfx.sourceforge.net                            U
http://linuxconsole.sourceforge.net

[-- Attachment #2: Type: TEXT/plain, Size: 5167 bytes --]

/*
 * $Id: logibm.c,v 1.7 2000/05/29 11:19:51 vojtech Exp $
 *
 *  Copyright (c) 1999-2000 Vojtech Pavlik
 *
 *  Based on the work of:
 *	James Banks		Matthew Dillon
 *	David Giller		Nathan Laredo
 *	Linus Torvalds		Johan Myreen
 *	Cliff Matthews		Philip Blundell
 *	Russell King
 *
 *  Sponsored by SuSE
 */

/*
 * Logitech Bus Mouse Driver for Linux
 */

/*
 * 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
 * 
 * Should you need to contact me, the author, you can do so either by
 * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
 * Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic
 */

#include <asm/io.h>
#include <asm/irq.h>

#include <linux/module.h>
#include <linux/delay.h>
#include <linux/ioport.h>
#include <linux/init.h>
#include <linux/input.h>

#define	LOGIBM_BASE		0x23c
#define	LOGIBM_EXTENT		4

#define	LOGIBM_DATA_PORT	LOGIBM_BASE + 0
#define	LOGIBM_SIGNATURE_PORT	LOGIBM_BASE + 1
#define	LOGIBM_CONTROL_PORT	LOGIBM_BASE + 2
#define	LOGIBM_CONFIG_PORT	LOGIBM_BASE + 3

#define	LOGIBM_ENABLE_IRQ	0x00
#define	LOGIBM_DISABLE_IRQ	0x10
#define	LOGIBM_READ_X_LOW	0x80
#define	LOGIBM_READ_X_HIGH	0xa0
#define	LOGIBM_READ_Y_LOW	0xc0
#define	LOGIBM_READ_Y_HIGH	0xe0

#define LOGIBM_DEFAULT_MODE	0x90
#define LOGIBM_CONFIG_BYTE	0x91
#define LOGIBM_SIGNATURE_BYTE	0xa5

#define LOGIBM_IRQ		5

MODULE_PARM(logibm_irq, "i");

static int logibm_irq = LOGIBM_IRQ;
static int logibm_used = 0;

static void logibm_interrupt(int irq, void *dev_id, struct pt_regs *regs);

static int logibm_open(struct input_dev *dev)
{
	if (logibm_used++)
		return 0;
	if (request_irq(logibm_irq, logibm_interrupt, 0, "logibm", NULL)) {
		logibm_used--;
		printk(KERN_ERR "logibm.c: Can't allocate irq %d\n", logibm_irq);
		return -EBUSY;
	}
	outb(LOGIBM_ENABLE_IRQ, LOGIBM_CONTROL_PORT);
	return 0;
}

static void logibm_close(struct input_dev *dev)
{
	if (--logibm_used)
		return;
	outb(LOGIBM_DISABLE_IRQ, LOGIBM_CONTROL_PORT);
	free_irq(logibm_irq, NULL);
}

static struct input_dev logibm_dev = {
	evbit:		{ BIT(EV_KEY) | BIT(EV_REL) },
	keybit: 	{ [LONG(BTN_LEFT)] = BIT(BTN_LEFT) | BIT(BTN_MIDDLE) | BIT(BTN_RIGHT) },
	relbit:		{ BIT(REL_X) | BIT(REL_Y) },
	open:		logibm_open,
	close:		logibm_close,
	name:		"Logitech bus mouse",
	idbus:		BUS_ISA,
	idvendor:	0x0002,
	idproduct:	0x0001,
	idversion:	0x0100,
};

static void logibm_interrupt(int irq, void *dev_id, struct pt_regs *regs)
{
	char dx, dy;
	unsigned char buttons;

	outb(LOGIBM_READ_X_LOW, LOGIBM_CONTROL_PORT);
	dx = (inb(LOGIBM_DATA_PORT) & 0xf);
	outb(LOGIBM_READ_X_HIGH, LOGIBM_CONTROL_PORT);
	dx |= (inb(LOGIBM_DATA_PORT) & 0xf) << 4;
	outb(LOGIBM_READ_Y_LOW, LOGIBM_CONTROL_PORT);
	dy = (inb(LOGIBM_DATA_PORT) & 0xf);
	outb(LOGIBM_READ_Y_HIGH, LOGIBM_CONTROL_PORT);
	buttons = inb(LOGIBM_DATA_PORT);
	dy |= (buttons & 0xf) << 4;
	buttons = ~buttons;

	input_report_rel(&logibm_dev, REL_X, dx);
	input_report_rel(&logibm_dev, REL_Y, 255 - dy);
	input_report_key(&logibm_dev, BTN_MIDDLE, buttons & 1);
	input_report_key(&logibm_dev, BTN_LEFT,   buttons & 2);
	input_report_key(&logibm_dev, BTN_RIGHT,  buttons & 4);
}

#ifndef MODULE
static int __init logibm_setup(char *str)
{
        int ints[4];
        str = get_options(str, ARRAY_SIZE(ints), ints);
        if (ints[0] > 0) logibm_irq = ints[1];
        return 1;
}
__setup("logibm_irq=", logibm_setup);
#endif

static int __init logibm_init(void)
{
	if (request_region(LOGIBM_BASE, LOGIBM_EXTENT, "logibm")) {
		printk(KERN_ERR "logibm.c: Can't allocate ports at %#x\n", LOGIBM_BASE);
		return -EBUSY;
	}

	outb(LOGIBM_CONFIG_BYTE, LOGIBM_CONFIG_PORT);
	outb(LOGIBM_SIGNATURE_BYTE, LOGIBM_SIGNATURE_PORT);
	udelay(100);

	if (inb(LOGIBM_SIGNATURE_PORT) != LOGIBM_SIGNATURE_BYTE) {
		release_region(LOGIBM_BASE, LOGIBM_EXTENT);
		printk(KERN_ERR "logibm.c: Didn't find Logitech busmouse at %#x\n", LOGIBM_BASE);
		return -ENODEV;
	}

	outb(LOGIBM_DEFAULT_MODE, LOGIBM_CONFIG_PORT);
	outb(LOGIBM_DISABLE_IRQ, LOGIBM_CONTROL_PORT);

	input_register_device(&logibm_dev);

	printk(KERN_INFO "input%d: Logitech bus mouse at %#x irq %d\n",
		logibm_dev.number, LOGIBM_BASE, logibm_irq);

	return 0;
}

static void __exit logibm_exit(void)
{
	input_unregister_device(&logibm_dev);
	release_region(LOGIBM_BASE, LOGIBM_EXTENT);
}

module_init(logibm_init);
module_exit(logibm_exit);

^ permalink raw reply	[flat|nested] 14+ messages in thread
* mouse problems in 2.4.2
@ 2001-03-25 22:33 linas
  2001-03-27 20:15 ` mouse problems in 2.4.2 -> lost byte Gunther Mayer
  0 siblings, 1 reply; 14+ messages in thread
From: linas @ 2001-03-25 22:33 UTC (permalink / raw)
  To: linux-kernel



Hi,

I am experiencing debilitating intermittent mouse problems & was about 
to dive into the kernel to see if I could debug it.  But first, I thought
a quick note to the mailing list may help.

Symptoms:
After a long time of flawless operation (ranging from nearly a week to 
as little as five minutes), the X11 pointer flies up to top-right corner, 
and mostly wants to stay there.  Moving the mouse causes a cascade of 
spurious button-press events get generated.

This did not occur with 2.4.0test2 or 2.2.16 (to the best of my
recollection) and first showed up in 2.4.0test7 or 2.4.1 (not sure).
With 2.4.2, the symptoms seem slightly different (almost all pointer
movement events seem to be lost; although spurious button-press events
still happen).

Mouse is a logitech trackman marble, with USB connector to
logitech-supplied USB to ps/2 DIN plug.  Configured as a PS/2 mouse.
Motherboard is a Athalon/VIA Apollo KA7.

Unplugging mouse for 10 seconds sometimes fixes the problem on the sixth
try, sometimes. 

Switching to virtual terminal running gpm, and back to X11 used to fix
the problem, sometimes, after some magic incantations, unplugging,
starting gpm, moving mouse, etc.  This no longer does the trick w/
2.4.2.

Rebooting X11 frequently, but not always, fixed the problem.

The *only* sure-fire fix is to reboot the system. 

Sometimes, the mouse seemed usable with gpm even as it wasn't with X11;
sometimes it had the same bad behaviour (scooting to the corner,
spurious button-press) even under gpm.

Changing mouse protocols to imps2 from ps2 in gpm/X11 seems to make no
difference.

Disabling power management in kernel and bios to various degrees (including 
disabling *all* power management) doesn't seem to fix anything.  (It
was suggested to me that this was an APM bug; indeed, an early
manifestation of the bug seemed to be that it triggered if/when I moved
the mouse just as the video-powersave triggered. )

Sometimes, the problem seems to be associated with moving the mouse
during CPU-intensive or disk-i/o intensive operations (e.g. a large 
file copy, compile; or system activity during mp3 playing) Lost
interrupt?

On rare ocasions, its associated with system lockup.  (specifically,
some keyboard buffer seems to fill up, and everything seems hung,  
not even ctrl-alt-del works).  (I haven't checked to see if I can 
still telnet in). 

I've been living with this problem for 6+ months, and it is getting to
be infuriating.  As you can see above, all sorts of different attempts
above make subtle variations in the symptoms, but no fixes.  

I conclude that this is probably a hardware (motherboard chipset)
bug, that its rare (google/deja  searches are unfruitful) and that 
the only place to hunt is in the kernel. 

---------------
So: any advice, comments, suggestions before I embark on a long and
possibly fruitless hunt?  Any recommendations for best tools/proceedures
to catch it 'in the act'?  

--linas

p.s. direct replies to linas@linas.org appreciated.




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

end of thread, other threads:[~2001-03-29  5:47 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-03-27 20:29 mouse problems in 2.4.2 -> lost byte James Simmons
2001-03-27 20:48 ` Gunther Mayer
2001-03-27 20:50 ` linas
  -- strict thread matches above, loose matches on Subject: below --
2001-03-29  4:43 James Simmons
2001-03-29  3:47 James Simmons
2001-03-28 15:32 James Simmons
2001-03-28 18:21 ` Gunther Mayer
2001-03-28 15:22 James Simmons
2001-03-25 22:33 mouse problems in 2.4.2 linas
2001-03-27 20:15 ` mouse problems in 2.4.2 -> lost byte Gunther Mayer
2001-03-27 20:45   ` linas
2001-03-28 18:31     ` Gunther Mayer
2001-03-28 21:59       ` Vojtech Pavlik
2001-03-28 23:19         ` linas
2001-03-29  5:45           ` Vojtech Pavlik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox