Input: ALPS - report v3 pinnacle trackstick device only if is present
authorPali Rohár <pali.rohar@gmail.com>
Wed, 6 Jan 2016 23:58:56 +0000 (15:58 -0800)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Thu, 7 Jan 2016 00:06:47 +0000 (16:06 -0800)
This patch moves v3 pinnacle code for trackstick detection from
alps_hw_init_v3() to alps_set_protocol() so ALPS_DUALPOINT flag can be
cleared before registering trackstick input device in kernel.

Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
drivers/input/mouse/alps.c

index 1aa170987028092e8c98963a078303b6e9950c74..936f07a4e35f41265de96e84c2bab08f13544ad6 100644 (file)
@@ -2129,15 +2129,12 @@ error:
 
 static int alps_hw_init_v3(struct psmouse *psmouse)
 {
+       struct alps_data *priv = psmouse->private;
        struct ps2dev *ps2dev = &psmouse->ps2dev;
        int reg_val;
        unsigned char param[4];
 
-       reg_val = alps_probe_trackstick_v3_v7(psmouse, ALPS_REG_BASE_PINNACLE);
-       if (reg_val == -EIO)
-               goto error;
-
-       if (reg_val == 0 &&
+       if ((priv->flags & ALPS_DUALPOINT) &&
            alps_setup_trackstick_v3(psmouse, ALPS_REG_BASE_PINNACLE) == -EIO)
                goto error;
 
@@ -2614,6 +2611,11 @@ static int alps_set_protocol(struct psmouse *psmouse,
                priv->decode_fields = alps_decode_pinnacle;
                priv->nibble_commands = alps_v3_nibble_commands;
                priv->addr_command = PSMOUSE_CMD_RESET_WRAP;
+
+               if (alps_probe_trackstick_v3_v7(psmouse,
+                                               ALPS_REG_BASE_PINNACLE) < 0)
+                       priv->flags &= ~ALPS_DUALPOINT;
+
                break;
 
        case ALPS_PROTO_V3_RUSHMORE: