Skip to content

Commit 59c30af

Browse files
jwrdegoededtor
authored andcommitted
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>
1 parent 3309677 commit 59c30af

File tree

1 file changed

+18
-14
lines changed

1 file changed

+18
-14
lines changed

drivers/input/mouse/alps.c

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1154,10 +1154,23 @@ static void alps_register_bare_ps2_mouse(struct work_struct *work)
11541154
mutex_unlock(&alps_mutex);
11551155
}
11561156

1157-
static void alps_report_bare_ps2_packet(struct input_dev *dev,
1157+
static void alps_report_bare_ps2_packet(struct psmouse *psmouse,
11581158
unsigned char packet[],
11591159
bool report_buttons)
11601160
{
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+
11611174
if (report_buttons)
11621175
alps_report_buttons(dev, NULL,
11631176
packet[0] & 1, packet[0] & 2, packet[0] & 4);
@@ -1232,8 +1245,8 @@ static psmouse_ret_t alps_handle_interleaved_ps2(struct psmouse *psmouse)
12321245
* de-synchronization.
12331246
*/
12341247

1235-
alps_report_bare_ps2_packet(priv->dev2,
1236-
&psmouse->packet[3], false);
1248+
alps_report_bare_ps2_packet(psmouse, &psmouse->packet[3],
1249+
false);
12371250

12381251
/*
12391252
* Continue with the standard ALPS protocol handling,
@@ -1289,18 +1302,9 @@ static psmouse_ret_t alps_process_byte(struct psmouse *psmouse)
12891302
* properly we only do this if the device is fully synchronized.
12901303
*/
12911304
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-
12981305
if (psmouse->pktcnt == 3) {
1299-
/* Once dev3 mouse device is registered report data */
1300-
if (likely(!IS_ERR_OR_NULL(priv->dev3)))
1301-
alps_report_bare_ps2_packet(priv->dev3,
1302-
psmouse->packet,
1303-
true);
1306+
alps_report_bare_ps2_packet(psmouse, psmouse->packet,
1307+
true);
13041308
return PSMOUSE_FULL_PACKET;
13051309
}
13061310
return PSMOUSE_GOOD_DATA;

0 commit comments

Comments
 (0)