diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2017-02-08 02:07:44 +0100 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2018-02-03 01:48:56 +0100 |
commit | 1ef8580539d0b9282b726a2c9b7aa25057040cfe (patch) | |
tree | a609141dca5c18eb0fc159418abd59db95f3c89a /drivers/input/mouse/logips2pp.c | |
parent | Linux 4.15 (diff) | |
download | linux-1ef8580539d0b9282b726a2c9b7aa25057040cfe.tar.xz linux-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.c | 10 |
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; |