diff options
author | Hans de Goede <hdegoede@redhat.com> | 2015-05-20 23:38:33 +0200 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2015-05-20 23:45:42 +0200 |
commit | aab9cf7b0349b2f6f3d8a32d3f2414981777ebdc (patch) | |
tree | dc1cb96d72ddfccfd6bd0c87509bca18998d2efc /drivers/input/mouse/alps.c | |
parent | Input: ff-core - fix typo in comment to input_ff_erase() (diff) | |
download | linux-aab9cf7b0349b2f6f3d8a32d3f2414981777ebdc.tar.xz linux-aab9cf7b0349b2f6f3d8a32d3f2414981777ebdc.zip |
Input: alps - change alps_decode_rushmore to do all decoding itself
Change alps_decode_rushmore to do all decoding itself, rather then relying
on alps_decode_pinnacle and then overriding some fields + or-ing in some
bits.
This is a preparation patch for modifying the decode functions to properly
differentiate between position and bitmap packets.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input/mouse/alps.c')
-rw-r--r-- | drivers/input/mouse/alps.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c index 15d6bffdea77..f4ba73b81d31 100644 --- a/drivers/input/mouse/alps.c +++ b/drivers/input/mouse/alps.c @@ -597,13 +597,25 @@ static int alps_decode_pinnacle(struct alps_fields *f, unsigned char *p, static int alps_decode_rushmore(struct alps_fields *f, unsigned char *p, struct psmouse *psmouse) { - alps_decode_pinnacle(f, p, psmouse); - - /* Rushmore's packet decode has a bit difference with Pinnacle's */ + f->first_mp = !!(p[4] & 0x40); f->is_mp = !!(p[5] & 0x40); + f->fingers = max((p[5] & 0x3), ((p[5] >> 2) & 0x3)) + 1; - f->x_map |= (p[5] & 0x10) << 11; - f->y_map |= (p[5] & 0x20) << 6; + f->x_map = ((p[5] & 0x10) << 11) | + ((p[4] & 0x7e) << 8) | + ((p[1] & 0x7f) << 2) | + ((p[0] & 0x30) >> 4); + f->y_map = ((p[5] & 0x20) << 6) | + ((p[3] & 0x70) << 4) | + ((p[2] & 0x7f) << 1) | + (p[4] & 0x01); + + f->st.x = ((p[1] & 0x7f) << 4) | ((p[4] & 0x30) >> 2) | + ((p[0] & 0x30) >> 4); + f->st.y = ((p[2] & 0x7f) << 4) | (p[4] & 0x0f); + f->pressure = p[5] & 0x7f; + + alps_decode_buttons_v3(f, p); return 0; } |