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/sentelic.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/sentelic.c')
-rw-r--r-- | drivers/input/mouse/sentelic.c | 11 |
1 files changed, 1 insertions, 10 deletions
diff --git a/drivers/input/mouse/sentelic.c b/drivers/input/mouse/sentelic.c index 11c32ac8234b..1d6010d463e2 100644 --- a/drivers/input/mouse/sentelic.c +++ b/drivers/input/mouse/sentelic.c @@ -710,7 +710,6 @@ static psmouse_ret_t fsp_process_byte(struct psmouse *psmouse) unsigned char *packet = psmouse->packet; unsigned char button_status = 0, lscroll = 0, rscroll = 0; unsigned short abs_x, abs_y, fgrs = 0; - int rel_x, rel_y; if (psmouse->pktcnt < 4) return PSMOUSE_GOOD_DATA; @@ -840,15 +839,7 @@ static psmouse_ret_t fsp_process_byte(struct psmouse *psmouse) /* * Standard PS/2 Mouse */ - 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); - - rel_x = packet[1] ? (int)packet[1] - (int)((packet[0] << 4) & 0x100) : 0; - rel_y = packet[2] ? (int)((packet[0] << 3) & 0x100) - (int)packet[2] : 0; - - input_report_rel(dev, REL_X, rel_x); - input_report_rel(dev, REL_Y, rel_y); + psmouse_report_standard_packet(dev, packet); break; } |