Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 4 Jan 2004 17:19:42 +0100
From:      Philip Paeps <philip+freebsd@paeps.cx>
To:        David Gilbert <dgilbert@dclg.ca>
Cc:        freebsd-current@freebsd.org
Subject:   Re: new psm patch.
Message-ID:  <20040104161942.GE3628@loge.home.paeps.cx>
In-Reply-To: <16373.49080.401073.12711@canoe.dclg.ca>
References:  <16373.49080.401073.12711@canoe.dclg.ca>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2004-01-02 14:00:08 (-0500), David Gilbert <dgilbert@dclg.ca> wrote:
> I was applying the psm patch posted here recently.  Not the one that was for
> the Xserver, but the one that was for the moused operation.  It didn't apply
> cleanly.  Included is a patch that applies to current with the same effect.
> I would like to see discussion towards including this in -CURRENT as
> touchpad support is a hot laptop topic.

Very nice :-)

> As a note to the origional author, it seems that 'ipacket' is now referenced
> by 'pb' rather than 'sc' in the driver.  It looks like ipacket was a member
> of the sc structure but now is a sub-member.

Someone recently added some buffering code to psm, I updated my local patch,
but hadn't had time to furture develop it.

> +    { MOUSE_MODEL_SYNAPTICS,		/* Synaptics TouchPad */
> +      0xc0, MOUSE_PS2SYNAP_PACKETSIZE, enable_synaptics, },

This will catch every Synaptics pad on the market, not only the ones with the
'new' absolute packet format, and not all of them support all features :-/  In
fact 'older' (not that old) pads will fail spectacularly on some features.

> +	    /* Sanity check for out of sync packets. */
> +	    if ((pb->ipacket[0] & 0xc8) != 0x80 || (pb->ipacket[3] & 0xc8) != 0xc0)
> +		continue;

There are some other formats of packets that need to be taken into account.  I
did a check for the different bits in my enable_synaptics function, and then
did different sanity checks if different bits were available (following the
'interfacing guide' from Synaptics):

		/* New packet format with 'W'-bit */
		if (sc->flags & PSM_SYN_HAVE_CAPEXT)
		{
			if ((pb->ipacket[0] & 0xc8) != 0x80)
			{
				printf("psmintr: wanted 0x80 got 0x%02x\n",
					(pb->ipacket[0] & 0xc8));
                                continue;
			}

			if ((pb->ipacket[3] & 0xc8) != 0xc0)
			{
				printf("psmintr: wanted 0xc0 got 0x%02x\n",
					(pb->ipacket[3] & 0xc8));
                                continue;
			}
		}

		/* New packet format without 'W'-bit */
		else if (sc->flags & PSM_SYN_HAVE_NEWABS)
		{
			if ((pb->ipacket[0] & 0xc8) != 0x80)
			{
				printf("psmintr: wanted 0x80 got 0x%02x\n",
					(pb->ipacket[0] & 0xc8));
                                continue;
			}

			if ((pb->ipacket[3] & 0xc8) != 0xc0)
			{
				printf("psmintr: wanted 0xc0 got 0x%02x\n",
					(pb->ipacket[3] & 0xc8));
                                continue;
			}

			if ((pb->ipacket[0] & 0x0f) != (pb->ipacket[3] & 0x0f))
			{
				printf("psmintr: wanted 0x%02x got 0x%02x\n",
					(pb->ipacket[0] & 0x0f),
					(pb->ipacket[3] & 0x0f));
                                continue;
			}
		}

		/* Old (<3.2) packet format */
		else
		{
			if ((pb->ipacket[0] & 0xc0) != 0xc0)
			{
				printf("psmintr: wanted 0xc0 got 0x%02x\n",
					(pb->ipacket[0] & 0xc0));
                                continue;
			}

			if ((pb->ipacket[1] & 0x60) != 0x00)
			{
				printf("psmintr: wanted 0x00 got 0x%02x\n",
					(pb->ipacket[1] & 0x60));
                                continue;
			}

			if ((pb->ipacket[3] & 0xc0) != 0x80)
			{
				printf("psmintr: wanted 0x80 got 0x%02x\n",
					(pb->ipacket[3] & 0xc0));
                                continue;
			}

			if ((pb->ipacket[4] & 0x60) != 0x00)
			{
				printf("psmintr: wanted 0x00 got 0x%02x\n",
					(pb->ipacket[4] & 0x60));
                                continue;
			}
		}

Or something along those lines.

> +#define SYN_BIT_ABSOLUTE_MODE	0x80
> +#define SYN_BIT_HIGH_RATE	0x40
> +#define SYN_BIT_SLEEP_MODE	0x08
> +#define SYN_BIT_DISABLE_GESTURE 0x04
> +#define SYN_BIT_W_MODE		0x01

You could use those bits for the check.

I'll go test your patch now, and fiddle with it a bit :-)

Thanks :-)

 - Philip

-- 
Philip Paeps                                          Please don't CC me, I am
                                                       subscribed to the list.

  BOFH Excuse #283:
    Lawn mower blade in your fan need sharpening



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040104161942.GE3628>