summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ps2comm.c17
-rw-r--r--ps2comm.h4
-rw-r--r--synaptics.c41
-rw-r--r--synaptics.h4
4 files changed, 40 insertions, 26 deletions
diff --git a/ps2comm.c b/ps2comm.c
index 1199280..11b1f32 100644
--- a/ps2comm.c
+++ b/ps2comm.c
@@ -54,6 +54,7 @@
#define SYN_QUE_SERIAL_NUMBER_PREFIX 0x06
#define SYN_QUE_SERIAL_NUMBER_SUFFIX 0x07
#define SYN_QUE_RESOLUTION 0x08
+#define SYN_QUE_EXT_CAPAB 0x09
/* status request response bits (PS2_CMD_STATUS_REQUEST) */
#define PS2_RES_REMOTE(r) (r&(1<<22))
@@ -257,7 +258,7 @@ synaptics_model_id(int fd, unsigned long int *model_id)
* see also the SYN_CAP_* macros
*/
Bool
-synaptics_capability(int fd, unsigned long int *capability)
+synaptics_capability(int fd, unsigned long int *capability, unsigned long int *ext_capab)
{
byte cap[3];
@@ -265,6 +266,7 @@ synaptics_capability(int fd, unsigned long int *capability)
ErrorF("Read capabilites...\n");
#endif
+ *ext_capab = 0;
if((ps2_send_cmd(fd, SYN_QUE_CAPABILITIES) == Success) &&
(ps2_getbyte(fd, &cap[0]) == Success) &&
(ps2_getbyte(fd, &cap[1]) == Success) &&
@@ -274,6 +276,19 @@ synaptics_capability(int fd, unsigned long int *capability)
ErrorF("capability %06X\n", *capability);
#endif
if(SYN_CAP_VALID(*capability)) {
+ if(SYN_EXT_CAP_REQUESTS(*capability)) {
+ if((ps2_send_cmd(fd, SYN_QUE_EXT_CAPAB) == Success) &&
+ (ps2_getbyte(fd, &cap[0]) == Success) &&
+ (ps2_getbyte(fd, &cap[1]) == Success) &&
+ (ps2_getbyte(fd, &cap[2]) == Success)) {
+ *ext_capab = (cap[0]<<16) | (cap[1]<<8) | cap[2];
+#ifdef DEBUG
+ ErrorF("ext-capability %06X\n", *ext_capab);
+#endif
+ } else {
+ ErrorF("synaptics says, that it has extended-capabilities, but I cannot read them.");
+ }
+ }
#ifdef DEBUG
ErrorF("...done.\n");
#endif
diff --git a/ps2comm.h b/ps2comm.h
index affdff1..c40ddfa 100644
--- a/ps2comm.h
+++ b/ps2comm.h
@@ -25,6 +25,8 @@
#define SYN_CAP_MULTIFINGER(c) (c&(1<<1))
#define SYN_CAP_PALMDETECT(c) (c&(1<<0))
#define SYN_CAP_VALID(c) (((c&0x00ff00)>>8)==0x47)
+#define SYN_EXT_CAP_REQUESTS(c) ((c&0x700000) == 0x100000)
+#define SYN_CAP_MULTI_BUTTON_NO(ec) ((ec&0x00f000)>>12)
/* synaptics modes query bits */
#define SYN_MODE_ABSOLUTE(m) (m&(1<<7))
@@ -50,7 +52,7 @@ Bool
synaptics_model_id(int fd, unsigned long int *model_id);
Bool
-synaptics_capability(int fd, unsigned long int *capability);
+synaptics_capability(int fd, unsigned long int *capability, unsigned long int *ext_capab);
Bool
synaptics_identify(int fd, unsigned long int *ident);
diff --git a/synaptics.c b/synaptics.c
index 1842edb..e71fd3d 100644
--- a/synaptics.c
+++ b/synaptics.c
@@ -1158,9 +1158,10 @@ QueryHardware (LocalDevicePtr local)
return !Success;
para->model_id = priv->model_id;
- if(synaptics_capability(local->fd, &priv->capabilities) != Success)
+ if(synaptics_capability(local->fd, &priv->capabilities, &priv->ext_cap) != Success)
return !Success;
para->capabilities = priv->capabilities;
+ para->ext_cap = priv->ext_cap;
if(synaptics_set_mode(local->fd, SYN_BIT_ABSOLUTE_MODE |
SYN_BIT_HIGH_RATE |
@@ -1168,14 +1169,6 @@ 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);
@@ -1308,9 +1301,8 @@ SynapticsParseRawPacket(LocalDevicePtr local, SynapticsPrivatePtr priv,
hw->up = 0;
hw->down = 0;
- if (!priv->six_buttons) {
- if (SYN_CAP_EXTENDED(priv->capabilities) &&
- (SYN_CAP_FOUR_BUTTON(priv->capabilities))) {
+ if (SYN_CAP_EXTENDED(priv->capabilities)) {
+ if (SYN_CAP_FOUR_BUTTON(priv->capabilities)) {
hw->up = ((buf[3] & 0x01)) ? 1 : 0;
if (hw->left)
hw->up = !hw->up;
@@ -1318,15 +1310,18 @@ SynapticsParseRawPacket(LocalDevicePtr local, SynapticsPrivatePtr priv,
if (hw->right)
hw->down = !hw->down;
}
- } else {
- /* type with 6 buttons */
- if (priv->protoBuf[3] == 0xC2) {
- hw->cbLeft = (priv->protoBuf[4] & 0x02) ? TRUE : FALSE;
- hw->cbRight = (priv->protoBuf[5] & 0x02) ? TRUE : FALSE;
- hw->up = (priv->protoBuf[4] & 0x01) ? TRUE : FALSE;
- hw->down = (priv->protoBuf[5] & 0x01) ? TRUE : FALSE;
- } else {
- hw->cbLeft = hw->cbRight = hw->up = hw->down = FALSE;
+ if (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap)) {
+ /* aka. type with 6 buttons */
+ if (priv->protoBuf[3] == 0xC2) {
+ if (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) > 2) {
+ hw->cbLeft = (priv->protoBuf[4] & 0x02) ? TRUE : FALSE;
+ hw->cbRight = (priv->protoBuf[5] & 0x02) ? TRUE : FALSE;
+ }
+ hw->up = (priv->protoBuf[4] & 0x01) ? TRUE : FALSE;
+ hw->down = (priv->protoBuf[5] & 0x01) ? TRUE : FALSE;
+ } else {
+ hw->cbLeft = hw->cbRight = hw->up = hw->down = FALSE;
+ }
}
}
@@ -1447,7 +1442,9 @@ PrintIdent(SynapticsPrivatePtr priv)
if(SYN_CAP_EXTENDED(priv->capabilities)) {
xf86Msg(X_PROBED, " Touchpad has extended capability bits\n");
- if(SYN_CAP_FOUR_BUTTON(priv->capabilities))
+ if(SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap))
+ xf86Msg(X_PROBED, " -> %d mulit-buttons, i.e. besides standard buttons\n" ,(int)(SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap)));
+ else if(SYN_CAP_FOUR_BUTTON(priv->capabilities))
xf86Msg(X_PROBED, " -> four buttons\n");
if(SYN_CAP_MULTIFINGER(priv->capabilities))
xf86Msg(X_PROBED, " -> multifinger detection\n");
diff --git a/synaptics.h b/synaptics.h
index e5ff918..bd0c62f 100644
--- a/synaptics.h
+++ b/synaptics.h
@@ -19,6 +19,7 @@ typedef struct _SynapticsSHM
/* Probed hardware properties */
unsigned long int model_id; /* Model-ID */
unsigned long int capabilities; /* Capabilities */
+ unsigned long int ext_cap; /* Extended Capabilities */
unsigned long int identity; /* Identification */
Bool isSynaptics; /* Synaptics touchpad active */
@@ -99,10 +100,9 @@ typedef struct _SynapticsPrivateRec
/* Data read from the touchpad */
unsigned long int model_id; /* Model-ID */
unsigned long int capabilities; /* Capabilities */
+ unsigned long int ext_cap; /* Extended Capabilities */
unsigned long int identity; /* Identification */
Bool isSynaptics; /* Synaptics touchpad active */
- Bool six_buttons; /* Use six button protocol */
- /* only of interest if in raw mode */
Bool shm_config; /* True when shared memory area allocated */
OsTimerPtr timer; /* for up/down-button repeat, tap processing, etc */