diff options
| author | Henrik Rydberg <rydberg@bitmath.org> | 2010-09-06 09:59:01 +0200 |
|---|---|---|
| committer | Henrik Rydberg <rydberg@bitmath.org> | 2010-09-06 09:59:01 +0200 |
| commit | a9606c01f7edfc21a3fce1f10152fbf266e74d4f (patch) | |
| tree | c036a72be47944e9bcffbf2ae7b40d102fe577c1 /usr/src/dkms_source_tree/wacom_wac.c | |
| parent | 9c70cefed5bc44284a2cd63fc5e3b4ab3d90d0bf (diff) | |
Align with 2.6.37
This patch aligns wacom support with kernel 2.6.37. The tablet
buttons have been remapped and the code has been prepared for
adding the rest of the Bamboo family.
Signed-off-by: Henrik Rydberg <rydberg@bitmath.org>
Diffstat (limited to 'usr/src/dkms_source_tree/wacom_wac.c')
| -rw-r--r-- | usr/src/dkms_source_tree/wacom_wac.c | 108 |
1 files changed, 71 insertions, 37 deletions
diff --git a/usr/src/dkms_source_tree/wacom_wac.c b/usr/src/dkms_source_tree/wacom_wac.c index d1c388e..fd2463c 100644 --- a/usr/src/dkms_source_tree/wacom_wac.c +++ b/usr/src/dkms_source_tree/wacom_wac.c | |||
| @@ -855,12 +855,13 @@ 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_bbt_irq(struct wacom_wac *wacom, size_t len) | 858 | static int wacom_bpt_irq(struct wacom_wac *wacom, size_t len) |
| 859 | { | 859 | { |
| 860 | static int trkid; | 860 | struct wacom_features *features = &wacom->features; |
| 861 | struct input_dev *input = wacom->input; | 861 | struct input_dev *input = wacom->input; |
| 862 | unsigned char *data = wacom->data; | 862 | unsigned char *data = wacom->data; |
| 863 | int i, sp = 0, sx = 0, sy = 0, count = 0; | 863 | int sp = 0, sx = 0, sy = 0, count = 0; |
| 864 | int i; | ||
| 864 | 865 | ||
| 865 | if (len != WACOM_PKGLEN_BBTOUCH) | 866 | if (len != WACOM_PKGLEN_BBTOUCH) |
| 866 | return 0; | 867 | return 0; |
| @@ -871,14 +872,15 @@ static int wacom_bbt_irq(struct wacom_wac *wacom, size_t len) | |||
| 871 | if (p) { | 872 | if (p) { |
| 872 | int x = get_unaligned_be16(&data[9 * i + 3]) & 0x7ff; | 873 | int x = get_unaligned_be16(&data[9 * i + 3]) & 0x7ff; |
| 873 | int y = get_unaligned_be16(&data[9 * i + 5]) & 0x7ff; | 874 | int y = get_unaligned_be16(&data[9 * i + 5]) & 0x7ff; |
| 874 | /* artificial scaling */ | 875 | if (features->quirks & WACOM_QUIRK_BBTOUCH_LOWRES) { |
| 875 | x <<= 4; | 876 | x <<= 5; |
| 876 | y <<= 4; | 877 | y <<= 5; |
| 878 | } | ||
| 877 | input_report_abs(input, ABS_MT_PRESSURE, p); | 879 | input_report_abs(input, ABS_MT_PRESSURE, p); |
| 878 | input_report_abs(input, ABS_MT_POSITION_X, x); | 880 | input_report_abs(input, ABS_MT_POSITION_X, x); |
| 879 | input_report_abs(input, ABS_MT_POSITION_Y, y); | 881 | input_report_abs(input, ABS_MT_POSITION_Y, y); |
| 880 | if (wacom->id[i] < 0) | 882 | if (wacom->id[i] < 0) |
| 881 | wacom->id[i] = trkid++ & MAX_TRACKING_ID; | 883 | wacom->id[i] = wacom->trk_id++ & MAX_TRACKING_ID; |
| 882 | if (!count++) | 884 | if (!count++) |
| 883 | sp = p, sx = x, sy = y; | 885 | sp = p, sx = x, sy = y; |
| 884 | } else { | 886 | } else { |
| @@ -896,7 +898,8 @@ static int wacom_bbt_irq(struct wacom_wac *wacom, size_t len) | |||
| 896 | input_report_abs(input, ABS_Y, sy); | 898 | input_report_abs(input, ABS_Y, sy); |
| 897 | 899 | ||
| 898 | input_report_key(input, BTN_LEFT, (data[1] & 0x08) != 0); | 900 | input_report_key(input, BTN_LEFT, (data[1] & 0x08) != 0); |
| 899 | input_report_key(input, BTN_MIDDLE, (data[1] & 0x06) != 0); | 901 | input_report_key(input, BTN_FORWARD, (data[1] & 0x04) != 0); |
| 902 | input_report_key(input, BTN_BACK, (data[1] & 0x02) != 0); | ||
| 900 | input_report_key(input, BTN_RIGHT, (data[1] & 0x01) != 0); | 903 | input_report_key(input, BTN_RIGHT, (data[1] & 0x01) != 0); |
| 901 | 904 | ||
| 902 | input_sync(input); | 905 | input_sync(input); |
| @@ -949,8 +952,8 @@ void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len) | |||
| 949 | sync = wacom_tpc_irq(wacom_wac, len); | 952 | sync = wacom_tpc_irq(wacom_wac, len); |
| 950 | break; | 953 | break; |
| 951 | 954 | ||
| 952 | case BAMBOO_TOUCH: | 955 | case BAMBOO_PT: |
| 953 | sync = wacom_bbt_irq(wacom_wac, len); | 956 | sync = wacom_bpt_irq(wacom_wac, len); |
| 954 | break; | 957 | break; |
| 955 | 958 | ||
| 956 | default: | 959 | default: |
| @@ -994,6 +997,34 @@ static void wacom_setup_intuos(struct wacom_wac *wacom_wac) | |||
| 994 | input_set_abs_params(input_dev, ABS_THROTTLE, -1023, 1023, 0, 0); | 997 | input_set_abs_params(input_dev, ABS_THROTTLE, -1023, 1023, 0, 0); |
| 995 | } | 998 | } |
| 996 | 999 | ||
| 1000 | |||
| 1001 | void wacom_setup_device_quirks(struct wacom_features *features) | ||
| 1002 | { | ||
| 1003 | |||
| 1004 | /* touch device found but size is not defined. use default */ | ||
| 1005 | if (features->device_type == BTN_TOOL_DOUBLETAP && !features->x_max) { | ||
| 1006 | features->x_max = 1023; | ||
| 1007 | features->y_max = 1023; | ||
| 1008 | } | ||
| 1009 | |||
| 1010 | /* these device have multiple inputs */ | ||
| 1011 | if (features->type == TABLETPC || features->type == TABLETPC2FG || | ||
| 1012 | features->type == BAMBOO_PT) | ||
| 1013 | features->quirks |= WACOM_QUIRK_MULTI_INPUT; | ||
| 1014 | |||
| 1015 | /* quirks for bamboo touch */ | ||
| 1016 | if (features->type == BAMBOO_PT && | ||
| 1017 | features->device_type == BTN_TOOL_TRIPLETAP) { | ||
| 1018 | features->x_max <<= 5; | ||
| 1019 | features->y_max <<= 5; | ||
| 1020 | features->x_fuzz <<= 5; | ||
| 1021 | features->y_fuzz <<= 5; | ||
| 1022 | features->pressure_max = 256; | ||
| 1023 | features->pressure_fuzz = 16; | ||
| 1024 | features->quirks |= WACOM_QUIRK_BBTOUCH_LOWRES; | ||
| 1025 | } | ||
| 1026 | } | ||
| 1027 | |||
| 997 | void wacom_setup_input_capabilities(struct input_dev *input_dev, | 1028 | void wacom_setup_input_capabilities(struct input_dev *input_dev, |
| 998 | struct wacom_wac *wacom_wac) | 1029 | struct wacom_wac *wacom_wac) |
| 999 | { | 1030 | { |
| @@ -1004,9 +1035,12 @@ void wacom_setup_input_capabilities(struct input_dev *input_dev, | |||
| 1004 | 1035 | ||
| 1005 | __set_bit(BTN_TOUCH, input_dev->keybit); | 1036 | __set_bit(BTN_TOUCH, input_dev->keybit); |
| 1006 | 1037 | ||
| 1007 | input_set_abs_params(input_dev, ABS_X, 0, features->x_max, 4, 0); | 1038 | input_set_abs_params(input_dev, ABS_X, 0, features->x_max, |
| 1008 | input_set_abs_params(input_dev, ABS_Y, 0, features->y_max, 4, 0); | 1039 | features->x_fuzz, 0); |
| 1009 | input_set_abs_params(input_dev, ABS_PRESSURE, 0, features->pressure_max, 0, 0); | 1040 | input_set_abs_params(input_dev, ABS_Y, 0, features->y_max, |
| 1041 | features->y_fuzz, 0); | ||
| 1042 | input_set_abs_params(input_dev, ABS_PRESSURE, 0, features->pressure_max, | ||
| 1043 | features->pressure_fuzz, 0); | ||
| 1010 | 1044 | ||
| 1011 | __set_bit(ABS_MISC, input_dev->absbit); | 1045 | __set_bit(ABS_MISC, input_dev->absbit); |
| 1012 | 1046 | ||
| @@ -1130,24 +1164,31 @@ void wacom_setup_input_capabilities(struct input_dev *input_dev, | |||
| 1130 | __set_bit(BTN_TOOL_RUBBER, input_dev->keybit); | 1164 | __set_bit(BTN_TOOL_RUBBER, input_dev->keybit); |
| 1131 | break; | 1165 | break; |
| 1132 | 1166 | ||
| 1133 | case BAMBOO_TOUCH: | 1167 | case BAMBOO_PT: |
| 1134 | __clear_bit(ABS_MISC, input_dev->absbit); | 1168 | __clear_bit(ABS_MISC, input_dev->absbit); |
| 1135 | __set_bit(BTN_LEFT, input_dev->keybit); | ||
| 1136 | __set_bit(BTN_MIDDLE, input_dev->keybit); | ||
| 1137 | __set_bit(BTN_RIGHT, input_dev->keybit); | ||
| 1138 | 1169 | ||
| 1139 | __set_bit(BTN_TOOL_FINGER, input_dev->keybit); | 1170 | if (features->device_type == BTN_TOOL_TRIPLETAP) { |
| 1140 | __set_bit(BTN_TOOL_DOUBLETAP, input_dev->keybit); | 1171 | __set_bit(BTN_LEFT, input_dev->keybit); |
| 1172 | __set_bit(BTN_FORWARD, input_dev->keybit); | ||
| 1173 | __set_bit(BTN_BACK, input_dev->keybit); | ||
| 1174 | __set_bit(BTN_RIGHT, input_dev->keybit); | ||
| 1141 | 1175 | ||
| 1142 | input_set_abs_params(input_dev, ABS_X, 0, features->x_max, 32, 0); | 1176 | __set_bit(BTN_TOOL_FINGER, input_dev->keybit); |
| 1143 | input_set_abs_params(input_dev, ABS_Y, 0, features->y_max, 32, 0); | 1177 | __set_bit(BTN_TOOL_DOUBLETAP, input_dev->keybit); |
| 1144 | input_set_abs_params(input_dev, ABS_PRESSURE, 0, features->pressure_max, 16, 0); | ||
| 1145 | 1178 | ||
| 1146 | input_mt_create_slots(input_dev, 2); | 1179 | input_mt_create_slots(input_dev, 2); |
| 1147 | input_set_abs_params(input_dev, ABS_MT_POSITION_X, 0, features->x_max, 32, 0); | 1180 | input_set_abs_params(input_dev, ABS_MT_POSITION_X, |
| 1148 | input_set_abs_params(input_dev, ABS_MT_POSITION_Y, 0, features->y_max, 32, 0); | 1181 | 0, features->x_max, |
| 1149 | input_set_abs_params(input_dev, ABS_MT_PRESSURE, 0, features->pressure_max, 16, 0); | 1182 | features->x_fuzz, 0); |
| 1150 | input_set_abs_params(input_dev, ABS_MT_TRACKING_ID, 0, MAX_TRACKING_ID, 0, 0); | 1183 | input_set_abs_params(input_dev, ABS_MT_POSITION_Y, |
| 1184 | 0, features->y_max, | ||
| 1185 | features->y_fuzz, 0); | ||
| 1186 | input_set_abs_params(input_dev, ABS_MT_PRESSURE, | ||
| 1187 | 0, features->pressure_max, | ||
| 1188 | features->pressure_fuzz, 0); | ||
| 1189 | input_set_abs_params(input_dev, ABS_MT_TRACKING_ID, 0, | ||
| 1190 | MAX_TRACKING_ID, 0, 0); | ||
| 1191 | } | ||
| 1151 | break; | 1192 | break; |
| 1152 | } | 1193 | } |
| 1153 | } | 1194 | } |
| @@ -1286,19 +1327,13 @@ static const struct wacom_features wacom_features_0xE3 = | |||
| 1286 | { "Wacom ISDv4 E3", WACOM_PKGLEN_TPC2FG, 26202, 16325, 255, 0, TABLETPC2FG }; | 1327 | { "Wacom ISDv4 E3", WACOM_PKGLEN_TPC2FG, 26202, 16325, 255, 0, TABLETPC2FG }; |
| 1287 | static const struct wacom_features wacom_features_0x47 = | 1328 | static const struct wacom_features wacom_features_0x47 = |
| 1288 | { "Wacom Intuos2 6x8", WACOM_PKGLEN_INTUOS, 20320, 16240, 1023, 31, INTUOS }; | 1329 | { "Wacom Intuos2 6x8", WACOM_PKGLEN_INTUOS, 20320, 16240, 1023, 31, INTUOS }; |
| 1289 | static const struct wacom_features wacom_features_0xD0_0 = | 1330 | static struct wacom_features wacom_features_0xD0 = |
| 1290 | { "Wacom Bamboo Touch", WACOM_PKGLEN_BBTOUCH, 7680, 5120, 255, 0, BAMBOO_TOUCH }; | 1331 | { "Wacom Bamboo 2FG", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, 63, BAMBOO_PT }; |
| 1291 | static const struct wacom_features wacom_features_0xD0_2 = | ||
| 1292 | { "Wacom Bamboo Boot", WACOM_PKGLEN_BBFUN, 14760, 9225, 511, 63, WACOM_MO }; | ||
| 1293 | 1332 | ||
| 1294 | #define USB_DEVICE_WACOM(prod) \ | 1333 | #define USB_DEVICE_WACOM(prod) \ |
| 1295 | USB_DEVICE(USB_VENDOR_ID_WACOM, prod), \ | 1334 | USB_DEVICE(USB_VENDOR_ID_WACOM, prod), \ |
| 1296 | .driver_info = (kernel_ulong_t)&wacom_features_##prod | 1335 | .driver_info = (kernel_ulong_t)&wacom_features_##prod |
| 1297 | 1336 | ||
| 1298 | #define USB_DEVICE_WACOM_PROTO(prod, pr) \ | ||
| 1299 | USB_DEVICE_INTERFACE_PROTOCOL(USB_VENDOR_ID_WACOM, prod, pr), \ | ||
| 1300 | .driver_info = (kernel_ulong_t)&wacom_features_##prod##_##pr | ||
| 1301 | |||
| 1302 | const struct usb_device_id wacom_ids[] = { | 1337 | const struct usb_device_id wacom_ids[] = { |
| 1303 | { USB_DEVICE_WACOM(0x00) }, | 1338 | { USB_DEVICE_WACOM(0x00) }, |
| 1304 | { USB_DEVICE_WACOM(0x10) }, | 1339 | { USB_DEVICE_WACOM(0x10) }, |
| @@ -1358,8 +1393,7 @@ const struct usb_device_id wacom_ids[] = { | |||
| 1358 | { USB_DEVICE_WACOM(0xC6) }, | 1393 | { USB_DEVICE_WACOM(0xC6) }, |
| 1359 | { USB_DEVICE_WACOM(0xC7) }, | 1394 | { USB_DEVICE_WACOM(0xC7) }, |
| 1360 | { USB_DEVICE_WACOM(0xCE) }, | 1395 | { USB_DEVICE_WACOM(0xCE) }, |
| 1361 | { USB_DEVICE_WACOM_PROTO(0xD0, 0) }, | 1396 | { USB_DEVICE_WACOM(0xD0) }, |
| 1362 | { USB_DEVICE_WACOM_PROTO(0xD0, 2) }, | ||
| 1363 | { USB_DEVICE_WACOM(0xF0) }, | 1397 | { USB_DEVICE_WACOM(0xF0) }, |
| 1364 | { USB_DEVICE_WACOM(0xCC) }, | 1398 | { USB_DEVICE_WACOM(0xCC) }, |
| 1365 | { USB_DEVICE_WACOM(0x90) }, | 1399 | { USB_DEVICE_WACOM(0x90) }, |
