aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2015-04-03 20:14:40 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2015-04-05 14:48:34 -0400
commit59c30afbd37c26168597e737297a1de68848c332 (patch)
tree870dc184dbf57a673db06cf7f2519ed9783cfec3
parent33096777519a66e632fed7f1e54e6480b4228827 (diff)
Input: alps - report interleaved bare PS/2 packets via dev3
Bare packets should be reported via the same evdev device independent on whether they are detected on the beginning of a packet or in the middle of a packet. This has been tested on a Dell Latitude E6400, where the DualPoint Stick reports bare packets, which get reported via dev3 when the touchpad is idle, and via dev2 when the touchpad and stick are used simultaneously. This commit fixes this inconsistency by always reporting bare packets via dev3. Note that since the come from a DualPoint Stick they really should be reported via dev2, this gets fixed in a later commit. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Pali Rohár <pali.rohar@gmail.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
-rw-r--r--drivers/input/mouse/alps.c32
1 files changed, 18 insertions, 14 deletions
diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c
index 33198b91bebf..e32625ccf8b6 100644
--- a/drivers/input/mouse/alps.c
+++ b/drivers/input/mouse/alps.c
@@ -1154,10 +1154,23 @@ out:
1154 mutex_unlock(&alps_mutex); 1154 mutex_unlock(&alps_mutex);
1155} 1155}
1156 1156
1157static void alps_report_bare_ps2_packet(struct input_dev *dev, 1157static void alps_report_bare_ps2_packet(struct psmouse *psmouse,
1158 unsigned char packet[], 1158 unsigned char packet[],
1159 bool report_buttons) 1159 bool report_buttons)
1160{ 1160{
1161 struct alps_data *priv = psmouse->private;
1162 struct input_dev *dev;
1163
1164 if (unlikely(IS_ERR_OR_NULL(priv->dev3))) {
1165 /* Register dev3 mouse if we received PS/2 packet first time */
1166 if (!IS_ERR(priv->dev3))
1167 psmouse_queue_work(psmouse, &priv->dev3_register_work,
1168 0);
1169 return;
1170 } else {
1171 dev = priv->dev3;
1172 }
1173
1161 if (report_buttons) 1174 if (report_buttons)
1162 alps_report_buttons(dev, NULL, 1175 alps_report_buttons(dev, NULL,
1163 packet[0] & 1, packet[0] & 2, packet[0] & 4); 1176 packet[0] & 1, packet[0] & 2, packet[0] & 4);
@@ -1232,8 +1245,8 @@ static psmouse_ret_t alps_handle_interleaved_ps2(struct psmouse *psmouse)
1232 * de-synchronization. 1245 * de-synchronization.
1233 */ 1246 */
1234 1247
1235 alps_report_bare_ps2_packet(priv->dev2, 1248 alps_report_bare_ps2_packet(psmouse, &psmouse->packet[3],
1236 &psmouse->packet[3], false); 1249 false);
1237 1250
1238 /* 1251 /*
1239 * Continue with the standard ALPS protocol handling, 1252 * Continue with the standard ALPS protocol handling,
@@ -1289,18 +1302,9 @@ static psmouse_ret_t alps_process_byte(struct psmouse *psmouse)
1289 * properly we only do this if the device is fully synchronized. 1302 * properly we only do this if the device is fully synchronized.
1290 */ 1303 */
1291 if (!psmouse->out_of_sync_cnt && (psmouse->packet[0] & 0xc8) == 0x08) { 1304 if (!psmouse->out_of_sync_cnt && (psmouse->packet[0] & 0xc8) == 0x08) {
1292
1293 /* Register dev3 mouse if we received PS/2 packet first time */
1294 if (unlikely(!priv->dev3))
1295 psmouse_queue_work(psmouse,
1296 &priv->dev3_register_work, 0);
1297
1298 if (psmouse->pktcnt == 3) { 1305 if (psmouse->pktcnt == 3) {
1299 /* Once dev3 mouse device is registered report data */ 1306 alps_report_bare_ps2_packet(psmouse, psmouse->packet,
1300 if (likely(!IS_ERR_OR_NULL(priv->dev3))) 1307 true);
1301 alps_report_bare_ps2_packet(priv->dev3,
1302 psmouse->packet,
1303 true);
1304 return PSMOUSE_FULL_PACKET; 1308 return PSMOUSE_FULL_PACKET;
1305 } 1309 }
1306 return PSMOUSE_GOOD_DATA; 1310 return PSMOUSE_GOOD_DATA;