diff options
author | Hans de Goede <hdegoede@redhat.com> | 2015-05-20 17:40:06 -0400 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2015-05-20 17:45:43 -0400 |
commit | 44b77f38dce59f57a679083df12509deab02cfcc (patch) | |
tree | 1460f0da20a1efc23b7651d09d9cf279eb97381e | |
parent | a839cd579b64e41779a24c691d0c88c6a16c63e0 (diff) |
Input: alps - decode the position packet first
We should decode the position packet before the packet with the bitmap
data. This way we can use the more accurate position info in
process_bitmap() to get better results.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
-rw-r--r-- | drivers/input/mouse/alps.c | 35 |
1 files changed, 14 insertions, 21 deletions
diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c index 942ee08ce6b4..d1488db6d149 100644 --- a/drivers/input/mouse/alps.c +++ b/drivers/input/mouse/alps.c | |||
@@ -688,25 +688,18 @@ static void alps_process_touchpad_packet_v3_v5(struct psmouse *psmouse) | |||
688 | */ | 688 | */ |
689 | if (f->is_mp) { | 689 | if (f->is_mp) { |
690 | fingers = f->fingers; | 690 | fingers = f->fingers; |
691 | /* | ||
692 | * Bitmap processing uses position packet's coordinate | ||
693 | * data, so we need to do decode it first. | ||
694 | */ | ||
695 | priv->decode_fields(f, priv->multi_data, psmouse); | ||
696 | |||
691 | if (priv->proto_version == ALPS_PROTO_V3 || | 697 | if (priv->proto_version == ALPS_PROTO_V3 || |
692 | priv->proto_version == ALPS_PROTO_V3_RUSHMORE) { | 698 | priv->proto_version == ALPS_PROTO_V3_RUSHMORE) { |
693 | if (alps_process_bitmap(priv, f) == 0) | 699 | if (alps_process_bitmap(priv, f) == 0) |
694 | fingers = 0; /* Use st data */ | 700 | fingers = 0; /* Use st data */ |
695 | |||
696 | /* Now process position packet */ | ||
697 | priv->decode_fields(f, priv->multi_data, | ||
698 | psmouse); | ||
699 | } else { | 701 | } else { |
700 | /* | 702 | /* |
701 | * Because Dolphin uses position packet's | ||
702 | * coordinate data as Pt1 and uses it to | ||
703 | * calculate Pt2, so we need to do position | ||
704 | * packet decode first. | ||
705 | */ | ||
706 | priv->decode_fields(f, priv->multi_data, | ||
707 | psmouse); | ||
708 | |||
709 | /* | ||
710 | * Since Dolphin's finger number is reliable, | 703 | * Since Dolphin's finger number is reliable, |
711 | * there is no need to compare with bmap_fn. | 704 | * there is no need to compare with bmap_fn. |
712 | */ | 705 | */ |
@@ -873,6 +866,14 @@ static void alps_process_packet_v4(struct psmouse *psmouse) | |||
873 | priv->multi_data[offset] = packet[6]; | 866 | priv->multi_data[offset] = packet[6]; |
874 | priv->multi_data[offset + 1] = packet[7]; | 867 | priv->multi_data[offset + 1] = packet[7]; |
875 | 868 | ||
869 | f->left = !!(packet[4] & 0x01); | ||
870 | f->right = !!(packet[4] & 0x02); | ||
871 | |||
872 | f->st.x = ((packet[1] & 0x7f) << 4) | ((packet[3] & 0x30) >> 2) | | ||
873 | ((packet[0] & 0x30) >> 4); | ||
874 | f->st.y = ((packet[2] & 0x7f) << 4) | (packet[3] & 0x0f); | ||
875 | f->pressure = packet[5] & 0x7f; | ||
876 | |||
876 | if (++priv->multi_packet > 2) { | 877 | if (++priv->multi_packet > 2) { |
877 | priv->multi_packet = 0; | 878 | priv->multi_packet = 0; |
878 | 879 | ||
@@ -887,14 +888,6 @@ static void alps_process_packet_v4(struct psmouse *psmouse) | |||
887 | f->fingers = alps_process_bitmap(priv, f); | 888 | f->fingers = alps_process_bitmap(priv, f); |
888 | } | 889 | } |
889 | 890 | ||
890 | f->left = !!(packet[4] & 0x01); | ||
891 | f->right = !!(packet[4] & 0x02); | ||
892 | |||
893 | f->st.x = ((packet[1] & 0x7f) << 4) | ((packet[3] & 0x30) >> 2) | | ||
894 | ((packet[0] & 0x30) >> 4); | ||
895 | f->st.y = ((packet[2] & 0x7f) << 4) | (packet[3] & 0x0f); | ||
896 | f->pressure = packet[5] & 0x7f; | ||
897 | |||
898 | alps_report_semi_mt_data(psmouse, f->fingers); | 891 | alps_report_semi_mt_data(psmouse, f->fingers); |
899 | } | 892 | } |
900 | 893 | ||