diff options
author | Henrik Rydberg <rydberg@euromail.se> | 2010-09-05 15:53:16 -0400 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2010-09-05 15:58:17 -0400 |
commit | cb734c03680eaaad64a20a666300eafd1ac260b2 (patch) | |
tree | f32070df68914c35477e36662783d84b5a9ac9f2 /drivers/input/tablet | |
parent | bc73dd39e78dd6e5b34cd938b7f037a8bc041bdd (diff) |
Input: wacom - add support for the Bamboo Touch trackpad
Add support for the Bamboo Touch trackpad, and make it work with
both the Synaptics X Driver and the Multitouch X Driver. The device
uses MT slots internally, so the choice of protocol is a given.
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Acked-by: Ping Cheng <pingc@wacom.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/tablet')
-rw-r--r-- | drivers/input/tablet/wacom_wac.c | 88 | ||||
-rw-r--r-- | drivers/input/tablet/wacom_wac.h | 4 |
2 files changed, 92 insertions, 0 deletions
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c index 44b4a59750d8..4e9b1ddf54e9 100644 --- a/drivers/input/tablet/wacom_wac.c +++ b/drivers/input/tablet/wacom_wac.c | |||
@@ -855,6 +855,53 @@ static int wacom_tpc_irq(struct wacom_wac *wacom, size_t len) | |||
855 | return retval; | 855 | return retval; |
856 | } | 856 | } |
857 | 857 | ||
858 | static int wacom_bpt_irq(struct wacom_wac *wacom, size_t len) | ||
859 | { | ||
860 | struct input_dev *input = wacom->input; | ||
861 | unsigned char *data = wacom->data; | ||
862 | int sp = 0, sx = 0, sy = 0, count = 0; | ||
863 | int i; | ||
864 | |||
865 | if (len != WACOM_PKGLEN_BBTOUCH) | ||
866 | return 0; | ||
867 | |||
868 | for (i = 0; i < 2; i++) { | ||
869 | int p = data[9 * i + 2]; | ||
870 | input_mt_slot(input, i); | ||
871 | if (p) { | ||
872 | int x = get_unaligned_be16(&data[9 * i + 3]) & 0x7ff; | ||
873 | int y = get_unaligned_be16(&data[9 * i + 5]) & 0x7ff; | ||
874 | input_report_abs(input, ABS_MT_PRESSURE, p); | ||
875 | input_report_abs(input, ABS_MT_POSITION_X, x); | ||
876 | input_report_abs(input, ABS_MT_POSITION_Y, y); | ||
877 | if (wacom->id[i] < 0) | ||
878 | wacom->id[i] = wacom->trk_id++ & MAX_TRACKING_ID; | ||
879 | if (!count++) | ||
880 | sp = p, sx = x, sy = y; | ||
881 | } else { | ||
882 | wacom->id[i] = -1; | ||
883 | } | ||
884 | input_report_abs(input, ABS_MT_TRACKING_ID, wacom->id[i]); | ||
885 | } | ||
886 | |||
887 | input_report_key(input, BTN_TOUCH, count > 0); | ||
888 | input_report_key(input, BTN_TOOL_FINGER, count == 1); | ||
889 | input_report_key(input, BTN_TOOL_DOUBLETAP, count == 2); | ||
890 | |||
891 | input_report_abs(input, ABS_PRESSURE, sp); | ||
892 | input_report_abs(input, ABS_X, sx); | ||
893 | input_report_abs(input, ABS_Y, sy); | ||
894 | |||
895 | input_report_key(input, BTN_LEFT, (data[1] & 0x08) != 0); | ||
896 | input_report_key(input, BTN_FORWARD, (data[1] & 0x04) != 0); | ||
897 | input_report_key(input, BTN_BACK, (data[1] & 0x02) != 0); | ||
898 | input_report_key(input, BTN_RIGHT, (data[1] & 0x01) != 0); | ||
899 | |||
900 | input_sync(input); | ||
901 | |||
902 | return 0; | ||
903 | } | ||
904 | |||
858 | void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len) | 905 | void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len) |
859 | { | 906 | { |
860 | bool sync; | 907 | bool sync; |
@@ -900,6 +947,10 @@ void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len) | |||
900 | sync = wacom_tpc_irq(wacom_wac, len); | 947 | sync = wacom_tpc_irq(wacom_wac, len); |
901 | break; | 948 | break; |
902 | 949 | ||
950 | case BAMBOO_PT: | ||
951 | sync = wacom_bpt_irq(wacom_wac, len); | ||
952 | break; | ||
953 | |||
903 | default: | 954 | default: |
904 | sync = false; | 955 | sync = false; |
905 | break; | 956 | break; |
@@ -955,6 +1006,13 @@ void wacom_setup_device_quirks(struct wacom_features *features) | |||
955 | if (features->type == TABLETPC || features->type == TABLETPC2FG || | 1006 | if (features->type == TABLETPC || features->type == TABLETPC2FG || |
956 | features->type == BAMBOO_PT) | 1007 | features->type == BAMBOO_PT) |
957 | features->quirks |= WACOM_QUIRK_MULTI_INPUT; | 1008 | features->quirks |= WACOM_QUIRK_MULTI_INPUT; |
1009 | |||
1010 | /* quirks for bamboo touch */ | ||
1011 | if (features->type == BAMBOO_PT && | ||
1012 | features->device_type == BTN_TOOL_TRIPLETAP) { | ||
1013 | features->pressure_max = 256; | ||
1014 | features->pressure_fuzz = 16; | ||
1015 | } | ||
958 | } | 1016 | } |
959 | 1017 | ||
960 | void wacom_setup_input_capabilities(struct input_dev *input_dev, | 1018 | void wacom_setup_input_capabilities(struct input_dev *input_dev, |
@@ -1095,6 +1153,33 @@ void wacom_setup_input_capabilities(struct input_dev *input_dev, | |||
1095 | case PENPARTNER: | 1153 | case PENPARTNER: |
1096 | __set_bit(BTN_TOOL_RUBBER, input_dev->keybit); | 1154 | __set_bit(BTN_TOOL_RUBBER, input_dev->keybit); |
1097 | break; | 1155 | break; |
1156 | |||
1157 | case BAMBOO_PT: | ||
1158 | __clear_bit(ABS_MISC, input_dev->absbit); | ||
1159 | |||
1160 | if (features->device_type == BTN_TOOL_TRIPLETAP) { | ||
1161 | __set_bit(BTN_LEFT, input_dev->keybit); | ||
1162 | __set_bit(BTN_FORWARD, input_dev->keybit); | ||
1163 | __set_bit(BTN_BACK, input_dev->keybit); | ||
1164 | __set_bit(BTN_RIGHT, input_dev->keybit); | ||
1165 | |||
1166 | __set_bit(BTN_TOOL_FINGER, input_dev->keybit); | ||
1167 | __set_bit(BTN_TOOL_DOUBLETAP, input_dev->keybit); | ||
1168 | |||
1169 | input_mt_create_slots(input_dev, 2); | ||
1170 | input_set_abs_params(input_dev, ABS_MT_POSITION_X, | ||
1171 | 0, features->x_max, | ||
1172 | features->x_fuzz, 0); | ||
1173 | input_set_abs_params(input_dev, ABS_MT_POSITION_Y, | ||
1174 | 0, features->y_max, | ||
1175 | features->y_fuzz, 0); | ||
1176 | input_set_abs_params(input_dev, ABS_MT_PRESSURE, | ||
1177 | 0, features->pressure_max, | ||
1178 | features->pressure_fuzz, 0); | ||
1179 | input_set_abs_params(input_dev, ABS_MT_TRACKING_ID, 0, | ||
1180 | MAX_TRACKING_ID, 0, 0); | ||
1181 | } | ||
1182 | break; | ||
1098 | } | 1183 | } |
1099 | } | 1184 | } |
1100 | 1185 | ||
@@ -1232,6 +1317,8 @@ static const struct wacom_features wacom_features_0xE3 = | |||
1232 | { "Wacom ISDv4 E3", WACOM_PKGLEN_TPC2FG, 26202, 16325, 255, 0, TABLETPC2FG }; | 1317 | { "Wacom ISDv4 E3", WACOM_PKGLEN_TPC2FG, 26202, 16325, 255, 0, TABLETPC2FG }; |
1233 | static const struct wacom_features wacom_features_0x47 = | 1318 | static const struct wacom_features wacom_features_0x47 = |
1234 | { "Wacom Intuos2 6x8", WACOM_PKGLEN_INTUOS, 20320, 16240, 1023, 31, INTUOS }; | 1319 | { "Wacom Intuos2 6x8", WACOM_PKGLEN_INTUOS, 20320, 16240, 1023, 31, INTUOS }; |
1320 | static struct wacom_features wacom_features_0xD0 = | ||
1321 | { "Wacom Bamboo 2FG", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, 63, BAMBOO_PT }; | ||
1235 | 1322 | ||
1236 | #define USB_DEVICE_WACOM(prod) \ | 1323 | #define USB_DEVICE_WACOM(prod) \ |
1237 | USB_DEVICE(USB_VENDOR_ID_WACOM, prod), \ | 1324 | USB_DEVICE(USB_VENDOR_ID_WACOM, prod), \ |
@@ -1296,6 +1383,7 @@ const struct usb_device_id wacom_ids[] = { | |||
1296 | { USB_DEVICE_WACOM(0xC6) }, | 1383 | { USB_DEVICE_WACOM(0xC6) }, |
1297 | { USB_DEVICE_WACOM(0xC7) }, | 1384 | { USB_DEVICE_WACOM(0xC7) }, |
1298 | { USB_DEVICE_WACOM(0xCE) }, | 1385 | { USB_DEVICE_WACOM(0xCE) }, |
1386 | { USB_DEVICE_WACOM(0xD0) }, | ||
1299 | { USB_DEVICE_WACOM(0xF0) }, | 1387 | { USB_DEVICE_WACOM(0xF0) }, |
1300 | { USB_DEVICE_WACOM(0xCC) }, | 1388 | { USB_DEVICE_WACOM(0xCC) }, |
1301 | { USB_DEVICE_WACOM(0x90) }, | 1389 | { USB_DEVICE_WACOM(0x90) }, |
diff --git a/drivers/input/tablet/wacom_wac.h b/drivers/input/tablet/wacom_wac.h index 6a1ff10b095a..a23d6a5fcc4f 100644 --- a/drivers/input/tablet/wacom_wac.h +++ b/drivers/input/tablet/wacom_wac.h | |||
@@ -41,6 +41,9 @@ | |||
41 | /* device quirks */ | 41 | /* device quirks */ |
42 | #define WACOM_QUIRK_MULTI_INPUT 0x0001 | 42 | #define WACOM_QUIRK_MULTI_INPUT 0x0001 |
43 | 43 | ||
44 | /* largest reported tracking id */ | ||
45 | #define MAX_TRACKING_ID 0xfff | ||
46 | |||
44 | enum { | 47 | enum { |
45 | PENPARTNER = 0, | 48 | PENPARTNER = 0, |
46 | GRAPHIRE, | 49 | GRAPHIRE, |
@@ -96,6 +99,7 @@ struct wacom_wac { | |||
96 | int id[3]; | 99 | int id[3]; |
97 | __u32 serial[2]; | 100 | __u32 serial[2]; |
98 | int last_finger; | 101 | int last_finger; |
102 | int trk_id; | ||
99 | struct wacom_features features; | 103 | struct wacom_features features; |
100 | struct wacom_shared *shared; | 104 | struct wacom_shared *shared; |
101 | struct input_dev *input; | 105 | struct input_dev *input; |