linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] HID: wacom: Use calculated pkglen for wireless touch interface
@ 2015-08-03 17:17 Jason Gerecke
  2015-08-03 17:17 ` [PATCH 2/3] HID: wacom: Replace WACOM_QUIRK_MONITOR with WACOM_DEVICETYPE_WL_MONITOR Jason Gerecke
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Jason Gerecke @ 2015-08-03 17:17 UTC (permalink / raw)
  To: Jiri Kosina, Benjamin Tissoires
  Cc: Aaron Skomra, Ping Cheng, linux-input, Jason Gerecke,
	Jason Gerecke

Commit 01c846f introduced the 'wacom_compute_pktlen' function which
automatically determines the correct value for an interface's pkglen
by scanning the HID descriptor. This function returns the correct
value for the wireless receiver's touch interface, removing the need
for us to set it manually here.

Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
---
 drivers/hid/wacom_sys.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c
index d932349..a334332 100644
--- a/drivers/hid/wacom_sys.c
+++ b/drivers/hid/wacom_sys.c
@@ -457,7 +457,6 @@ static void wacom_retrieve_hid_descriptor(struct hid_device *hdev,
 			features->device_type = WACOM_DEVICETYPE_NONE;
 		} else if (intf->cur_altsetting->desc.bInterfaceNumber == 2) {
 			features->device_type |= WACOM_DEVICETYPE_TOUCH;
-			features->pktlen = WACOM_PKGLEN_BBTOUCH3;
 		}
 	}
 
-- 
2.4.6


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/3] HID: wacom: Replace WACOM_QUIRK_MONITOR with WACOM_DEVICETYPE_WL_MONITOR
  2015-08-03 17:17 [PATCH 1/3] HID: wacom: Use calculated pkglen for wireless touch interface Jason Gerecke
@ 2015-08-03 17:17 ` Jason Gerecke
  2015-08-03 17:17 ` [PATCH 3/3] HID: wacom: Remove WACOM_QUIRK_NO_INPUT Jason Gerecke
  2015-08-04 13:40 ` [PATCH 1/3] HID: wacom: Use calculated pkglen for wireless touch interface Jiri Kosina
  2 siblings, 0 replies; 5+ messages in thread
From: Jason Gerecke @ 2015-08-03 17:17 UTC (permalink / raw)
  To: Jiri Kosina, Benjamin Tissoires
  Cc: Aaron Skomra, Ping Cheng, linux-input, Jason Gerecke,
	Jason Gerecke

The monitor interface on the wireless receiver is more logically expressed
as a type of device instead of a quirk.

Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
---
 drivers/hid/wacom_sys.c | 6 +++---
 drivers/hid/wacom_wac.c | 4 +---
 drivers/hid/wacom_wac.h | 2 +-
 3 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c
index a334332..13834ba 100644
--- a/drivers/hid/wacom_sys.c
+++ b/drivers/hid/wacom_sys.c
@@ -454,7 +454,7 @@ static void wacom_retrieve_hid_descriptor(struct hid_device *hdev,
 	 */
 	if (features->type == WIRELESS) {
 		if (intf->cur_altsetting->desc.bInterfaceNumber == 0) {
-			features->device_type = WACOM_DEVICETYPE_NONE;
+			features->device_type = WACOM_DEVICETYPE_WL_MONITOR;
 		} else if (intf->cur_altsetting->desc.bInterfaceNumber == 2) {
 			features->device_type |= WACOM_DEVICETYPE_TOUCH;
 		}
@@ -1581,7 +1581,7 @@ static int wacom_probe(struct hid_device *hdev,
 	if (error)
 		goto fail_shared_data;
 
-	if (!(features->quirks & WACOM_QUIRK_MONITOR) &&
+	if (!(features->device_type & WACOM_DEVICETYPE_WL_MONITOR) &&
 	     (features->quirks & WACOM_QUIRK_BATTERY)) {
 		error = wacom_initialize_battery(wacom);
 		if (error)
@@ -1615,7 +1615,7 @@ static int wacom_probe(struct hid_device *hdev,
 	/* Note that if query fails it is not a hard failure */
 	wacom_query_tablet_data(hdev, features);
 
-	if (features->quirks & WACOM_QUIRK_MONITOR)
+	if (features->device_type & WACOM_DEVICETYPE_WL_MONITOR)
 		error = hid_hw_open(hdev);
 
 	if (wacom_wac->features.type == INTUOSHT && 
diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c
index 280deb2..82bb0d3 100644
--- a/drivers/hid/wacom_wac.c
+++ b/drivers/hid/wacom_wac.c
@@ -2330,9 +2330,7 @@ void wacom_setup_device_quirks(struct wacom *wacom)
 		/* monitor never has input and pen/touch have delayed create */
 		features->quirks |= WACOM_QUIRK_NO_INPUT;
 
-		/* must be monitor interface if no device_type set */
-		if (features->device_type == WACOM_DEVICETYPE_NONE) {
-			features->quirks |= WACOM_QUIRK_MONITOR;
+		if (features->device_type == WACOM_DEVICETYPE_WL_MONITOR) {
 			features->quirks |= WACOM_QUIRK_BATTERY;
 		}
 	}
diff --git a/drivers/hid/wacom_wac.h b/drivers/hid/wacom_wac.h
index c245a66..87df674 100644
--- a/drivers/hid/wacom_wac.h
+++ b/drivers/hid/wacom_wac.h
@@ -69,7 +69,6 @@
 /* device quirks */
 #define WACOM_QUIRK_BBTOUCH_LOWRES	0x0001
 #define WACOM_QUIRK_NO_INPUT		0x0002
-#define WACOM_QUIRK_MONITOR		0x0004
 #define WACOM_QUIRK_BATTERY		0x0008
 
 /* device types */
@@ -77,6 +76,7 @@
 #define WACOM_DEVICETYPE_PEN            0x0001
 #define WACOM_DEVICETYPE_TOUCH          0x0002
 #define WACOM_DEVICETYPE_PAD            0x0004
+#define WACOM_DEVICETYPE_WL_MONITOR     0x0008
 
 #define WACOM_VENDORDEFINED_PEN		0xff0d0001
 
-- 
2.4.6


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 3/3] HID: wacom: Remove WACOM_QUIRK_NO_INPUT
  2015-08-03 17:17 [PATCH 1/3] HID: wacom: Use calculated pkglen for wireless touch interface Jason Gerecke
  2015-08-03 17:17 ` [PATCH 2/3] HID: wacom: Replace WACOM_QUIRK_MONITOR with WACOM_DEVICETYPE_WL_MONITOR Jason Gerecke
@ 2015-08-03 17:17 ` Jason Gerecke
  2015-08-03 17:39   ` Benjamin Tissoires
  2015-08-04 13:40 ` [PATCH 1/3] HID: wacom: Use calculated pkglen for wireless touch interface Jiri Kosina
  2 siblings, 1 reply; 5+ messages in thread
From: Jason Gerecke @ 2015-08-03 17:17 UTC (permalink / raw)
  To: Jiri Kosina, Benjamin Tissoires
  Cc: Aaron Skomra, Ping Cheng, linux-input, Jason Gerecke,
	Jason Gerecke

WACOM_QUIRK_NO_INPUT is a signal to the driver that input devices
should not be created for a particular device. This quirk was used by
the wireless receiver to prevent any devices from being created during
the initial probe (defering it instead until we got a tablet connection
event in 'wacom_wireless_work').

This quirk is not necessary now that a device_type is associated with each
device. Any input device allocated by 'wacom_allocate_inputs' which is
not necessary for a particular device is freed in 'wacom_register_inputs'.
In particular, none of the wireless receivers devices have the pen, pad,
or touch device types set so the same effect is achieved without the need
to be explicit.

We now return early in wacom_retrieve_hid_descriptor for wireless devices
(to prevent the device_type from being overridden) but since we ignore the
HID descriptor for the wireless reciever anyway, this is not an issue.

Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
---
 drivers/hid/wacom_sys.c | 24 ++++++++++--------------
 drivers/hid/wacom_wac.c |  4 ----
 drivers/hid/wacom_wac.h |  1 -
 3 files changed, 10 insertions(+), 19 deletions(-)

diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c
index 13834ba..20d15c5 100644
--- a/drivers/hid/wacom_sys.c
+++ b/drivers/hid/wacom_sys.c
@@ -453,11 +453,11 @@ static void wacom_retrieve_hid_descriptor(struct hid_device *hdev,
 	 * interface number.
 	 */
 	if (features->type == WIRELESS) {
-		if (intf->cur_altsetting->desc.bInterfaceNumber == 0) {
+		if (intf->cur_altsetting->desc.bInterfaceNumber == 0)
 			features->device_type = WACOM_DEVICETYPE_WL_MONITOR;
-		} else if (intf->cur_altsetting->desc.bInterfaceNumber == 2) {
-			features->device_type |= WACOM_DEVICETYPE_TOUCH;
-		}
+		else
+			features->device_type = WACOM_DEVICETYPE_NONE;
+		return;
 	}
 
 	wacom_parse_hid(hdev, features);
@@ -1531,11 +1531,9 @@ static int wacom_probe(struct hid_device *hdev,
 	mutex_init(&wacom->lock);
 	INIT_WORK(&wacom->work, wacom_wireless_work);
 
-	if (!(features->quirks & WACOM_QUIRK_NO_INPUT)) {
-		error = wacom_allocate_inputs(wacom);
-		if (error)
-			goto fail_allocate_inputs;
-	}
+	error = wacom_allocate_inputs(wacom);
+	if (error)
+		goto fail_allocate_inputs;
 
 	/*
 	 * Bamboo Pad has a generic hid handling for the Pen, and we switch it
@@ -1588,11 +1586,9 @@ static int wacom_probe(struct hid_device *hdev,
 			goto fail_battery;
 	}
 
-	if (!(features->quirks & WACOM_QUIRK_NO_INPUT)) {
-		error = wacom_register_inputs(wacom);
-		if (error)
-			goto fail_register_inputs;
-	}
+	error = wacom_register_inputs(wacom);
+	if (error)
+		goto fail_register_inputs;
 
 	if (hdev->bus == BUS_BLUETOOTH) {
 		error = device_create_file(&hdev->dev, &dev_attr_speed);
diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c
index 82bb0d3..4d11c78 100644
--- a/drivers/hid/wacom_wac.c
+++ b/drivers/hid/wacom_wac.c
@@ -2326,10 +2326,6 @@ void wacom_setup_device_quirks(struct wacom *wacom)
 	}
 
 	if (features->type == WIRELESS) {
-
-		/* monitor never has input and pen/touch have delayed create */
-		features->quirks |= WACOM_QUIRK_NO_INPUT;
-
 		if (features->device_type == WACOM_DEVICETYPE_WL_MONITOR) {
 			features->quirks |= WACOM_QUIRK_BATTERY;
 		}
diff --git a/drivers/hid/wacom_wac.h b/drivers/hid/wacom_wac.h
index 87df674..6233eea 100644
--- a/drivers/hid/wacom_wac.h
+++ b/drivers/hid/wacom_wac.h
@@ -68,7 +68,6 @@
 
 /* device quirks */
 #define WACOM_QUIRK_BBTOUCH_LOWRES	0x0001
-#define WACOM_QUIRK_NO_INPUT		0x0002
 #define WACOM_QUIRK_BATTERY		0x0008
 
 /* device types */
-- 
2.4.6


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 3/3] HID: wacom: Remove WACOM_QUIRK_NO_INPUT
  2015-08-03 17:17 ` [PATCH 3/3] HID: wacom: Remove WACOM_QUIRK_NO_INPUT Jason Gerecke
@ 2015-08-03 17:39   ` Benjamin Tissoires
  0 siblings, 0 replies; 5+ messages in thread
From: Benjamin Tissoires @ 2015-08-03 17:39 UTC (permalink / raw)
  To: Jason Gerecke
  Cc: Jiri Kosina, Aaron Skomra, Ping Cheng, linux-input, Jason Gerecke

On Aug 03 2015 or thereabouts, Jason Gerecke wrote:
> WACOM_QUIRK_NO_INPUT is a signal to the driver that input devices
> should not be created for a particular device. This quirk was used by
> the wireless receiver to prevent any devices from being created during
> the initial probe (defering it instead until we got a tablet connection
> event in 'wacom_wireless_work').
> 
> This quirk is not necessary now that a device_type is associated with each
> device. Any input device allocated by 'wacom_allocate_inputs' which is
> not necessary for a particular device is freed in 'wacom_register_inputs'.
> In particular, none of the wireless receivers devices have the pen, pad,
> or touch device types set so the same effect is achieved without the need
> to be explicit.
> 
> We now return early in wacom_retrieve_hid_descriptor for wireless devices
> (to prevent the device_type from being overridden) but since we ignore the
> HID descriptor for the wireless reciever anyway, this is not an issue.
> 
> Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
> ---

This series is a nice cleanup.

For the 3 in this series:
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>

Cheers,
Benjamin

>  drivers/hid/wacom_sys.c | 24 ++++++++++--------------
>  drivers/hid/wacom_wac.c |  4 ----
>  drivers/hid/wacom_wac.h |  1 -
>  3 files changed, 10 insertions(+), 19 deletions(-)
> 
> diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c
> index 13834ba..20d15c5 100644
> --- a/drivers/hid/wacom_sys.c
> +++ b/drivers/hid/wacom_sys.c
> @@ -453,11 +453,11 @@ static void wacom_retrieve_hid_descriptor(struct hid_device *hdev,
>  	 * interface number.
>  	 */
>  	if (features->type == WIRELESS) {
> -		if (intf->cur_altsetting->desc.bInterfaceNumber == 0) {
> +		if (intf->cur_altsetting->desc.bInterfaceNumber == 0)
>  			features->device_type = WACOM_DEVICETYPE_WL_MONITOR;
> -		} else if (intf->cur_altsetting->desc.bInterfaceNumber == 2) {
> -			features->device_type |= WACOM_DEVICETYPE_TOUCH;
> -		}
> +		else
> +			features->device_type = WACOM_DEVICETYPE_NONE;
> +		return;
>  	}
>  
>  	wacom_parse_hid(hdev, features);
> @@ -1531,11 +1531,9 @@ static int wacom_probe(struct hid_device *hdev,
>  	mutex_init(&wacom->lock);
>  	INIT_WORK(&wacom->work, wacom_wireless_work);
>  
> -	if (!(features->quirks & WACOM_QUIRK_NO_INPUT)) {
> -		error = wacom_allocate_inputs(wacom);
> -		if (error)
> -			goto fail_allocate_inputs;
> -	}
> +	error = wacom_allocate_inputs(wacom);
> +	if (error)
> +		goto fail_allocate_inputs;
>  
>  	/*
>  	 * Bamboo Pad has a generic hid handling for the Pen, and we switch it
> @@ -1588,11 +1586,9 @@ static int wacom_probe(struct hid_device *hdev,
>  			goto fail_battery;
>  	}
>  
> -	if (!(features->quirks & WACOM_QUIRK_NO_INPUT)) {
> -		error = wacom_register_inputs(wacom);
> -		if (error)
> -			goto fail_register_inputs;
> -	}
> +	error = wacom_register_inputs(wacom);
> +	if (error)
> +		goto fail_register_inputs;
>  
>  	if (hdev->bus == BUS_BLUETOOTH) {
>  		error = device_create_file(&hdev->dev, &dev_attr_speed);
> diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c
> index 82bb0d3..4d11c78 100644
> --- a/drivers/hid/wacom_wac.c
> +++ b/drivers/hid/wacom_wac.c
> @@ -2326,10 +2326,6 @@ void wacom_setup_device_quirks(struct wacom *wacom)
>  	}
>  
>  	if (features->type == WIRELESS) {
> -
> -		/* monitor never has input and pen/touch have delayed create */
> -		features->quirks |= WACOM_QUIRK_NO_INPUT;
> -
>  		if (features->device_type == WACOM_DEVICETYPE_WL_MONITOR) {
>  			features->quirks |= WACOM_QUIRK_BATTERY;
>  		}
> diff --git a/drivers/hid/wacom_wac.h b/drivers/hid/wacom_wac.h
> index 87df674..6233eea 100644
> --- a/drivers/hid/wacom_wac.h
> +++ b/drivers/hid/wacom_wac.h
> @@ -68,7 +68,6 @@
>  
>  /* device quirks */
>  #define WACOM_QUIRK_BBTOUCH_LOWRES	0x0001
> -#define WACOM_QUIRK_NO_INPUT		0x0002
>  #define WACOM_QUIRK_BATTERY		0x0008
>  
>  /* device types */
> -- 
> 2.4.6
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/3] HID: wacom: Use calculated pkglen for wireless touch interface
  2015-08-03 17:17 [PATCH 1/3] HID: wacom: Use calculated pkglen for wireless touch interface Jason Gerecke
  2015-08-03 17:17 ` [PATCH 2/3] HID: wacom: Replace WACOM_QUIRK_MONITOR with WACOM_DEVICETYPE_WL_MONITOR Jason Gerecke
  2015-08-03 17:17 ` [PATCH 3/3] HID: wacom: Remove WACOM_QUIRK_NO_INPUT Jason Gerecke
@ 2015-08-04 13:40 ` Jiri Kosina
  2 siblings, 0 replies; 5+ messages in thread
From: Jiri Kosina @ 2015-08-04 13:40 UTC (permalink / raw)
  To: Jason Gerecke
  Cc: Benjamin Tissoires, Aaron Skomra, Ping Cheng, linux-input,
	Jason Gerecke

On Mon, 3 Aug 2015, Jason Gerecke wrote:

> Commit 01c846f introduced the 'wacom_compute_pktlen' function which
> automatically determines the correct value for an interface's pkglen
> by scanning the HID descriptor. This function returns the correct
> value for the wireless receiver's touch interface, removing the need
> for us to set it manually here.
> 
> Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>

I have applied the series to for-4.3/wacom.

Thanks,

-- 
Jiri Kosina
SUSE Labs

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-08-04 13:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-03 17:17 [PATCH 1/3] HID: wacom: Use calculated pkglen for wireless touch interface Jason Gerecke
2015-08-03 17:17 ` [PATCH 2/3] HID: wacom: Replace WACOM_QUIRK_MONITOR with WACOM_DEVICETYPE_WL_MONITOR Jason Gerecke
2015-08-03 17:17 ` [PATCH 3/3] HID: wacom: Remove WACOM_QUIRK_NO_INPUT Jason Gerecke
2015-08-03 17:39   ` Benjamin Tissoires
2015-08-04 13:40 ` [PATCH 1/3] HID: wacom: Use calculated pkglen for wireless touch interface Jiri Kosina

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