diff options
| author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2014-12-18 13:02:39 -0500 |
|---|---|---|
| committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2014-12-18 13:02:39 -0500 |
| commit | 6d32af019a45654b6eb3ae2ff17d51ba1f045bb4 (patch) | |
| tree | 17d232cb65248c68b86aaec475f576b5134079e2 /drivers/input/mouse | |
| parent | f20c86cd75f1c8c728dafd0218645ff3c5e8545d (diff) | |
| parent | 27a560ba1d4f0a07a36e1de2cae839abe776e8f3 (diff) | |
Merge branch 'next' into for-linus
Second round of input updates for 3.19.
Diffstat (limited to 'drivers/input/mouse')
| -rw-r--r-- | drivers/input/mouse/alps.c | 84 | ||||
| -rw-r--r-- | drivers/input/mouse/trackpoint.c | 4 | ||||
| -rw-r--r-- | drivers/input/mouse/trackpoint.h | 5 |
3 files changed, 83 insertions, 10 deletions
diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c index d125a019383f..d88d73d83552 100644 --- a/drivers/input/mouse/alps.c +++ b/drivers/input/mouse/alps.c | |||
| @@ -881,6 +881,34 @@ static void alps_get_finger_coordinate_v7(struct input_mt_pos *mt, | |||
| 881 | unsigned char *pkt, | 881 | unsigned char *pkt, |
| 882 | unsigned char pkt_id) | 882 | unsigned char pkt_id) |
| 883 | { | 883 | { |
| 884 | /* | ||
| 885 | * packet-fmt b7 b6 b5 b4 b3 b2 b1 b0 | ||
| 886 | * Byte0 TWO & MULTI L 1 R M 1 Y0-2 Y0-1 Y0-0 | ||
| 887 | * Byte0 NEW L 1 X1-5 1 1 Y0-2 Y0-1 Y0-0 | ||
| 888 | * Byte1 Y0-10 Y0-9 Y0-8 Y0-7 Y0-6 Y0-5 Y0-4 Y0-3 | ||
| 889 | * Byte2 X0-11 1 X0-10 X0-9 X0-8 X0-7 X0-6 X0-5 | ||
| 890 | * Byte3 X1-11 1 X0-4 X0-3 1 X0-2 X0-1 X0-0 | ||
| 891 | * Byte4 TWO X1-10 TWO X1-9 X1-8 X1-7 X1-6 X1-5 X1-4 | ||
| 892 | * Byte4 MULTI X1-10 TWO X1-9 X1-8 X1-7 X1-6 Y1-5 1 | ||
| 893 | * Byte4 NEW X1-10 TWO X1-9 X1-8 X1-7 X1-6 0 0 | ||
| 894 | * Byte5 TWO & NEW Y1-10 0 Y1-9 Y1-8 Y1-7 Y1-6 Y1-5 Y1-4 | ||
| 895 | * Byte5 MULTI Y1-10 0 Y1-9 Y1-8 Y1-7 Y1-6 F-1 F-0 | ||
| 896 | * L: Left button | ||
| 897 | * R / M: Non-clickpads: Right / Middle button | ||
| 898 | * Clickpads: When > 2 fingers are down, and some fingers | ||
| 899 | * are in the button area, then the 2 coordinates reported | ||
| 900 | * are for fingers outside the button area and these report | ||
| 901 | * extra fingers being present in the right / left button | ||
| 902 | * area. Note these fingers are not added to the F field! | ||
| 903 | * so if a TWO packet is received and R = 1 then there are | ||
| 904 | * 3 fingers down, etc. | ||
| 905 | * TWO: 1: Two touches present, byte 0/4/5 are in TWO fmt | ||
| 906 | * 0: If byte 4 bit 0 is 1, then byte 0/4/5 are in MULTI fmt | ||
| 907 | * otherwise byte 0 bit 4 must be set and byte 0/4/5 are | ||
| 908 | * in NEW fmt | ||
| 909 | * F: Number of fingers - 3, 0 means 3 fingers, 1 means 4 ... | ||
| 910 | */ | ||
| 911 | |||
| 884 | mt[0].x = ((pkt[2] & 0x80) << 4); | 912 | mt[0].x = ((pkt[2] & 0x80) << 4); |
| 885 | mt[0].x |= ((pkt[2] & 0x3F) << 5); | 913 | mt[0].x |= ((pkt[2] & 0x3F) << 5); |
| 886 | mt[0].x |= ((pkt[3] & 0x30) >> 1); | 914 | mt[0].x |= ((pkt[3] & 0x30) >> 1); |
| @@ -919,18 +947,21 @@ static void alps_get_finger_coordinate_v7(struct input_mt_pos *mt, | |||
| 919 | 947 | ||
| 920 | static int alps_get_mt_count(struct input_mt_pos *mt) | 948 | static int alps_get_mt_count(struct input_mt_pos *mt) |
| 921 | { | 949 | { |
| 922 | int i; | 950 | int i, fingers = 0; |
| 923 | 951 | ||
| 924 | for (i = 0; i < MAX_TOUCHES && mt[i].x != 0 && mt[i].y != 0; i++) | 952 | for (i = 0; i < MAX_TOUCHES; i++) { |
| 925 | /* empty */; | 953 | if (mt[i].x != 0 || mt[i].y != 0) |
| 954 | fingers++; | ||
| 955 | } | ||
| 926 | 956 | ||
| 927 | return i; | 957 | return fingers; |
| 928 | } | 958 | } |
| 929 | 959 | ||
| 930 | static int alps_decode_packet_v7(struct alps_fields *f, | 960 | static int alps_decode_packet_v7(struct alps_fields *f, |
| 931 | unsigned char *p, | 961 | unsigned char *p, |
| 932 | struct psmouse *psmouse) | 962 | struct psmouse *psmouse) |
| 933 | { | 963 | { |
| 964 | struct alps_data *priv = psmouse->private; | ||
| 934 | unsigned char pkt_id; | 965 | unsigned char pkt_id; |
| 935 | 966 | ||
| 936 | pkt_id = alps_get_packet_id_v7(p); | 967 | pkt_id = alps_get_packet_id_v7(p); |
| @@ -938,19 +969,52 @@ static int alps_decode_packet_v7(struct alps_fields *f, | |||
| 938 | return 0; | 969 | return 0; |
| 939 | if (pkt_id == V7_PACKET_ID_UNKNOWN) | 970 | if (pkt_id == V7_PACKET_ID_UNKNOWN) |
| 940 | return -1; | 971 | return -1; |
| 972 | /* | ||
| 973 | * NEW packets are send to indicate a discontinuity in the finger | ||
| 974 | * coordinate reporting. Specifically a finger may have moved from | ||
| 975 | * slot 0 to 1 or vice versa. INPUT_MT_TRACK takes care of this for | ||
| 976 | * us. | ||
| 977 | * | ||
| 978 | * NEW packets have 3 problems: | ||
| 979 | * 1) They do not contain middle / right button info (on non clickpads) | ||
| 980 | * this can be worked around by preserving the old button state | ||
| 981 | * 2) They do not contain an accurate fingercount, and they are | ||
| 982 | * typically send when the number of fingers changes. We cannot use | ||
| 983 | * the old finger count as that may mismatch with the amount of | ||
| 984 | * touch coordinates we've available in the NEW packet | ||
| 985 | * 3) Their x data for the second touch is inaccurate leading to | ||
| 986 | * a possible jump of the x coordinate by 16 units when the first | ||
| 987 | * non NEW packet comes in | ||
| 988 | * Since problems 2 & 3 cannot be worked around, just ignore them. | ||
| 989 | */ | ||
| 990 | if (pkt_id == V7_PACKET_ID_NEW) | ||
| 991 | return 1; | ||
| 941 | 992 | ||
| 942 | alps_get_finger_coordinate_v7(f->mt, p, pkt_id); | 993 | alps_get_finger_coordinate_v7(f->mt, p, pkt_id); |
| 943 | 994 | ||
| 944 | if (pkt_id == V7_PACKET_ID_TWO || pkt_id == V7_PACKET_ID_MULTI) { | 995 | if (pkt_id == V7_PACKET_ID_TWO) |
| 945 | f->left = (p[0] & 0x80) >> 7; | 996 | f->fingers = alps_get_mt_count(f->mt); |
| 997 | else /* pkt_id == V7_PACKET_ID_MULTI */ | ||
| 998 | f->fingers = 3 + (p[5] & 0x03); | ||
| 999 | |||
| 1000 | f->left = (p[0] & 0x80) >> 7; | ||
| 1001 | if (priv->flags & ALPS_BUTTONPAD) { | ||
| 1002 | if (p[0] & 0x20) | ||
| 1003 | f->fingers++; | ||
| 1004 | if (p[0] & 0x10) | ||
| 1005 | f->fingers++; | ||
| 1006 | } else { | ||
| 946 | f->right = (p[0] & 0x20) >> 5; | 1007 | f->right = (p[0] & 0x20) >> 5; |
| 947 | f->middle = (p[0] & 0x10) >> 4; | 1008 | f->middle = (p[0] & 0x10) >> 4; |
| 948 | } | 1009 | } |
| 949 | 1010 | ||
| 950 | if (pkt_id == V7_PACKET_ID_TWO) | 1011 | /* Sometimes a single touch is reported in mt[1] rather then mt[0] */ |
| 951 | f->fingers = alps_get_mt_count(f->mt); | 1012 | if (f->fingers == 1 && f->mt[0].x == 0 && f->mt[0].y == 0) { |
| 952 | else if (pkt_id == V7_PACKET_ID_MULTI) | 1013 | f->mt[0].x = f->mt[1].x; |
| 953 | f->fingers = 3 + (p[5] & 0x03); | 1014 | f->mt[0].y = f->mt[1].y; |
| 1015 | f->mt[1].x = 0; | ||
| 1016 | f->mt[1].y = 0; | ||
| 1017 | } | ||
| 954 | 1018 | ||
| 955 | return 0; | 1019 | return 0; |
| 956 | } | 1020 | } |
diff --git a/drivers/input/mouse/trackpoint.c b/drivers/input/mouse/trackpoint.c index 30c8b6998808..354d47ecd66a 100644 --- a/drivers/input/mouse/trackpoint.c +++ b/drivers/input/mouse/trackpoint.c | |||
| @@ -227,6 +227,7 @@ TRACKPOINT_INT_ATTR(thresh, TP_THRESH, TP_DEF_THRESH); | |||
| 227 | TRACKPOINT_INT_ATTR(upthresh, TP_UP_THRESH, TP_DEF_UP_THRESH); | 227 | TRACKPOINT_INT_ATTR(upthresh, TP_UP_THRESH, TP_DEF_UP_THRESH); |
| 228 | TRACKPOINT_INT_ATTR(ztime, TP_Z_TIME, TP_DEF_Z_TIME); | 228 | TRACKPOINT_INT_ATTR(ztime, TP_Z_TIME, TP_DEF_Z_TIME); |
| 229 | TRACKPOINT_INT_ATTR(jenks, TP_JENKS_CURV, TP_DEF_JENKS_CURV); | 229 | TRACKPOINT_INT_ATTR(jenks, TP_JENKS_CURV, TP_DEF_JENKS_CURV); |
| 230 | TRACKPOINT_INT_ATTR(drift_time, TP_DRIFT_TIME, TP_DEF_DRIFT_TIME); | ||
| 230 | 231 | ||
| 231 | TRACKPOINT_BIT_ATTR(press_to_select, TP_TOGGLE_PTSON, TP_MASK_PTSON, 0, | 232 | TRACKPOINT_BIT_ATTR(press_to_select, TP_TOGGLE_PTSON, TP_MASK_PTSON, 0, |
| 232 | TP_DEF_PTSON); | 233 | TP_DEF_PTSON); |
| @@ -246,6 +247,7 @@ static struct attribute *trackpoint_attrs[] = { | |||
| 246 | &psmouse_attr_upthresh.dattr.attr, | 247 | &psmouse_attr_upthresh.dattr.attr, |
| 247 | &psmouse_attr_ztime.dattr.attr, | 248 | &psmouse_attr_ztime.dattr.attr, |
| 248 | &psmouse_attr_jenks.dattr.attr, | 249 | &psmouse_attr_jenks.dattr.attr, |
| 250 | &psmouse_attr_drift_time.dattr.attr, | ||
| 249 | &psmouse_attr_press_to_select.dattr.attr, | 251 | &psmouse_attr_press_to_select.dattr.attr, |
| 250 | &psmouse_attr_skipback.dattr.attr, | 252 | &psmouse_attr_skipback.dattr.attr, |
| 251 | &psmouse_attr_ext_dev.dattr.attr, | 253 | &psmouse_attr_ext_dev.dattr.attr, |
| @@ -312,6 +314,7 @@ static int trackpoint_sync(struct psmouse *psmouse, bool in_power_on_state) | |||
| 312 | TRACKPOINT_UPDATE(in_power_on_state, psmouse, tp, upthresh); | 314 | TRACKPOINT_UPDATE(in_power_on_state, psmouse, tp, upthresh); |
| 313 | TRACKPOINT_UPDATE(in_power_on_state, psmouse, tp, ztime); | 315 | TRACKPOINT_UPDATE(in_power_on_state, psmouse, tp, ztime); |
| 314 | TRACKPOINT_UPDATE(in_power_on_state, psmouse, tp, jenks); | 316 | TRACKPOINT_UPDATE(in_power_on_state, psmouse, tp, jenks); |
| 317 | TRACKPOINT_UPDATE(in_power_on_state, psmouse, tp, drift_time); | ||
| 315 | 318 | ||
| 316 | /* toggles */ | 319 | /* toggles */ |
| 317 | TRACKPOINT_UPDATE(in_power_on_state, psmouse, tp, press_to_select); | 320 | TRACKPOINT_UPDATE(in_power_on_state, psmouse, tp, press_to_select); |
| @@ -332,6 +335,7 @@ static void trackpoint_defaults(struct trackpoint_data *tp) | |||
| 332 | TRACKPOINT_SET_POWER_ON_DEFAULT(tp, upthresh); | 335 | TRACKPOINT_SET_POWER_ON_DEFAULT(tp, upthresh); |
| 333 | TRACKPOINT_SET_POWER_ON_DEFAULT(tp, ztime); | 336 | TRACKPOINT_SET_POWER_ON_DEFAULT(tp, ztime); |
| 334 | TRACKPOINT_SET_POWER_ON_DEFAULT(tp, jenks); | 337 | TRACKPOINT_SET_POWER_ON_DEFAULT(tp, jenks); |
| 338 | TRACKPOINT_SET_POWER_ON_DEFAULT(tp, drift_time); | ||
| 335 | TRACKPOINT_SET_POWER_ON_DEFAULT(tp, inertia); | 339 | TRACKPOINT_SET_POWER_ON_DEFAULT(tp, inertia); |
| 336 | 340 | ||
| 337 | /* toggles */ | 341 | /* toggles */ |
diff --git a/drivers/input/mouse/trackpoint.h b/drivers/input/mouse/trackpoint.h index ecd0547964a5..5617ed3a7d7a 100644 --- a/drivers/input/mouse/trackpoint.h +++ b/drivers/input/mouse/trackpoint.h | |||
| @@ -70,6 +70,9 @@ | |||
| 70 | #define TP_UP_THRESH 0x5A /* Used to generate a 'click' on Z-axis */ | 70 | #define TP_UP_THRESH 0x5A /* Used to generate a 'click' on Z-axis */ |
| 71 | #define TP_Z_TIME 0x5E /* How sharp of a press */ | 71 | #define TP_Z_TIME 0x5E /* How sharp of a press */ |
| 72 | #define TP_JENKS_CURV 0x5D /* Minimum curvature for double click */ | 72 | #define TP_JENKS_CURV 0x5D /* Minimum curvature for double click */ |
| 73 | #define TP_DRIFT_TIME 0x5F /* How long a 'hands off' condition */ | ||
| 74 | /* must last (x*107ms) for drift */ | ||
| 75 | /* correction to occur */ | ||
| 73 | 76 | ||
| 74 | /* | 77 | /* |
| 75 | * Toggling Flag bits | 78 | * Toggling Flag bits |
| @@ -120,6 +123,7 @@ | |||
| 120 | #define TP_DEF_UP_THRESH 0xFF | 123 | #define TP_DEF_UP_THRESH 0xFF |
| 121 | #define TP_DEF_Z_TIME 0x26 | 124 | #define TP_DEF_Z_TIME 0x26 |
| 122 | #define TP_DEF_JENKS_CURV 0x87 | 125 | #define TP_DEF_JENKS_CURV 0x87 |
| 126 | #define TP_DEF_DRIFT_TIME 0x05 | ||
| 123 | 127 | ||
| 124 | /* Toggles */ | 128 | /* Toggles */ |
| 125 | #define TP_DEF_MB 0x00 | 129 | #define TP_DEF_MB 0x00 |
| @@ -137,6 +141,7 @@ struct trackpoint_data | |||
| 137 | unsigned char draghys, mindrag; | 141 | unsigned char draghys, mindrag; |
| 138 | unsigned char thresh, upthresh; | 142 | unsigned char thresh, upthresh; |
| 139 | unsigned char ztime, jenks; | 143 | unsigned char ztime, jenks; |
| 144 | unsigned char drift_time; | ||
| 140 | 145 | ||
| 141 | /* toggles */ | 146 | /* toggles */ |
| 142 | unsigned char press_to_select; | 147 | unsigned char press_to_select; |
