* [PATCH 1/3] HID: wacom: remove hardcoded WACOM_QUIRK_MULTI_INPUT
@ 2015-03-20 21:57 Ping Cheng
2015-04-01 18:59 ` Jason Gerecke
0 siblings, 1 reply; 2+ messages in thread
From: Ping Cheng @ 2015-03-20 21:57 UTC (permalink / raw)
To: benjamin.tissoires, jkosina; +Cc: linux-input, Ping Cheng
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>
---
drivers/hid/wacom_sys.c | 24 +++++++++++-------------
drivers/hid/wacom_wac.c | 18 ++++--------------
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 f0568a7..a99e66f 100644
--- a/drivers/hid/wacom_sys.c
+++ b/drivers/hid/wacom_sys.c
@@ -1462,19 +1462,17 @@ static int wacom_probe(struct hid_device *hdev,
snprintf(wacom_wac->pad_name, sizeof(wacom_wac->pad_name),
"%s Pad", features->name);
- if (features->quirks & WACOM_QUIRK_MULTI_INPUT) {
- /* Append the device type to the name */
- if (features->device_type != BTN_TOOL_FINGER)
- strlcat(wacom_wac->name, " Pen", WACOM_NAME_MAX);
- else if (features->touch_max)
- strlcat(wacom_wac->name, " Finger", WACOM_NAME_MAX);
- else
- strlcat(wacom_wac->name, " Pad", WACOM_NAME_MAX);
-
- error = wacom_add_shared_data(hdev);
- if (error)
- goto fail_shared_data;
- }
+ /* Append the device type to the name */
+ if (features->device_type != BTN_TOOL_FINGER)
+ strlcat(wacom_wac->name, " Pen", WACOM_NAME_MAX);
+ else if (features->touch_max)
+ strlcat(wacom_wac->name, " Finger", WACOM_NAME_MAX);
+ else
+ strlcat(wacom_wac->name, " Pad", WACOM_NAME_MAX);
+
+ error = wacom_add_shared_data(hdev);
+ if (error)
+ goto fail_shared_data;
if (!(features->quirks & WACOM_QUIRK_MONITOR) &&
(features->quirks & WACOM_QUIRK_BATTERY)) {
diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c
index bbe32d6..3b01dc9 100644
--- a/drivers/hid/wacom_wac.c
+++ b/drivers/hid/wacom_wac.c
@@ -551,12 +551,9 @@ static int wacom_intuos_inout(struct wacom_wac *wacom)
(features->type == CINTIQ && !(data[1] & 0x40)))
return 1;
- if (wacom->shared) {
- wacom->shared->stylus_in_proximity = true;
-
- if (wacom->shared->touch_down)
- return 1;
- }
+ wacom->shared->stylus_in_proximity = true;
+ if (wacom->shared->touch_down)
+ return 1;
/* in Range while exiting */
if (((data[1] & 0xfe) == 0x20) && wacom->reporting_data) {
@@ -568,8 +565,7 @@ static int wacom_intuos_inout(struct wacom_wac *wacom)
/* Exit report */
if ((data[1] & 0xfe) == 0x80) {
- if (features->quirks & WACOM_QUIRK_MULTI_INPUT)
- wacom->shared->stylus_in_proximity = false;
+ wacom->shared->stylus_in_proximity = false;
wacom->reporting_data = false;
/* don't report exit if we don't know the ID */
@@ -2054,12 +2050,6 @@ void wacom_setup_device_quirks(struct wacom_features *features)
features->y_max = 1023;
}
- /* these device have multiple inputs */
- if (features->type >= WIRELESS ||
- (features->type >= INTUOS5S && features->type <= INTUOSHT) ||
- (features->oVid && features->oPid))
- features->quirks |= WACOM_QUIRK_MULTI_INPUT;
-
/* quirk for bamboo touch with 2 low res touches */
if (features->type == BAMBOO_PT &&
features->pktlen == WACOM_PKGLEN_BBTOUCH) {
diff --git a/drivers/hid/wacom_wac.h b/drivers/hid/wacom_wac.h
index 021ee1c..309f219 100644
--- a/drivers/hid/wacom_wac.h
+++ b/drivers/hid/wacom_wac.h
@@ -69,11 +69,10 @@
#define WACOM_REPORT_USB 192
/* device quirks */
-#define WACOM_QUIRK_MULTI_INPUT 0x0001
-#define WACOM_QUIRK_BBTOUCH_LOWRES 0x0002
-#define WACOM_QUIRK_NO_INPUT 0x0004
-#define WACOM_QUIRK_MONITOR 0x0008
-#define WACOM_QUIRK_BATTERY 0x0010
+#define WACOM_QUIRK_BBTOUCH_LOWRES 0x0001
+#define WACOM_QUIRK_NO_INPUT 0x0002
+#define WACOM_QUIRK_MONITOR 0x0004
+#define WACOM_QUIRK_BATTERY 0x0008
#define WACOM_PEN_FIELD(f) (((f)->logical == HID_DG_STYLUS) || \
((f)->physical == HID_DG_STYLUS) || \
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 1/3] HID: wacom: remove hardcoded WACOM_QUIRK_MULTI_INPUT
2015-03-20 21:57 [PATCH 1/3] HID: wacom: remove hardcoded WACOM_QUIRK_MULTI_INPUT Ping Cheng
@ 2015-04-01 18:59 ` Jason Gerecke
0 siblings, 0 replies; 2+ messages in thread
From: Jason Gerecke @ 2015-04-01 18:59 UTC (permalink / raw)
To: Ping Cheng, benjamin.tissoires, jkosina; +Cc: linux-input, Ping Cheng
On 3/20/2015 2:57 PM, Ping Cheng wrote:
> 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>
---
Now instead of four in the eights place /
you’ve got three, ‘Cause you added one /
(That is to say, eight) to the two, /
But you can’t take seven from three, /
So you look at the sixty-fours....
> ---
> drivers/hid/wacom_sys.c | 24 +++++++++++-------------
> drivers/hid/wacom_wac.c | 18 ++++--------------
> 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 f0568a7..a99e66f 100644
> --- a/drivers/hid/wacom_sys.c
> +++ b/drivers/hid/wacom_sys.c
> @@ -1462,19 +1462,17 @@ static int wacom_probe(struct hid_device *hdev,
> snprintf(wacom_wac->pad_name, sizeof(wacom_wac->pad_name),
> "%s Pad", features->name);
>
> - if (features->quirks & WACOM_QUIRK_MULTI_INPUT) {
> - /* Append the device type to the name */
> - if (features->device_type != BTN_TOOL_FINGER)
> - strlcat(wacom_wac->name, " Pen", WACOM_NAME_MAX);
> - else if (features->touch_max)
> - strlcat(wacom_wac->name, " Finger", WACOM_NAME_MAX);
> - else
> - strlcat(wacom_wac->name, " Pad", WACOM_NAME_MAX);
> -
> - error = wacom_add_shared_data(hdev);
> - if (error)
> - goto fail_shared_data;
> - }
> + /* Append the device type to the name */
> + if (features->device_type != BTN_TOOL_FINGER)
> + strlcat(wacom_wac->name, " Pen", WACOM_NAME_MAX);
> + else if (features->touch_max)
> + strlcat(wacom_wac->name, " Finger", WACOM_NAME_MAX);
> + else
> + strlcat(wacom_wac->name, " Pad", WACOM_NAME_MAX);
> +
> + error = wacom_add_shared_data(hdev);
> + if (error)
> + goto fail_shared_data;
>
> if (!(features->quirks & WACOM_QUIRK_MONITOR) &&
> (features->quirks & WACOM_QUIRK_BATTERY)) {
> diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c
> index bbe32d6..3b01dc9 100644
> --- a/drivers/hid/wacom_wac.c
> +++ b/drivers/hid/wacom_wac.c
> @@ -551,12 +551,9 @@ static int wacom_intuos_inout(struct wacom_wac *wacom)
> (features->type == CINTIQ && !(data[1] & 0x40)))
> return 1;
>
> - if (wacom->shared) {
> - wacom->shared->stylus_in_proximity = true;
> -
> - if (wacom->shared->touch_down)
> - return 1;
> - }
> + wacom->shared->stylus_in_proximity = true;
> + if (wacom->shared->touch_down)
> + return 1;
>
> /* in Range while exiting */
> if (((data[1] & 0xfe) == 0x20) && wacom->reporting_data) {
> @@ -568,8 +565,7 @@ static int wacom_intuos_inout(struct wacom_wac *wacom)
>
> /* Exit report */
> if ((data[1] & 0xfe) == 0x80) {
> - if (features->quirks & WACOM_QUIRK_MULTI_INPUT)
> - wacom->shared->stylus_in_proximity = false;
> + wacom->shared->stylus_in_proximity = false;
> wacom->reporting_data = false;
>
> /* don't report exit if we don't know the ID */
> @@ -2054,12 +2050,6 @@ void wacom_setup_device_quirks(struct wacom_features *features)
> features->y_max = 1023;
> }
>
> - /* these device have multiple inputs */
> - if (features->type >= WIRELESS ||
> - (features->type >= INTUOS5S && features->type <= INTUOSHT) ||
> - (features->oVid && features->oPid))
> - features->quirks |= WACOM_QUIRK_MULTI_INPUT;
> -
> /* quirk for bamboo touch with 2 low res touches */
> if (features->type == BAMBOO_PT &&
> features->pktlen == WACOM_PKGLEN_BBTOUCH) {
> diff --git a/drivers/hid/wacom_wac.h b/drivers/hid/wacom_wac.h
> index 021ee1c..309f219 100644
> --- a/drivers/hid/wacom_wac.h
> +++ b/drivers/hid/wacom_wac.h
> @@ -69,11 +69,10 @@
> #define WACOM_REPORT_USB 192
>
> /* device quirks */
> -#define WACOM_QUIRK_MULTI_INPUT 0x0001
> -#define WACOM_QUIRK_BBTOUCH_LOWRES 0x0002
> -#define WACOM_QUIRK_NO_INPUT 0x0004
> -#define WACOM_QUIRK_MONITOR 0x0008
> -#define WACOM_QUIRK_BATTERY 0x0010
> +#define WACOM_QUIRK_BBTOUCH_LOWRES 0x0001
> +#define WACOM_QUIRK_NO_INPUT 0x0002
> +#define WACOM_QUIRK_MONITOR 0x0004
> +#define WACOM_QUIRK_BATTERY 0x0008
>
> #define WACOM_PEN_FIELD(f) (((f)->logical == HID_DG_STYLUS) || \
> ((f)->physical == HID_DG_STYLUS) || \
>
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-04-01 18:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-20 21:57 [PATCH 1/3] HID: wacom: remove hardcoded WACOM_QUIRK_MULTI_INPUT Ping Cheng
2015-04-01 18:59 ` Jason Gerecke
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).