diff mbox

HID: wacom: don't apply generic settings to old devices

Message ID 1485819649-8057-1-git-send-email-pingc@wacom.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ping Cheng Jan. 30, 2017, 11:40 p.m. UTC
Non-generic devices have numbered_buttons set for both pen and
touch interfaces by default. The actual number of buttons on the
interface is normally manually decided later, which is different
from what those HID generic devices are processed, where number
of buttons are directly retrieved from HID descriptors.

This patch adds the missed HID_GENERIC check and moves the statement
to wacom_setup_pad_input_capabilities since it's not a quirk anymore.

Signed-off-by: Ping Cheng <ping.cheng@wacom.com>
---
 drivers/hid/wacom_wac.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Gerecke, Jason Feb. 1, 2017, 6:15 p.m. UTC | #1
Looks good to me!

Reviewed-by: Jason Gerecke <jason.gerecke@wacom.com>

Jason
---
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....


On Mon, Jan 30, 2017 at 3:40 PM, Ping Cheng <pinglinux@gmail.com> wrote:
> Non-generic devices have numbered_buttons set for both pen and
> touch interfaces by default. The actual number of buttons on the
> interface is normally manually decided later, which is different
> from what those HID generic devices are processed, where number
> of buttons are directly retrieved from HID descriptors.
>
> This patch adds the missed HID_GENERIC check and moves the statement
> to wacom_setup_pad_input_capabilities since it's not a quirk anymore.
>
> Signed-off-by: Ping Cheng <ping.cheng@wacom.com>
> ---
>  drivers/hid/wacom_wac.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c
> index 0884dc9..6477fcd 100644
> --- a/drivers/hid/wacom_wac.c
> +++ b/drivers/hid/wacom_wac.c
> @@ -2777,8 +2777,6 @@ void wacom_setup_device_quirks(struct wacom *wacom)
>         struct wacom_features *features = &wacom->wacom_wac.features;
>
>         /* The pen and pad share the same interface on most devices */
> -       if (features->numbered_buttons > 0)
> -               features->device_type |= WACOM_DEVICETYPE_PAD;
>         if (features->type == GRAPHIRE_BT || features->type == WACOM_G4 ||
>             features->type == DTUS ||
>             (features->type >= INTUOS3S && features->type <= WACOM_MO)) {
> @@ -3288,6 +3286,9 @@ int wacom_setup_pad_input_capabilities(struct input_dev *input_dev,
>  {
>         struct wacom_features *features = &wacom_wac->features;
>
> +       if ((features->type == HID_GENERIC) && features->numbered_buttons > 0)
> +               features->device_type |= WACOM_DEVICETYPE_PAD;
> +
>         if (!(features->device_type & WACOM_DEVICETYPE_PAD))
>                 return -ENODEV;
>
> --
> 2.7.4
>
--
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
Jiri Kosina Feb. 3, 2017, 1:44 p.m. UTC | #2
On Mon, 30 Jan 2017, Ping Cheng wrote:

> Non-generic devices have numbered_buttons set for both pen and
> touch interfaces by default. The actual number of buttons on the
> interface is normally manually decided later, which is different
> from what those HID generic devices are processed, where number
> of buttons are directly retrieved from HID descriptors.
> 
> This patch adds the missed HID_GENERIC check and moves the statement
> to wacom_setup_pad_input_capabilities since it's not a quirk anymore.

Applied to for-4.11/wacom.
diff mbox

Patch

diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c
index 0884dc9..6477fcd 100644
--- a/drivers/hid/wacom_wac.c
+++ b/drivers/hid/wacom_wac.c
@@ -2777,8 +2777,6 @@  void wacom_setup_device_quirks(struct wacom *wacom)
 	struct wacom_features *features = &wacom->wacom_wac.features;
 
 	/* The pen and pad share the same interface on most devices */
-	if (features->numbered_buttons > 0)
-		features->device_type |= WACOM_DEVICETYPE_PAD;
 	if (features->type == GRAPHIRE_BT || features->type == WACOM_G4 ||
 	    features->type == DTUS ||
 	    (features->type >= INTUOS3S && features->type <= WACOM_MO)) {
@@ -3288,6 +3286,9 @@  int wacom_setup_pad_input_capabilities(struct input_dev *input_dev,
 {
 	struct wacom_features *features = &wacom_wac->features;
 
+	if ((features->type == HID_GENERIC) && features->numbered_buttons > 0)
+		features->device_type |= WACOM_DEVICETYPE_PAD;
+
 	if (!(features->device_type & WACOM_DEVICETYPE_PAD))
 		return -ENODEV;