From 3db42d5b33662dbda6f0dde6cdb34748a254884f Mon Sep 17 00:00:00 2001 From: Peter Osterlund Date: Fri, 2 May 2003 12:20:47 +0200 Subject: Merged 6 button support from 0.11.3, but only activate it for firmware version 5.8 and later. (Everything from 0.11.3 is now merged.) --- NEWS | 4 ++++ synaptics.c | 50 +++++++++++++++++++++++++++++++++++++++----------- synaptics.h | 5 +++-- 3 files changed, 46 insertions(+), 13 deletions(-) diff --git a/NEWS b/NEWS index d2e677e..e913f32 100644 --- a/NEWS +++ b/NEWS @@ -1,2 +1,6 @@ +09.06.02 - Version 0.11.1 +- new packet format for Firmware 5.8 and others; solves problems with some + models with 6 buttons (S. Lehner ) + 13.10.01 - Version 0.10 - multifinger taps diff --git a/synaptics.c b/synaptics.c index ea5b253..0550bd9 100644 --- a/synaptics.c +++ b/synaptics.c @@ -3,6 +3,9 @@ * patches for fast scrolling, plam detection, dege motion, * hozizontal scrolling * + * 2002 S. Lehner + * for newer Firmware (5.8) protocol changes for 3rd to 6th button + * * Copyright (C) 2001 Stefan Gmeiner * start merging tpconfig and gpm code to a xfree-input modul * adding some changes and extensions (ex. 3rd and 4th button) @@ -510,7 +513,7 @@ ReadInput(LocalDevicePtr local) Bool finger; int x, y, z, w, dist, dx, dy, buttons, id; edge_type edge; - Bool left, mid, right, up, down; + Bool left, mid, right, up, down, cbLeft, cbRight; double speed, integral; int change; int scroll_up, scroll_down, scroll_left, scroll_right; @@ -545,14 +548,31 @@ ReadInput(LocalDevicePtr local) right = (priv->protoBuf[0] & 0x2) ? TRUE : FALSE; up = FALSE; down = FALSE; - if(SYN_CAP_EXTENDED(priv->capabilities) && - (SYN_CAP_FOUR_BUTTON(priv->capabilities))) { - up = ((priv->protoBuf[3] & 0x01)) ? TRUE : FALSE; - if (left) - up = !up; - down = ((priv->protoBuf[3] & 0x02)) ? TRUE : FALSE; - if (right) - down = !down; + if (!priv->six_buttons) + { + if(SYN_CAP_EXTENDED(priv->capabilities) && + (SYN_CAP_FOUR_BUTTON(priv->capabilities))) { + up = ((priv->protoBuf[3] & 0x01)) ? TRUE : FALSE; + if (left) + up = !up; + down = ((priv->protoBuf[3] & 0x02)) ? TRUE : FALSE; + if (right) + down = !down; + } + } + else + { /* type with 6 buttons */ + if (priv->protoBuf[3] == 0xC2) + { + cbLeft = (priv->protoBuf[4] & 0x02) ? TRUE : FALSE; + cbRight = (priv->protoBuf[5] & 0x02) ? TRUE : FALSE; + up = (priv->protoBuf[4] & 0x01) ? TRUE : FALSE; + down = (priv->protoBuf[5] & 0x01) ? TRUE : FALSE; + } + else + { + cbLeft = cbRight = up = down = FALSE; + } } edge = edge_detection(priv, x, y); @@ -1086,6 +1106,14 @@ QueryHardware (LocalDevicePtr local) SYN_BIT_W_MODE) != Success) return !Success; + priv->six_buttons = FALSE; + if ((SYN_ID_MAJOR(priv->identity) > 5) || + ((SYN_ID_MAJOR(priv->identity) == 5) && (SYN_ID_MINOR(priv->identity) >= 8))) + { + xf86Msg(X_PROBED, "Using 6 button protocol\n"); + priv->six_buttons = TRUE; + } + SynapticsEnableDevice(local->fd); PrintIdent(priv); @@ -1167,8 +1195,8 @@ SynapticsGetPacket(LocalDevicePtr local, SynapticsPrivatePtr priv) } static void -PrintIdent(SynapticsPrivatePtr priv) { - +PrintIdent(SynapticsPrivatePtr priv) +{ xf86Msg(X_PROBED, " Synaptics Touchpad, model: %d\n", SYN_ID_MODEL(priv->identity)); xf86Msg(X_PROBED, " Firware: %d.%d\n", SYN_ID_MAJOR(priv->identity), SYN_ID_MINOR(priv->identity)); diff --git a/synaptics.h b/synaptics.h index e9f9c53..facf242 100644 --- a/synaptics.h +++ b/synaptics.h @@ -18,7 +18,7 @@ typedef struct _SynapticsSHM unsigned long int model_id; /* Model-ID */ unsigned long int capabilities; /* Capabilities */ unsigned long int identity; /* Identification */ - Bool isSynaptics; /* Synaptics touchpad aktiv */ + Bool isSynaptics; /* Synaptics touchpad active */ /* Parameter data */ int left_edge, right_edge, top_edge, bottom_edge; @@ -70,7 +70,8 @@ typedef struct _SynapticsPrivateRec unsigned long int model_id; /* Model-ID */ unsigned long int capabilities; /* Capabilities */ unsigned long int identity; /* Identification */ - Bool isSynaptics; /* Synaptics touchpad aktiv */ + Bool isSynaptics; /* Synaptics touchpad active */ + Bool six_buttons; /* */ /* Data for normal processing */ XISBuffer *buffer; -- cgit v1.2.3