aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPing Cheng <pinglinux@gmail.com>2015-09-23 12:59:10 -0400
committerJiri Kosina <jkosina@suse.cz>2015-09-23 16:54:57 -0400
commit3b164a00a9fc0e8df88291a671bb3de37aa3340f (patch)
tree8c16cfaa4a58e45b999a69560d4243abc78e90ef
parent851328feb8c1d4130d3a0acb004e474168702d6d (diff)
HID: wacom: Cleanup unsupported device_type for BAMBOO_PT
Not all Bamboo support both pen and touch. Make sure we deal with pen only and touch only devices properly. Signed-off-by: Ping Cheng <pingc@wacom.com> Tested-By: Aaron Skomra <aaron.skomra@wacom.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
-rw-r--r--drivers/hid/wacom_sys.c49
-rw-r--r--drivers/hid/wacom_wac.c31
-rw-r--r--drivers/hid/wacom_wac.h4
3 files changed, 54 insertions, 30 deletions
diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c
index 9a4912c1828d..f4ba6a0ca4cb 100644
--- a/drivers/hid/wacom_sys.c
+++ b/drivers/hid/wacom_sys.c
@@ -211,7 +211,7 @@ static void wacom_usage_mapping(struct hid_device *hdev,
211 * Bamboo models do not support HID_DG_CONTACTMAX. 211 * Bamboo models do not support HID_DG_CONTACTMAX.
212 * And, Bamboo Pen only descriptor contains touch. 212 * And, Bamboo Pen only descriptor contains touch.
213 */ 213 */
214 if (features->type != BAMBOO_PT) { 214 if (features->type > BAMBOO_PT) {
215 /* ISDv4 touch devices at least supports one touch point */ 215 /* ISDv4 touch devices at least supports one touch point */
216 if (finger && !features->touch_max) 216 if (finger && !features->touch_max)
217 features->touch_max = 1; 217 features->touch_max = 1;
@@ -222,7 +222,8 @@ static void wacom_usage_mapping(struct hid_device *hdev,
222 features->x_max = field->logical_maximum; 222 features->x_max = field->logical_maximum;
223 if (finger) { 223 if (finger) {
224 features->x_phy = field->physical_maximum; 224 features->x_phy = field->physical_maximum;
225 if (features->type != BAMBOO_PT) { 225 if ((features->type != BAMBOO_PT) &&
226 (features->type != BAMBOO_TOUCH)) {
226 features->unit = field->unit; 227 features->unit = field->unit;
227 features->unitExpo = field->unit_exponent; 228 features->unitExpo = field->unit_exponent;
228 } 229 }
@@ -232,7 +233,8 @@ static void wacom_usage_mapping(struct hid_device *hdev,
232 features->y_max = field->logical_maximum; 233 features->y_max = field->logical_maximum;
233 if (finger) { 234 if (finger) {
234 features->y_phy = field->physical_maximum; 235 features->y_phy = field->physical_maximum;
235 if (features->type != BAMBOO_PT) { 236 if ((features->type != BAMBOO_PT) &&
237 (features->type != BAMBOO_TOUCH)) {
236 features->unit = field->unit; 238 features->unit = field->unit;
237 features->unitExpo = field->unit_exponent; 239 features->unitExpo = field->unit_exponent;
238 } 240 }
@@ -1547,15 +1549,16 @@ static void wacom_wireless_work(struct work_struct *work)
1547 wacom_wac1->features = 1549 wacom_wac1->features =
1548 *((struct wacom_features *)id->driver_data); 1550 *((struct wacom_features *)id->driver_data);
1549 wacom_wac1->features.device_type |= WACOM_DEVICETYPE_PEN; 1551 wacom_wac1->features.device_type |= WACOM_DEVICETYPE_PEN;
1550 if (wacom_wac1->features.type != INTUOSHT &&
1551 wacom_wac1->features.type != BAMBOO_PT)
1552 wacom_wac1->features.device_type |= WACOM_DEVICETYPE_PAD;
1553 wacom_set_default_phy(&wacom_wac1->features); 1552 wacom_set_default_phy(&wacom_wac1->features);
1554 wacom_calculate_res(&wacom_wac1->features); 1553 wacom_calculate_res(&wacom_wac1->features);
1555 snprintf(wacom_wac1->pen_name, WACOM_NAME_MAX, "%s (WL) Pen", 1554 snprintf(wacom_wac1->pen_name, WACOM_NAME_MAX, "%s (WL) Pen",
1556 wacom_wac1->features.name); 1555 wacom_wac1->features.name);
1557 snprintf(wacom_wac1->pad_name, WACOM_NAME_MAX, "%s (WL) Pad", 1556 if (wacom_wac1->features.type < BAMBOO_PEN ||
1558 wacom_wac1->features.name); 1557 wacom_wac1->features.type > BAMBOO_PT) {
1558 snprintf(wacom_wac1->pad_name, WACOM_NAME_MAX, "%s (WL) Pad",
1559 wacom_wac1->features.name);
1560 wacom_wac1->features.device_type |= WACOM_DEVICETYPE_PAD;
1561 }
1559 wacom_wac1->shared->touch_max = wacom_wac1->features.touch_max; 1562 wacom_wac1->shared->touch_max = wacom_wac1->features.touch_max;
1560 wacom_wac1->shared->type = wacom_wac1->features.type; 1563 wacom_wac1->shared->type = wacom_wac1->features.type;
1561 wacom_wac1->pid = wacom_wac->pid; 1564 wacom_wac1->pid = wacom_wac->pid;
@@ -1575,13 +1578,14 @@ static void wacom_wireless_work(struct work_struct *work)
1575 wacom_calculate_res(&wacom_wac2->features); 1578 wacom_calculate_res(&wacom_wac2->features);
1576 snprintf(wacom_wac2->touch_name, WACOM_NAME_MAX, 1579 snprintf(wacom_wac2->touch_name, WACOM_NAME_MAX,
1577 "%s (WL) Finger",wacom_wac2->features.name); 1580 "%s (WL) Finger",wacom_wac2->features.name);
1578 snprintf(wacom_wac2->pad_name, WACOM_NAME_MAX,
1579 "%s (WL) Pad",wacom_wac2->features.name);
1580 if (wacom_wac1->features.touch_max) 1581 if (wacom_wac1->features.touch_max)
1581 wacom_wac2->features.device_type |= WACOM_DEVICETYPE_TOUCH; 1582 wacom_wac2->features.device_type |= WACOM_DEVICETYPE_TOUCH;
1582 if (wacom_wac1->features.type == INTUOSHT || 1583 if (wacom_wac1->features.type >= INTUOSHT &&
1583 wacom_wac1->features.type == BAMBOO_PT) 1584 wacom_wac1->features.type <= BAMBOO_PT) {
1585 snprintf(wacom_wac2->pad_name, WACOM_NAME_MAX,
1586 "%s (WL) Pad",wacom_wac2->features.name);
1584 wacom_wac2->features.device_type |= WACOM_DEVICETYPE_PAD; 1587 wacom_wac2->features.device_type |= WACOM_DEVICETYPE_PAD;
1588 }
1585 wacom_wac2->pid = wacom_wac->pid; 1589 wacom_wac2->pid = wacom_wac->pid;
1586 error = wacom_allocate_inputs(wacom2) || 1590 error = wacom_allocate_inputs(wacom2) ||
1587 wacom_register_inputs(wacom2); 1591 wacom_register_inputs(wacom2);
@@ -1772,6 +1776,24 @@ static int wacom_probe(struct hid_device *hdev,
1772 features->device_type |= WACOM_DEVICETYPE_PEN; 1776 features->device_type |= WACOM_DEVICETYPE_PEN;
1773 } 1777 }
1774 1778
1779 /* Note that if query fails it is not a hard failure */
1780 wacom_query_tablet_data(hdev, features);
1781
1782 /* touch only Bamboo doesn't support pen */
1783 if ((features->type == BAMBOO_TOUCH) &&
1784 (features->device_type & WACOM_DEVICETYPE_PEN)) {
1785 error = -ENODEV;
1786 goto fail_shared_data;
1787 }
1788
1789 /* pen only Bamboo neither support touch nor pad */
1790 if ((features->type == BAMBOO_PEN) &&
1791 ((features->device_type & WACOM_DEVICETYPE_TOUCH) ||
1792 (features->device_type & WACOM_DEVICETYPE_PAD))) {
1793 error = -ENODEV;
1794 goto fail_shared_data;
1795 }
1796
1775 wacom_calculate_res(features); 1797 wacom_calculate_res(features);
1776 1798
1777 wacom_update_name(wacom); 1799 wacom_update_name(wacom);
@@ -1809,9 +1831,6 @@ static int wacom_probe(struct hid_device *hdev,
1809 goto fail_hw_start; 1831 goto fail_hw_start;
1810 } 1832 }
1811 1833
1812 /* Note that if query fails it is not a hard failure */
1813 wacom_query_tablet_data(hdev, features);
1814
1815 if (features->device_type & WACOM_DEVICETYPE_WL_MONITOR) 1834 if (features->device_type & WACOM_DEVICETYPE_WL_MONITOR)
1816 error = hid_hw_open(hdev); 1835 error = hid_hw_open(hdev);
1817 1836
diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c
index 0215ab62bb93..af734efe3d60 100644
--- a/drivers/hid/wacom_wac.c
+++ b/drivers/hid/wacom_wac.c
@@ -2300,6 +2300,8 @@ void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len)
2300 break; 2300 break;
2301 2301
2302 case BAMBOO_PT: 2302 case BAMBOO_PT:
2303 case BAMBOO_PEN:
2304 case BAMBOO_TOUCH:
2303 case INTUOSHT: 2305 case INTUOSHT:
2304 if (wacom_wac->data[0] == WACOM_REPORT_USB) 2306 if (wacom_wac->data[0] == WACOM_REPORT_USB)
2305 sync = wacom_status_irq(wacom_wac, len); 2307 sync = wacom_status_irq(wacom_wac, len);
@@ -2387,9 +2389,8 @@ void wacom_setup_device_quirks(struct wacom *wacom)
2387 2389
2388 /* The pen and pad share the same interface on most devices */ 2390 /* The pen and pad share the same interface on most devices */
2389 if (features->type == GRAPHIRE_BT || features->type == WACOM_G4 || 2391 if (features->type == GRAPHIRE_BT || features->type == WACOM_G4 ||
2390 features->type == DTUS || features->type == WACOM_MO || 2392 features->type == DTUS ||
2391 (features->type >= INTUOS3S && features->type <= WACOM_13HD && 2393 (features->type >= INTUOS3S && features->type <= WACOM_MO)) {
2392 features->type != INTUOSHT)) {
2393 if (features->device_type & WACOM_DEVICETYPE_PEN) 2394 if (features->device_type & WACOM_DEVICETYPE_PEN)
2394 features->device_type |= WACOM_DEVICETYPE_PAD; 2395 features->device_type |= WACOM_DEVICETYPE_PAD;
2395 } 2396 }
@@ -2406,12 +2407,12 @@ void wacom_setup_device_quirks(struct wacom *wacom)
2406 * interface (PacketSize of WACOM_PKGLEN_BBTOUCH3), override the 2407 * interface (PacketSize of WACOM_PKGLEN_BBTOUCH3), override the
2407 * tablet values. 2408 * tablet values.
2408 */ 2409 */
2409 if ((features->type >= INTUOS5S && features->type <= INTUOSHT) || 2410 if ((features->type >= INTUOS5S && features->type <= INTUOSPL) ||
2410 (features->type == BAMBOO_PT)) { 2411 (features->type >= INTUOSHT && features->type <= BAMBOO_PT)) {
2411 if (features->pktlen == WACOM_PKGLEN_BBTOUCH3) { 2412 if (features->pktlen == WACOM_PKGLEN_BBTOUCH3) {
2412 if (features->touch_max) 2413 if (features->touch_max)
2413 features->device_type |= WACOM_DEVICETYPE_TOUCH; 2414 features->device_type |= WACOM_DEVICETYPE_TOUCH;
2414 if (features->type == BAMBOO_PT || features->type == INTUOSHT) 2415 if (features->type >= INTUOSHT || features->type <= BAMBOO_PT)
2415 features->device_type |= WACOM_DEVICETYPE_PAD; 2416 features->device_type |= WACOM_DEVICETYPE_PAD;
2416 2417
2417 features->x_max = 4096; 2418 features->x_max = 4096;
@@ -2598,6 +2599,7 @@ int wacom_setup_pen_input_capabilities(struct input_dev *input_dev,
2598 2599
2599 case INTUOSHT: 2600 case INTUOSHT:
2600 case BAMBOO_PT: 2601 case BAMBOO_PT:
2602 case BAMBOO_PEN:
2601 __clear_bit(ABS_MISC, input_dev->absbit); 2603 __clear_bit(ABS_MISC, input_dev->absbit);
2602 2604
2603 __set_bit(INPUT_PROP_POINTER, input_dev->propbit); 2605 __set_bit(INPUT_PROP_POINTER, input_dev->propbit);
@@ -2693,6 +2695,7 @@ int wacom_setup_touch_input_capabilities(struct input_dev *input_dev,
2693 /* fall through */ 2695 /* fall through */
2694 2696
2695 case BAMBOO_PT: 2697 case BAMBOO_PT:
2698 case BAMBOO_TOUCH:
2696 if (features->pktlen == WACOM_PKGLEN_BBTOUCH3) { 2699 if (features->pktlen == WACOM_PKGLEN_BBTOUCH3) {
2697 input_set_abs_params(input_dev, 2700 input_set_abs_params(input_dev,
2698 ABS_MT_TOUCH_MAJOR, 2701 ABS_MT_TOUCH_MAJOR,
@@ -2845,6 +2848,7 @@ int wacom_setup_pad_input_capabilities(struct input_dev *input_dev,
2845 2848
2846 case INTUOSHT: 2849 case INTUOSHT:
2847 case BAMBOO_PT: 2850 case BAMBOO_PT:
2851 case BAMBOO_TOUCH:
2848 __clear_bit(ABS_MISC, input_dev->absbit); 2852 __clear_bit(ABS_MISC, input_dev->absbit);
2849 2853
2850 __set_bit(BTN_LEFT, input_dev->keybit); 2854 __set_bit(BTN_LEFT, input_dev->keybit);
@@ -3235,11 +3239,10 @@ static const struct wacom_features wacom_features_0x47 =
3235 { "Wacom Intuos2 6x8", 20320, 16240, 1023, 31, 3239 { "Wacom Intuos2 6x8", 20320, 16240, 1023, 31,
3236 INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; 3240 INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
3237static const struct wacom_features wacom_features_0x84 = 3241static const struct wacom_features wacom_features_0x84 =
3238 { "Wacom Wireless Receiver", 0, 0, 0, 0, 3242 { "Wacom Wireless Receiver", .type = WIRELESS, .touch_max = 16 };
3239 WIRELESS, 0, 0, .touch_max = 16 };
3240static const struct wacom_features wacom_features_0xD0 = 3243static const struct wacom_features wacom_features_0xD0 =
3241 { "Wacom Bamboo 2FG", 14720, 9200, 1023, 31, 3244 { "Wacom Bamboo 2FG", 14720, 9200, 1023, 31,
3242 BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 2 }; 3245 BAMBOO_TOUCH, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 2 };
3243static const struct wacom_features wacom_features_0xD1 = 3246static const struct wacom_features wacom_features_0xD1 =
3244 { "Wacom Bamboo 2FG 4x5", 14720, 9200, 1023, 31, 3247 { "Wacom Bamboo 2FG 4x5", 14720, 9200, 1023, 31,
3245 BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 2 }; 3248 BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 2 };
@@ -3251,10 +3254,10 @@ static const struct wacom_features wacom_features_0xD3 =
3251 BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 2 }; 3254 BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 2 };
3252static const struct wacom_features wacom_features_0xD4 = 3255static const struct wacom_features wacom_features_0xD4 =
3253 { "Wacom Bamboo Pen", 14720, 9200, 1023, 31, 3256 { "Wacom Bamboo Pen", 14720, 9200, 1023, 31,
3254 BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; 3257 BAMBOO_PEN, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
3255static const struct wacom_features wacom_features_0xD5 = 3258static const struct wacom_features wacom_features_0xD5 =
3256 { "Wacom Bamboo Pen 6x8", 21648, 13700, 1023, 31, 3259 { "Wacom Bamboo Pen 6x8", 21648, 13700, 1023, 31,
3257 BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; 3260 BAMBOO_PEN, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
3258static const struct wacom_features wacom_features_0xD6 = 3261static const struct wacom_features wacom_features_0xD6 =
3259 { "Wacom BambooPT 2FG 4x5", 14720, 9200, 1023, 31, 3262 { "Wacom BambooPT 2FG 4x5", 14720, 9200, 1023, 31,
3260 BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 2 }; 3263 BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 2 };
@@ -3281,7 +3284,7 @@ static const struct wacom_features wacom_features_0xDF =
3281 BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 16 }; 3284 BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 16 };
3282static const struct wacom_features wacom_features_0x300 = 3285static const struct wacom_features wacom_features_0x300 =
3283 { "Wacom Bamboo One S", 14720, 9225, 1023, 31, 3286 { "Wacom Bamboo One S", 14720, 9225, 1023, 31,
3284 BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; 3287 BAMBOO_PEN, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
3285static const struct wacom_features wacom_features_0x301 = 3288static const struct wacom_features wacom_features_0x301 =
3286 { "Wacom Bamboo One M", 21648, 13530, 1023, 31, 3289 { "Wacom Bamboo One M", 21648, 13530, 1023, 31,
3287 BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; 3290 BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
@@ -3329,8 +3332,8 @@ static const struct wacom_features wacom_features_0x323 =
3329 INTUOSHT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, 3332 INTUOSHT, WACOM_INTUOS_RES, WACOM_INTUOS_RES,
3330 .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE }; 3333 .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE };
3331static const struct wacom_features wacom_features_0x331 = 3334static const struct wacom_features wacom_features_0x331 =
3332 { "Wacom Express Key Remote", 0, 0, 0, 0, 3335 { "Wacom Express Key Remote", .type = REMOTE,
3333 REMOTE, 0, 0, 18, .check_for_hid_type = true, 3336 .numbered_buttons = 18, .check_for_hid_type = true,
3334 .hid_type = HID_TYPE_USBNONE }; 3337 .hid_type = HID_TYPE_USBNONE };
3335 3338
3336static const struct wacom_features wacom_features_HID_ANY_ID = 3339static const struct wacom_features wacom_features_HID_ANY_ID =
diff --git a/drivers/hid/wacom_wac.h b/drivers/hid/wacom_wac.h
index 1e270d401e18..3f2452029d2b 100644
--- a/drivers/hid/wacom_wac.h
+++ b/drivers/hid/wacom_wac.h
@@ -117,7 +117,6 @@ enum {
117 INTUOSPS, 117 INTUOSPS,
118 INTUOSPM, 118 INTUOSPM,
119 INTUOSPL, 119 INTUOSPL,
120 INTUOSHT,
121 WACOM_21UX2, 120 WACOM_21UX2,
122 WACOM_22HD, 121 WACOM_22HD,
123 DTK, 122 DTK,
@@ -129,6 +128,9 @@ enum {
129 WACOM_13HD, 128 WACOM_13HD,
130 WACOM_MO, 129 WACOM_MO,
131 WIRELESS, 130 WIRELESS,
131 BAMBOO_PEN,
132 INTUOSHT,
133 BAMBOO_TOUCH,
132 BAMBOO_PT, 134 BAMBOO_PT,
133 WACOM_24HDT, 135 WACOM_24HDT,
134 WACOM_27QHDT, 136 WACOM_27QHDT,