linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vojtech Pavlik <vojtech@suse.cz>
To: Peter Osterlund <petero2@telia.com>
Cc: Vojtech Pavlik <vojtech@suse.cz>,
	Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Joseph Fannin <jhf@rivenstone.net>,
	Jens Taprogge <jens.taprogge@rwth-aachen.de>
Subject: Re: [PATCH] Synaptics TouchPad driver for 2.5.70
Date: Sun, 15 Jun 2003 19:27:31 +0200	[thread overview]
Message-ID: <20030615192731.A6972@ucw.cz> (raw)
In-Reply-To: <m2of0zqr4i.fsf@telia.com>; from petero2@telia.com on Sun, Jun 15, 2003 at 05:47:57PM +0200

On Sun, Jun 15, 2003 at 05:47:57PM +0200, Peter Osterlund wrote:
> Vojtech Pavlik <vojtech@suse.cz> writes:
> 
> > On Sun, Jun 15, 2003 at 02:18:57PM +0200, Peter Osterlund wrote:
> > > 
> > > -	if (hw.w != priv->old_w) {
> > > -		input_event(dev, EV_MSC, MSC_GESTURE, hw.w);
> > > -		priv->old_w = hw.w;
> > > -	}
> > > +	/*
> > > +	 * This will generate an event even if w is unchanged, but that is
> > > +	 * exactly what we want, because user space drivers may depend on
> > > +	 * this for gesture decoding.
> > > +	 */
> > > +	input_event(dev, EV_MSC, MSC_GESTURE, hw.w);
> > 
> > This assumption is not nice. It should instead rely on input_sync() /
> > EV_SYN, SYN_REPORT events for complete packet decoding. Can you do
> > something about that?
> 
> The X driver already relies on EV_SYN to decide when it should act on
> the data from the kernel. The problem is that the packet stream is
> used as a time base for gesture decoding, because the touchpad was
> designed like that to make driver implementation simpler.

We may switch to using some ABS_ or BNT_TOOL_ values for the gesture
reporting if some other than Synaptics pad is reporting those, so that
we can have one common driver. That other pad may not only not be
sending data in a different format, but most likely will also not be
sending the data one second after last real event.

> From the
> Synaptics manual:
> 
>         (Specifically, the TouchPad begins sending packets when Z is 8
>         or more.) The TouchPad also begins sending packets whenever
>         any button is pressed or released. Once the TouchPad begins
>         transmitting, it continues to send packets for one second
>         after Z falls below 8 and the buttons stop changing. The
>         TouchPad does this partly to allow host software to use the
>         packet stream as a time base for gesture decoding, and also to
>         minimize the impact if the system occasionally drops a packet.
> 
> For example, if I press the left button, the X driver can not
> immediately generate a left button down event, because maybe I will
> press the right button real soon, in which case the middle mouse
> button emulation will be activated and generate a middle button down
> event. This and similar things are easy to implement by just counting
> packets.

Well, I'd suggest using the timestamp on the packets and not just
counting them, but the decision is yours, of course. The timestamp is
very exact.

> I guess it would be possible to rewrite the driver so that it doesn't
> rely on the packet stream for timing, but it would make the driver
> more complicated.

A switch from read() to select() shouldn't be that hard ... but that
really depends on the X driver infrastructure.

> If I could generate only EV_SYN events from the kernel without the
> EV_MSC events, that would of course be OK too, but I don't know if
> that is possible.

That's unfortunately not possible. Second and following SYN_REPORT
events are filtered.

> The event parsing code int the X driver currently looks like this:
> 
> static Bool
> SynapticsParseEventData(LocalDevicePtr local, SynapticsPrivatePtr priv,
> 			struct SynapticsHwState *hw)
> {
>     struct input_event ev;
> 
>     while (SynapticsReadEvent(priv, &ev) == Success) {
> 	switch (ev.type) {
> 	case 0x00:			    /* SYN */
> 	    *hw = priv->hwState;
> 	    return Success;

Please check for SYN_REPORT, since SYN_CONFIG is pretty much different.

> 	case 0x01:			    /* KEY */
> 	    switch (ev.code) {
> 	    case 0x110:			    /* BTN_LEFT */
> 		priv->hwState.left = (ev.value ? TRUE : FALSE);
> 		break;
> 	    case 0x111:			    /* BTN_RIGHT */
> 		priv->hwState.right = (ev.value ? TRUE : FALSE);
> 		break;
> 	    case 0x115:			    /* BTN_FORWARD */
> 		priv->hwState.up = (ev.value ? TRUE : FALSE);
> 		break;
> 	    case 0x116:			    /* BTN_BACK */
> 		priv->hwState.down = (ev.value ? TRUE : FALSE);
> 		break;
> 	    }
> 	    break;
> 	case 0x03:			    /* ABS */
> 	    switch (ev.code) {
> 	    case 0x00:			    /* ABS_X */
> 		priv->hwState.x = ev.value;
> 		break;
> 	    case 0x01:			    /* ABS_Y */
> 		priv->hwState.y = ev.value;
> 		break;
> 	    case 0x18:			    /* ABS_PRESSURE */
> 		priv->hwState.z = ev.value;
> 		break;
> 	    }
> 	    break;
> 	case 0x04:			    /* MSC */
> 	    switch (ev.code) {
> 	    case 0x02:			    /* MSC_GESTURE */
> 		priv->hwState.w = ev.value;
> 		break;
> 	    }
> 	    break;
> 	}
>     }
>     return !Success;
> }
> 
> static Bool
> SynapticsReadEvent(SynapticsPrivatePtr priv, struct input_event *ev)
> {
>     int i, c;
>     unsigned char *pBuf, u;
> 
>     for (i = 0; i < sizeof(struct input_event); i++) {
> 	if ((c = XisbRead(priv->buffer)) < 0)
> 	    return !Success;
> 	u = (unsigned char)c;
> 	pBuf = (unsigned char *)ev;
> 	pBuf[i] = u;
>     }
>     return Success;
> }
> 
> -- 
> Peter Osterlund - petero2@telia.com
> http://w1.894.telia.com/~u89404340

-- 
Vojtech Pavlik
SuSE Labs, SuSE CR

  reply	other threads:[~2003-06-15 17:16 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <m2smqhqk4k.fsf@p4.localdomain>
2003-06-11 15:02 ` [PATCH] Synaptics TouchPad driver for 2.5.70 Vojtech Pavlik
2003-06-11 18:16   ` Peter Osterlund
2003-06-11 18:26     ` Vojtech Pavlik
2003-06-11 18:29     ` AlberT
2003-06-11 18:34     ` Vojtech Pavlik
2003-06-11 21:23       ` Peter Osterlund
2003-06-12  2:48         ` Joseph Fannin
2003-06-12  2:54           ` CaT
2003-06-12 18:58             ` Peter Osterlund
2003-06-12 22:01               ` Peter Berg Larsen
2003-06-12 22:57                 ` Vojtech Pavlik
2003-06-12 23:17                   ` Peter Berg Larsen
2003-06-12 23:27                     ` Vojtech Pavlik
2003-06-12 23:42                       ` Peter Berg Larsen
2003-06-13  7:44                         ` Vojtech Pavlik
2003-06-13  8:58                           ` Peter Berg Larsen
2003-06-13 20:25                           ` James Simmons
2003-06-13 20:38                             ` Vojtech Pavlik
2003-06-13 20:51                               ` James Simmons
2003-06-13 22:08                                 ` Vojtech Pavlik
2003-06-13 23:57                                   ` James Simmons
2003-06-14  8:55                                     ` Vojtech Pavlik
2003-06-16 21:28                                       ` James Simmons
2003-06-12 19:11           ` Peter Osterlund
2003-06-12  6:31         ` Vojtech Pavlik
2003-06-12  8:36         ` James H. Cloos Jr.
2003-06-15 21:42           ` [PATCH] Synaptics Client/Passthrough (for Inspiron...) Arne Koewing
2003-06-13 21:15       ` [PATCH] Synaptics TouchPad driver for 2.5.70 Peter Osterlund
2003-06-13 21:49         ` James Simmons
2003-06-13 22:08         ` Vojtech Pavlik
2003-06-13 22:55           ` Peter Berg Larsen
2003-06-14  8:42             ` Vojtech Pavlik
2003-06-14 22:19 ` Vojtech Pavlik
2003-06-15 12:18   ` Peter Osterlund
2003-06-15 12:28     ` Vojtech Pavlik
2003-06-15 15:47       ` Peter Osterlund
2003-06-15 17:27         ` Vojtech Pavlik [this message]
2003-06-18 23:41           ` Peter Osterlund
2003-06-19  6:03             ` Vojtech Pavlik
2003-06-23 16:30             ` Andreas Jellinghaus
2003-06-23 19:04               ` Peter Osterlund
2003-06-26 20:01                 ` Vojtech Pavlik
2003-07-07 23:06                 ` Peter Osterlund
2003-07-12 10:51                   ` Andreas Jellinghaus
2003-06-10 22:52 Joseph Fannin
2003-06-11 15:30 ` Joseph Fannin
2003-06-11 20:17 ` Andrew Morton
2003-06-11 20:29   ` Vojtech Pavlik
2003-06-11 22:12     ` Peter Osterlund

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=20030615192731.A6972@ucw.cz \
    --to=vojtech@suse.cz \
    --cc=jens.taprogge@rwth-aachen.de \
    --cc=jhf@rivenstone.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=petero2@telia.com \
    /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 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).