Skip to content

Commit

Permalink
Input: alps - report interleaved bare PS/2 packets via dev3
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
jwrdegoede authored and dtor committed Apr 5, 2015
1 parent 3309677 commit 59c30af
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions drivers/input/mouse/alps.c
Original file line number Diff line number Diff line change
Expand Up @@ -1154,10 +1154,23 @@ static void alps_register_bare_ps2_mouse(struct work_struct *work)
mutex_unlock(&alps_mutex);
}

static void alps_report_bare_ps2_packet(struct input_dev *dev,
static void alps_report_bare_ps2_packet(struct psmouse *psmouse,
unsigned char packet[],
bool report_buttons)
{
struct alps_data *priv = psmouse->private;
struct input_dev *dev;

if (unlikely(IS_ERR_OR_NULL(priv->dev3))) {
/* Register dev3 mouse if we received PS/2 packet first time */
if (!IS_ERR(priv->dev3))
psmouse_queue_work(psmouse, &priv->dev3_register_work,
0);
return;
} else {
dev = priv->dev3;
}

if (report_buttons)
alps_report_buttons(dev, NULL,
packet[0] & 1, packet[0] & 2, packet[0] & 4);
Expand Down Expand Up @@ -1232,8 +1245,8 @@ static psmouse_ret_t alps_handle_interleaved_ps2(struct psmouse *psmouse)
* de-synchronization.
*/

alps_report_bare_ps2_packet(priv->dev2,
&psmouse->packet[3], false);
alps_report_bare_ps2_packet(psmouse, &psmouse->packet[3],
false);

/*
* Continue with the standard ALPS protocol handling,
Expand Down Expand Up @@ -1289,18 +1302,9 @@ static psmouse_ret_t alps_process_byte(struct psmouse *psmouse)
* properly we only do this if the device is fully synchronized.
*/
if (!psmouse->out_of_sync_cnt && (psmouse->packet[0] & 0xc8) == 0x08) {

/* Register dev3 mouse if we received PS/2 packet first time */
if (unlikely(!priv->dev3))
psmouse_queue_work(psmouse,
&priv->dev3_register_work, 0);

if (psmouse->pktcnt == 3) {
/* Once dev3 mouse device is registered report data */
if (likely(!IS_ERR_OR_NULL(priv->dev3)))
alps_report_bare_ps2_packet(priv->dev3,
psmouse->packet,
true);
alps_report_bare_ps2_packet(psmouse, psmouse->packet,
true);
return PSMOUSE_FULL_PACKET;
}
return PSMOUSE_GOOD_DATA;
Expand Down

0 comments on commit 59c30af

Please sign in to comment.