diff options
author | Ping Cheng <pinglinux@gmail.com> | 2015-03-20 17:57:00 -0400 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2015-04-02 08:09:59 -0400 |
commit | f3586d2f819af6dbe5b08d2a6f1d22b1a97e2b64 (patch) | |
tree | e5885fca2b4aabb63e604bf9109a899155f6cb44 /drivers/hid | |
parent | 1fd29be5cede285e673d3ed73d9ed9db59536b33 (diff) |
HID: wacom: remove hardcoded WACOM_QUIRK_MULTI_INPUT
The quirk was added for devices that support both pen and touch. It decides if
a device supports multiple inputs by hardcoded feature type. However, for some
devices, we do not know if they support both before accessing their HID
descriptors.
This patch relies on dynamically assigned device_type to make the decision.
Also, we make it certain that wacom_wac->shared is always created. That is, the
driver will not be loaded if it fails to create wacom_wac->shared.
Signed-off-by: Ping Cheng <pingc@wacom.com>
Reviewed-by: Jason Gerecke <jason.gerecke@wacom.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid')
-rw-r--r-- | drivers/hid/wacom_sys.c | 24 | ||||
-rw-r--r-- | drivers/hid/wacom_wac.c | 18 | ||||
-rw-r--r-- | drivers/hid/wacom_wac.h | 9 |
3 files changed, 19 insertions, 32 deletions
diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c index 353fe476be26..1b00d8d4466c 100644 --- a/drivers/hid/wacom_sys.c +++ b/drivers/hid/wacom_sys.c | |||
@@ -1521,19 +1521,17 @@ static int wacom_probe(struct hid_device *hdev, | |||
1521 | snprintf(wacom_wac->pad_name, sizeof(wacom_wac->pad_name), | 1521 | snprintf(wacom_wac->pad_name, sizeof(wacom_wac->pad_name), |
1522 | "%s Pad", features->name); | 1522 | "%s Pad", features->name); |
1523 | 1523 | ||
1524 | if (features->quirks & WACOM_QUIRK_MULTI_INPUT) { | 1524 | /* Append the device type to the name */ |
1525 | /* Append the device type to the name */ | 1525 | if (features->device_type != BTN_TOOL_FINGER) |
1526 | if (features->device_type != BTN_TOOL_FINGER) | 1526 | strlcat(wacom_wac->name, " Pen", WACOM_NAME_MAX); |
1527 | strlcat(wacom_wac->name, " Pen", WACOM_NAME_MAX); | 1527 | else if (features->touch_max) |
1528 | else if (features->touch_max) | 1528 | strlcat(wacom_wac->name, " Finger", WACOM_NAME_MAX); |
1529 | strlcat(wacom_wac->name, " Finger", WACOM_NAME_MAX); | 1529 | else |
1530 | else | 1530 | strlcat(wacom_wac->name, " Pad", WACOM_NAME_MAX); |
1531 | strlcat(wacom_wac->name, " Pad", WACOM_NAME_MAX); | 1531 | |
1532 | 1532 | error = wacom_add_shared_data(hdev); | |
1533 | error = wacom_add_shared_data(hdev); | 1533 | if (error) |
1534 | if (error) | 1534 | goto fail_shared_data; |
1535 | goto fail_shared_data; | ||
1536 | } | ||
1537 | 1535 | ||
1538 | if (!(features->quirks & WACOM_QUIRK_MONITOR) && | 1536 | if (!(features->quirks & WACOM_QUIRK_MONITOR) && |
1539 | (features->quirks & WACOM_QUIRK_BATTERY)) { | 1537 | (features->quirks & WACOM_QUIRK_BATTERY)) { |
diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c index fa0578ecd7a1..221443710aed 100644 --- a/drivers/hid/wacom_wac.c +++ b/drivers/hid/wacom_wac.c | |||
@@ -581,12 +581,9 @@ static int wacom_intuos_inout(struct wacom_wac *wacom) | |||
581 | (features->type == CINTIQ && !(data[1] & 0x40))) | 581 | (features->type == CINTIQ && !(data[1] & 0x40))) |
582 | return 1; | 582 | return 1; |
583 | 583 | ||
584 | if (wacom->shared) { | 584 | wacom->shared->stylus_in_proximity = true; |
585 | wacom->shared->stylus_in_proximity = true; | 585 | if (wacom->shared->touch_down) |
586 | 586 | return 1; | |
587 | if (wacom->shared->touch_down) | ||
588 | return 1; | ||
589 | } | ||
590 | 587 | ||
591 | /* in Range while exiting */ | 588 | /* in Range while exiting */ |
592 | if (((data[1] & 0xfe) == 0x20) && wacom->reporting_data) { | 589 | if (((data[1] & 0xfe) == 0x20) && wacom->reporting_data) { |
@@ -598,8 +595,7 @@ static int wacom_intuos_inout(struct wacom_wac *wacom) | |||
598 | 595 | ||
599 | /* Exit report */ | 596 | /* Exit report */ |
600 | if ((data[1] & 0xfe) == 0x80) { | 597 | if ((data[1] & 0xfe) == 0x80) { |
601 | if (features->quirks & WACOM_QUIRK_MULTI_INPUT) | 598 | wacom->shared->stylus_in_proximity = false; |
602 | wacom->shared->stylus_in_proximity = false; | ||
603 | wacom->reporting_data = false; | 599 | wacom->reporting_data = false; |
604 | 600 | ||
605 | /* don't report exit if we don't know the ID */ | 601 | /* don't report exit if we don't know the ID */ |
@@ -2197,12 +2193,6 @@ void wacom_setup_device_quirks(struct wacom_features *features) | |||
2197 | features->y_max = 1023; | 2193 | features->y_max = 1023; |
2198 | } | 2194 | } |
2199 | 2195 | ||
2200 | /* these device have multiple inputs */ | ||
2201 | if (features->type >= WIRELESS || | ||
2202 | (features->type >= INTUOS5S && features->type <= INTUOSHT) || | ||
2203 | (features->oVid && features->oPid)) | ||
2204 | features->quirks |= WACOM_QUIRK_MULTI_INPUT; | ||
2205 | |||
2206 | /* quirk for bamboo touch with 2 low res touches */ | 2196 | /* quirk for bamboo touch with 2 low res touches */ |
2207 | if (features->type == BAMBOO_PT && | 2197 | if (features->type == BAMBOO_PT && |
2208 | features->pktlen == WACOM_PKGLEN_BBTOUCH) { | 2198 | features->pktlen == WACOM_PKGLEN_BBTOUCH) { |
diff --git a/drivers/hid/wacom_wac.h b/drivers/hid/wacom_wac.h index 1c7d8931f1fa..4700ac994a3b 100644 --- a/drivers/hid/wacom_wac.h +++ b/drivers/hid/wacom_wac.h | |||
@@ -73,11 +73,10 @@ | |||
73 | #define WACOM_REPORT_BPAD_TOUCH 16 | 73 | #define WACOM_REPORT_BPAD_TOUCH 16 |
74 | 74 | ||
75 | /* device quirks */ | 75 | /* device quirks */ |
76 | #define WACOM_QUIRK_MULTI_INPUT 0x0001 | 76 | #define WACOM_QUIRK_BBTOUCH_LOWRES 0x0001 |
77 | #define WACOM_QUIRK_BBTOUCH_LOWRES 0x0002 | 77 | #define WACOM_QUIRK_NO_INPUT 0x0002 |
78 | #define WACOM_QUIRK_NO_INPUT 0x0004 | 78 | #define WACOM_QUIRK_MONITOR 0x0004 |
79 | #define WACOM_QUIRK_MONITOR 0x0008 | 79 | #define WACOM_QUIRK_BATTERY 0x0008 |
80 | #define WACOM_QUIRK_BATTERY 0x0010 | ||
81 | 80 | ||
82 | #define WACOM_PEN_FIELD(f) (((f)->logical == HID_DG_STYLUS) || \ | 81 | #define WACOM_PEN_FIELD(f) (((f)->logical == HID_DG_STYLUS) || \ |
83 | ((f)->physical == HID_DG_STYLUS) || \ | 82 | ((f)->physical == HID_DG_STYLUS) || \ |