aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/mouse/logips2pp.c
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2017-02-07 17:07:44 -0800
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2018-02-02 16:48:56 -0800
commit1ef8580539d0b9282b726a2c9b7aa25057040cfe (patch)
treea609141dca5c18eb0fc159418abd59db95f3c89a /drivers/input/mouse/logips2pp.c
parentLinux 4.15 (diff)
downloadlinux-dev-1ef8580539d0b9282b726a2c9b7aa25057040cfe.tar.xz
linux-dev-1ef8580539d0b9282b726a2c9b7aa25057040cfe.zip
Input: psmouse - create helper for reporting standard buttons/motion
Many protocol driver re-implement code to parse buttons or motion data from the standard PS/2 protocol. Let's split the parsing into separate functions and reuse them in protocol drivers. Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input/mouse/logips2pp.c')
-rw-r--r--drivers/input/mouse/logips2pp.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/drivers/input/mouse/logips2pp.c b/drivers/input/mouse/logips2pp.c
index ef9c97f5e3d7..b7d17db632fc 100644
--- a/drivers/input/mouse/logips2pp.c
+++ b/drivers/input/mouse/logips2pp.c
@@ -88,16 +88,14 @@ static psmouse_ret_t ps2pp_process_byte(struct psmouse *psmouse)
(packet[1] >> 4) | (packet[0] & 0x30));
break;
}
+
+ psmouse_report_standard_buttons(dev, packet[0]);
+
} else {
/* Standard PS/2 motion data */
- input_report_rel(dev, REL_X, packet[1] ? (int) packet[1] - (int) ((packet[0] << 4) & 0x100) : 0);
- input_report_rel(dev, REL_Y, packet[2] ? (int) ((packet[0] << 3) & 0x100) - (int) packet[2] : 0);
+ psmouse_report_standard_packet(dev, packet);
}
- input_report_key(dev, BTN_LEFT, packet[0] & 1);
- input_report_key(dev, BTN_MIDDLE, (packet[0] >> 2) & 1);
- input_report_key(dev, BTN_RIGHT, (packet[0] >> 1) & 1);
-
input_sync(dev);
return PSMOUSE_FULL_PACKET;