[PATCH:synaptics] Purge GuestMouse support.

Peter Hutterer peter.hutterer at who-t.net
Wed Dec 9 15:17:39 PST 2009


Guest mouse dates back to quite a while ago, hasn't been tested for ages and
the current synaptics interface guide claims the bit that we used to check
if guestmouse is available is "reserved for future use. The host should
ignore the values of reserved bits when reading the capability bits."

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 include/synaptics.h |    2 -
 man/synaptics.man   |   10 +----
 man/synclient.man   |   16 -------
 src/alpscomm.c      |   22 ----------
 src/eventcomm.c     |   17 --------
 src/properties.c    |    8 ----
 src/ps2comm.c       |  115 ---------------------------------------------------
 src/psmcomm.c       |    7 ---
 src/synaptics.c     |   19 --------
 src/synapticsstr.h  |    1 -
 src/synproto.h      |    6 ---
 tools/synclient.c   |   15 +-----
 12 files changed, 5 insertions(+), 233 deletions(-)

diff --git a/include/synaptics.h b/include/synaptics.h
index 4d5a3f3..239cf05 100644
--- a/include/synaptics.h
+++ b/include/synaptics.h
@@ -61,8 +61,6 @@ typedef struct _SynapticsSHM
     int left, right, up, down;		    /* left/right/up/down buttons */
     Bool multi[8];
     Bool middle;
-    int guest_left, guest_mid, guest_right; /* guest device buttons */
-    int guest_dx, guest_dy; 		    /* guest device movement */
 } SynapticsSHM;
 
 /*
diff --git a/man/synaptics.man b/man/synaptics.man
index 59fbaac..af4c7a5 100644
--- a/man/synaptics.man
+++ b/man/synaptics.man
@@ -273,10 +273,6 @@ l l.
 .TE
 Property: "Synaptics Off"
 .TP
-.BI "Option \*qGuestMouseOff\*q \*q" boolean \*q
-Switch on/off guest mouse (often a stick). Property: "Synaptics Guestmouse
-Off"
-.TP
 .BI "Option \*qLockedDrags\*q \*q" boolean \*q
 If off, a tap-and-drag gesture ends when you release the finger.
 .
@@ -782,10 +778,6 @@ FLOAT, 4 values, min, max, accel, trackstick.
 8 bit, valid values (0, 1, 2).
 
 .TP 7
-.BI "Synaptics Guestmouse Off"
-8 bit (BOOL).
-
-.TP 7
 .BI "Synaptics Locked Drags"
 8 bit (BOOL).
 
@@ -908,6 +900,8 @@ The following options are no longer part of the driver configuration:
 .BI "Option \*qHistorySize\*q \*q" integer \*q
 .TP
 .BI "Option \*qSpecialScrollAreaRight\*q \*q" boolean \*q
+.TP
+.BI "Option \*qGuestMouseOff\*q \*q" boolean \*q
 
 .SH "AUTHORS"
 .LP
diff --git a/man/synclient.man b/man/synclient.man
index 8169771..5938a32 100644
--- a/man/synclient.man
+++ b/man/synclient.man
@@ -77,22 +77,6 @@ Zero means not pressed, one means pressed.
 Not all touchpads have all these buttons.
 .
 If a button doesn't exist, the value is always reported as 0.
-.TP
-\fBgl,gm,gr\fR
-Some touchpads have a "guest device".
-.
-This is typically a pointing stick located in the middle of the
-keyboard.
-.
-Some guest devices have physical buttons, or can detect button presses
-when tapping on the pointing stick.
-.
-Such button events are reported as "guest left", "guest middle" or
-"guest right".
-.TP
-\fBgdx,gdy\fR
-Pointer movements from the guest device are reported as relative x/y
-positions, called gdx and gdy.
 .RE
 .TP
 \fB\-l\fR
diff --git a/src/alpscomm.c b/src/alpscomm.c
index e1a059c..055607a 100644
--- a/src/alpscomm.c
+++ b/src/alpscomm.c
@@ -155,33 +155,11 @@ ALPS_process_packet(unsigned char *packet, struct SynapticsHwState *hw)
     int left = 0, right = 0, middle = 0;
     int i;
 
-    /* Handle guest packets */
-    hw->guest_dx = hw->guest_dy = 0;
-    if ((packet[0] & 0xc8) == 0x08) {	    /* 3-byte PS/2 packet */
-	x = packet[1];
-	if (packet[0] & 0x10)
-	    x = x - 256;
-	y = packet[2];
-	if (packet[0] & 0x20)
-	    y = y - 256;
-	hw->guest_dx = x;
-	hw->guest_dy = -y;
-	hw->guest_left  = (packet[0] & 0x01) ? TRUE : FALSE;
-	hw->guest_right = (packet[0] & 0x02) ? TRUE : FALSE;
-	return;
-    }
-
     x = (packet[1] & 0x7f) | ((packet[2] & 0x78) << (7-3));
     y = (packet[4] & 0x7f) | ((packet[3] & 0x70) << (7-4));
     z = packet[5];
 
     if (z == 127) {    /* DualPoint stick is relative, not absolute */
-	if (x > 383)
-	    x = x - 768;
-	if (y > 255)
-	    y = y - 512;
-	hw->guest_dx = x;
-	hw->guest_dy = -y;
 	hw->left  = packet[3] & 1;
 	hw->right = (packet[3] >> 1) & 1;
 	return;
diff --git a/src/eventcomm.c b/src/eventcomm.c
index d00d810..a398e7e 100644
--- a/src/eventcomm.c
+++ b/src/eventcomm.c
@@ -314,7 +314,6 @@ EventReadHwState(LocalDevicePtr local,
 		else
 		    hw->numFingers = 0;
 		*hwRet = *hw;
-		hw->guest_dx = hw->guest_dy = 0;
 		return TRUE;
 	    }
 	case EV_KEY:
@@ -368,12 +367,6 @@ EventReadHwState(LocalDevicePtr local,
 	    case BTN_TOOL_TRIPLETAP:
 		comm->threeFingers = v;
 		break;
-	    case BTN_A:
-		hw->guest_left = v;
-		break;
-	    case BTN_B:
-		hw->guest_right = v;
-		break;
 	    case BTN_TOUCH:
 		if (!priv->has_pressure)
 			hw->z = v ? para->finger_high + 1 : 0;
@@ -396,16 +389,6 @@ EventReadHwState(LocalDevicePtr local,
 		break;
 	    }
 	    break;
-	case EV_REL:
-	    switch (ev.code) {
-	    case REL_X:
-		hw->guest_dx = ev.value;
-		break;
-	    case REL_Y:
-		hw->guest_dy = ev.value;
-		break;
-	    }
-	    break;
 	}
     }
     return FALSE;
diff --git a/src/properties.c b/src/properties.c
index 4366034..c5e9d90 100644
--- a/src/properties.c
+++ b/src/properties.c
@@ -65,7 +65,6 @@ Atom prop_buttonscroll          = 0;
 Atom prop_buttonscroll_repeat   = 0;
 Atom prop_buttonscroll_time     = 0;
 Atom prop_off                   = 0;
-Atom prop_guestmouse            = 0;
 Atom prop_lockdrags             = 0;
 Atom prop_lockdrags_time        = 0;
 Atom prop_tapaction             = 0;
@@ -217,7 +216,6 @@ InitDeviceProperties(LocalDevicePtr local)
     prop_buttonscroll_repeat = InitAtom(local->dev, SYNAPTICS_PROP_BUTTONSCROLLING_REPEAT, 8, 2, values);
     prop_buttonscroll_time = InitAtom(local->dev, SYNAPTICS_PROP_BUTTONSCROLLING_TIME, 32, 1, &para->scroll_button_repeat);
     prop_off = InitAtom(local->dev, SYNAPTICS_PROP_OFF, 8, 1, &para->touchpad_off);
-    prop_guestmouse = InitAtom(local->dev, SYNAPTICS_PROP_GUESTMOUSE, 8, 1, &para->guestmouse_off);
     prop_lockdrags = InitAtom(local->dev, SYNAPTICS_PROP_LOCKED_DRAGS, 8, 1, &para->locked_drags);
     prop_lockdrags_time = InitAtom(local->dev, SYNAPTICS_PROP_LOCKED_DRAGS_TIMEOUT, 32, 1, &para->locked_drag_time);
 
@@ -490,12 +488,6 @@ SetProperty(DeviceIntPtr dev, Atom property, XIPropertyValuePtr prop,
             return BadValue;
 
         para->touchpad_off = off;
-    } else if (property == prop_guestmouse)
-    {
-        if (prop->size != 1 || prop->format != 8 || prop->type != XA_INTEGER)
-            return BadMatch;
-
-        para->guestmouse_off = *(BOOL*)prop->data;
     } else if (property == prop_gestures)
     {
         BOOL *gestures;
diff --git a/src/ps2comm.c b/src/ps2comm.c
index ae2592f..f53fd5d 100644
--- a/src/ps2comm.c
+++ b/src/ps2comm.c
@@ -76,7 +76,6 @@ struct SynapticsHwInfo {
     unsigned int capabilities;		    /* Capabilities */
     unsigned int ext_cap;		    /* Extended Capabilities */
     unsigned int identity;		    /* Identification */
-    Bool hasGuest;			    /* Has a guest mouse */
 };
 
 /*****************************************************************************
@@ -163,61 +162,6 @@ ps2_send_cmd(int fd, byte c)
 }
 
 /*****************************************************************************
- *	Synaptics passthrough functions
- ****************************************************************************/
-
-static Bool
-ps2_getbyte_passthrough(int fd, byte *response)
-{
-    byte ack;
-    int timeout_count;
-#define MAX_RETRY_COUNT 30
-
-    /* Getting a response back through the passthrough could take some time.
-     * Spin a little for the first byte */
-    for (timeout_count = 0;
-	 !ps2_getbyte(fd, &ack) && (timeout_count <= MAX_RETRY_COUNT);
-	 timeout_count++)
-	;
-    /* Do some sanity checking */
-    if ((ack & 0xfc) != 0x84) {
-	PS2DBG(ErrorF("ps2_getbyte_passthrough: expected 0x84 and got: %02x\n",
-		      ack & 0xfc));
-	return FALSE;
-    }
-
-    ps2_getbyte(fd, response);
-    ps2_getbyte(fd, &ack);
-    ps2_getbyte(fd, &ack);
-    if ((ack & 0xcc) != 0xc4) {
-	PS2DBG(ErrorF("ps2_getbyte_passthrough: expected 0xc4 and got: %02x\n",
-		      ack & 0xcc));
-	return FALSE;
-    }
-    ps2_getbyte(fd, &ack);
-    ps2_getbyte(fd, &ack);
-
-    return TRUE;
-}
-
-static Bool
-ps2_putbyte_passthrough(int fd, byte c)
-{
-    byte ack;
-
-    ps2_special_cmd(fd, c);
-    ps2_putbyte(fd, 0xF3);
-    ps2_putbyte(fd, 0x28);
-
-    ps2_getbyte_passthrough(fd, &ack);
-    if (ack != PS2_ACK) {
-	PS2DBG(ErrorF("ps2_putbyte_passthrough: wrong acknowledge 0x%02x\n", ack));
-	return FALSE;
-    }
-    return TRUE;
-}
-
-/*****************************************************************************
  *	Synaptics communications functions
  ****************************************************************************/
 
@@ -261,30 +205,6 @@ ps2_synaptics_reset(int fd)
     return FALSE;
 }
 
-static Bool
-ps2_synaptics_reset_passthrough(int fd)
-{
-    byte ack;
-
-    /* send reset */
-    ps2_putbyte_passthrough(fd, 0xff);
-    ps2_getbyte_passthrough(fd, &ack);
-    if (ack != 0xaa) {
-	PS2DBG(ErrorF("ps2_synaptics_reset_passthrough: ack was %02x not 0xaa\n", ack));
-	return FALSE;
-    }
-    ps2_getbyte_passthrough(fd, &ack);
-    if (ack != 0x00) {
-	PS2DBG(ErrorF("ps2_synaptics_reset_passthrough: ack was %02x not 0x00\n", ack));
-	return FALSE;
-    }
-
-    /* set defaults, turn on streaming, and enable the mouse */
-    return (ps2_putbyte_passthrough(fd, 0xf6) &&
-	    ps2_putbyte_passthrough(fd, 0xea) &&
-	    ps2_putbyte_passthrough(fd, 0xf4));
-}
-
 /*
  * Read the model-id bytes from the touchpad
  * see also SYN_MODEL_* macros
@@ -489,22 +409,6 @@ PS2QueryHardware(LocalDevicePtr local)
     if (!ps2_synaptics_set_mode(local->fd, mode))
 	return FALSE;
 
-    /* Check to see if the host mouse supports a guest */
-    synhw->hasGuest = FALSE;
-    if (SYN_CAP_PASSTHROUGH(synhw)) {
-        synhw->hasGuest = TRUE;
-
-	/* Enable the guest mouse.  Set it to relative mode, three byte
-	 * packets */
-
-	/* Disable the host to talk to the guest */
-	ps2_synaptics_disable_device(local->fd);
-	/* Reset it, set defaults, streaming and enable it */
-	if (!ps2_synaptics_reset_passthrough(local->fd)) {
-	    synhw->hasGuest = FALSE;
-	}
-    }
-
     ps2_synaptics_enable_device(local->fd);
 
     ps2_print_ident(synhw);
@@ -632,25 +536,6 @@ PS2ReadHwState(LocalDevicePtr local,
     if (!ps2_synaptics_get_packet(local, synhw, proto_ops, comm))
 	return FALSE;
 
-    /* Handle guest packets */
-    hw->guest_dx = hw->guest_dy = 0;
-    if (newabs && synhw->hasGuest) {
-	w = (((buf[0] & 0x30) >> 2) |
-	     ((buf[0] & 0x04) >> 1) |
-	     ((buf[3] & 0x04) >> 2));
-	if (w == 3) {	       /* If w is 3, this is a guest packet */
-	    if (buf[4] != 0)
-		hw->guest_dx =   buf[4] - ((buf[1] & 0x10) ? 256 : 0);
-	    if (buf[5] != 0)
-		hw->guest_dy = -(buf[5] - ((buf[1] & 0x20) ? 256 : 0));
-	    hw->guest_left  = (buf[1] & 0x01) ? TRUE : FALSE;
-	    hw->guest_mid   = (buf[1] & 0x04) ? TRUE : FALSE;
-	    hw->guest_right = (buf[1] & 0x02) ? TRUE : FALSE;
-	    *hwRet = *hw;
-	    return TRUE;
-	}
-    }
-
     /* Handle normal packets */
     hw->x = hw->y = hw->z = hw->numFingers = hw->fingerWidth = 0;
     hw->left = hw->right = hw->up = hw->down = hw->middle = FALSE;
diff --git a/src/psmcomm.c b/src/psmcomm.c
index f5c2b0c..9258421 100644
--- a/src/psmcomm.c
+++ b/src/psmcomm.c
@@ -55,7 +55,6 @@ struct SynapticsHwInfo {
     unsigned int capabilities;		    /* Capabilities */
     unsigned int ext_cap;		    /* Extended Capabilities */
     unsigned int identity;		    /* Identification */
-    Bool hasGuest;			    /* Has a guest mouse */
 };
 
 /*
@@ -156,12 +155,6 @@ PSMQueryHardware(LocalDevicePtr local)
 
     convert_hw_info(&psm_ident, synhw);
 
-    /* Check to see if the host mouse supports a guest */
-    synhw->hasGuest = FALSE;
-    if (psm_ident.capPassthrough) {
-        synhw->hasGuest = TRUE;
-    }
-
     ps2_print_ident(synhw);
 
     return TRUE;
diff --git a/src/synaptics.c b/src/synaptics.c
index d9b8f50..5a4adf0 100644
--- a/src/synaptics.c
+++ b/src/synaptics.c
@@ -497,7 +497,6 @@ static void set_default_parameters(LocalDevicePtr local)
     pars->leftright_button_repeat = xf86SetBoolOption(opts, "LeftRightScrollRepeat", TRUE);
     pars->scroll_button_repeat = xf86SetIntOption(opts,"ScrollButtonRepeat", 100);
     pars->touchpad_off = xf86SetIntOption(opts, "TouchpadOff", 0);
-    pars->guestmouse_off = xf86SetBoolOption(opts, "GuestMouseOff", FALSE);
     pars->locked_drags = xf86SetBoolOption(opts, "LockedDrags", FALSE);
     pars->locked_drag_time = xf86SetIntOption(opts, "LockedDragTimeout", 5000);
     pars->tap_action[RT_TAP] = xf86SetIntOption(opts, "RTCornerButton", 0);
@@ -1075,7 +1074,6 @@ timerFunc(OsTimerPtr timer, CARD32 now, pointer arg)
     sigstate = xf86BlockSIGIO();
 
     hw = priv->hwState;
-    hw.guest_dx = hw.guest_dy = 0;
     hw.millis = now;
     delay = HandleState(local, &hw);
 
@@ -1705,12 +1703,6 @@ ComputeDeltas(SynapticsPrivate *priv, struct SynapticsHwState *hw,
 	priv->count_packet_finger = 0;
     }
 
-    /* Add guest device movements */
-    if (!para->guestmouse_off) {
-	dx += hw->guest_dx;
-	dy += hw->guest_dy;
-    }
-
     *dxP = dx;
     *dyP = dy;
 
@@ -2090,11 +2082,6 @@ HandleState(LocalDevicePtr local, struct SynapticsHwState *hw)
         for (i = 0; i < 8; i++)
             shm->multi[i] = hw->multi[i];
         shm->middle = hw->middle;
-        shm->guest_left = hw->guest_left;
-        shm->guest_mid = hw->guest_mid;
-        shm->guest_right = hw->guest_right;
-        shm->guest_dx = hw->guest_dx;
-        shm->guest_dy = hw->guest_dy;
     }
 
     /* If touchpad is switched off, we skip the whole thing and return delay */
@@ -2105,12 +2092,6 @@ HandleState(LocalDevicePtr local, struct SynapticsHwState *hw)
     hw->up |= hw->multi[0];
     hw->down |= hw->multi[1];
 
-    if (!para->guestmouse_off) {
-	hw->left |= hw->guest_left;
-	hw->middle |= hw->guest_mid;
-	hw->right |= hw->guest_right;
-    }
-
     /* 3rd button emulation */
     hw->middle |= HandleMidButtonEmulation(priv, hw, &delay);
 
diff --git a/src/synapticsstr.h b/src/synapticsstr.h
index bd19c79..28f0220 100644
--- a/src/synapticsstr.h
+++ b/src/synapticsstr.h
@@ -138,7 +138,6 @@ typedef struct _SynapticsParameters
 					     * 1 : Off
 					     * 2 : Only tapping and scrolling off
 					     */
-    Bool guestmouse_off;		    /* Switches the guest mouse off */
     Bool locked_drags;			    /* Enable locked drags */
     int locked_drag_time;		    /* timeout for locked drags */
     int tap_action[MAX_TAP];		    /* Button to report on tap events */
diff --git a/src/synproto.h b/src/synproto.h
index f7be819..c851271 100644
--- a/src/synproto.h
+++ b/src/synproto.h
@@ -50,12 +50,6 @@ struct SynapticsHwState {
 
     Bool multi[8];
     Bool middle;		/* Some ALPS touchpads have a middle button */
-
-    Bool guest_left;		/* guest device */
-    Bool guest_mid;
-    Bool guest_right;
-    int  guest_dx;
-    int  guest_dy;
 };
 
 struct CommData {
diff --git a/tools/synclient.c b/tools/synclient.c
index 316ae2c..dee7ee2 100644
--- a/tools/synclient.c
+++ b/tools/synclient.c
@@ -112,7 +112,6 @@ static struct Parameter params[] = {
     {"LeftRightScrollRepeat", PT_BOOL,   0, 1,     SYNAPTICS_PROP_BUTTONSCROLLING_REPEAT,   8,	1},
     {"ScrollButtonRepeat",    PT_INT,    SBR_MIN , SBR_MAX, SYNAPTICS_PROP_BUTTONSCROLLING_TIME, 32,	0},
     {"TouchpadOff",           PT_INT,    0, 2,     SYNAPTICS_PROP_OFF,		8,	0},
-    {"GuestMouseOff",         PT_BOOL,   0, 1,     SYNAPTICS_PROP_GUESTMOUSE,	8,	0},
     {"LockedDrags",           PT_BOOL,   0, 1,     SYNAPTICS_PROP_LOCKED_DRAGS,	8,	0},
     {"LockedDragTimeout",     PT_INT,    0, 30000, SYNAPTICS_PROP_LOCKED_DRAGS_TIMEOUT,	32,	0},
     {"RTCornerButton",        PT_INT,    0, SYN_MAX_BUTTONS, SYNAPTICS_PROP_TAP_ACTION,	8,	0},
@@ -196,12 +195,7 @@ is_equal(SynapticsSHM *s1, SynapticsSHM *s2)
 	(s1->right       != s2->right) ||
 	(s1->up          != s2->up) ||
 	(s1->down        != s2->down) ||
-	(s1->middle      != s2->middle) ||
-	(s1->guest_left  != s2->guest_left) ||
-	(s1->guest_mid   != s2->guest_mid) ||
-	(s1->guest_right != s2->guest_right) ||
-	(s1->guest_dx    != s2->guest_dx) ||
-	(s1->guest_dy    != s2->guest_dy))
+	(s1->middle      != s2->middle))
 	return 0;
 
     for (i = 0; i < 8; i++)
@@ -240,15 +234,12 @@ shm_monitor(SynapticsSHM *synshm, int delay)
 		header = 20;
 	    }
 	    header--;
-	    printf("%8.3f  %4d %4d %3d %d %2d %2d %d %d %d %d  %d%d%d%d%d%d%d%d  "
-		   "%2d %2d %2d %3d %3d\n",
+	    printf("%8.3f  %4d %4d %3d %d %2d %2d %d %d %d %d  %d%d%d%d%d%d%d%d\n",
 		   get_time() - t0,
 		   cur.x, cur.y, cur.z, cur.numFingers, cur.fingerWidth,
 		   cur.left, cur.right, cur.up, cur.down, cur.middle,
 		   cur.multi[0], cur.multi[1], cur.multi[2], cur.multi[3],
-		   cur.multi[4], cur.multi[5], cur.multi[6], cur.multi[7],
-		   cur.guest_left, cur.guest_mid, cur.guest_right,
-		   cur.guest_dx, cur.guest_dy);
+		   cur.multi[4], cur.multi[5], cur.multi[6], cur.multi[7]);
 	    fflush(stdout);
 	    old = cur;
 	}
-- 
1.6.5.2


More information about the xorg-devel mailing list