Re: [MOUSE] Alias for /dev/psaux

From: Vojtech Pavlik
Date: Sun Nov 09 2003 - 05:07:01 EST


On Wed, Nov 05, 2003 at 07:03:21PM +0100, Vojtech Pavlik wrote:
> > How about something like this:
> >
> > - if "mouse_noext" is set (which implies that we won't be doing any
> > probing), we also don't set rate/precision unless the user asked us.
> >
> > Thus "psmouse_noext" becomes the "ultra-safe" setting. We still want to
> > have some way to set things like wheel etc info by hand later on (ie as
> > a response to the user _telling_ us what mouse it is), but that's a
> > more long-range plan.
> >
> > - if we do probing, we first ask the mouse for its current details, and
> > we restore the thing by default afterwards. That at least should give
> > us 2.4.x behaviour unless the mouse is broken (and for broken mice
> > you'd just have to have "mouse_noext").
> >
> > Again, long-term we'd want to have the possibility of tweaking the
> > results later even with the autodetection.
> >
> > Does that sound like a reasonable plan?
>
> Yes, it does.

It didn't work out.

The problem is that the psmouse driver always issues the 0xf6 RESET
command as the second command in the command sequence. This is correct,
because we need to disable the mouse input, so that it doesn't collide
with further probing and setup.

The 0xf6 RESET command will initalize the mouse to the default (100
samples/second, 100 dpi, 1:1 mapping) settings.

So there is no point in saving those settings and restoring them later,
when we know what they are already.

Also, in 2.4, the 0xf6 RESET is one of the first commands XFree86 sends
to the mouse, so again, there is no state left from BIOS or powerup
defaults.

XFree86 also sets the mouse to 200dpi, because that's what some mice
need to operate properly (Windows does the same). Most mice ignore that
setting, anyway.

So the attached patch sets the mouse to 100 samples/second, 200 dpi, 1:1
mapping, which is a standard setting, as close to 2.4 XFree86 behavior as
possible, and a good performance setting, too.

It also in the case of 'psmouse_noext' doesn't probe and set anything
all, though it still issues the RESET command. This is as safe as one
can get.

The only real problem remaining is that the report rate and resolution
cannot be set from XFree86 config and only is available as a
kernel/module parameter. The fix is, howewer not 2.6.0 material.

The attached patch, although rather obvious, was tested on most of my
computers and laptops, and works fine.

Please apply it before 2.6.0 ...

Thanks.

--
Vojtech Pavlik
SuSE Labs, SuSE CR
ChangeSet@xxxxxxxxxx, 2003-11-09 08:45:56+01:00, vojtech@xxxxxxx
input: Always reset PS/2 mouse resolution and update speed to default
values after probing, if probing for extensions is enabled.


psmouse-base.c | 23 +++++++----------------
1 files changed, 7 insertions(+), 16 deletions(-)


diff -Nru a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c
--- a/drivers/input/mouse/psmouse-base.c Sun Nov 9 11:03:54 2003
+++ b/drivers/input/mouse/psmouse-base.c Sun Nov 9 11:03:54 2003
@@ -36,12 +36,10 @@
MODULE_PARM_DESC(psmouse_resetafter, "Reset Synaptics Touchpad after so many bad packets (0 = never).");
MODULE_LICENSE("GPL");

-#define PSMOUSE_LOGITECH_SMARTSCROLL 1
-
static int psmouse_noext;
-int psmouse_resolution;
-unsigned int psmouse_rate;
-int psmouse_smartscroll = PSMOUSE_LOGITECH_SMARTSCROLL;
+int psmouse_resolution = 200;
+unsigned int psmouse_rate = 100;
+int psmouse_smartscroll = 1;
unsigned int psmouse_resetafter;

static char *psmouse_protocols[] = { "None", "PS/2", "PS2++", "PS2T++", "GenPS/2", "ImPS/2", "ImExPS/2", "SynPS/2"};
@@ -466,22 +464,15 @@
{
unsigned char param[2];

-
/*
- * We set the mouse report rate.
+ * We set the mouse report rate, resolution and scaling.
*/

- if (psmouse_rate)
+ if (!psmouse_noext) {
psmouse_set_rate(psmouse);
-
-/*
- * We also set the resolution and scaling.
- */
-
- if (psmouse_resolution)
psmouse_set_resolution(psmouse);
-
- psmouse_command(psmouse, NULL, PSMOUSE_CMD_SETSCALE11);
+ psmouse_command(psmouse, NULL, PSMOUSE_CMD_SETSCALE11);
+ }

/*
* We set the mouse into streaming mode.