diff mbox

[2/2] HID: wacom: Handle failing HID_DG_CONTACTMAX requests

Message ID 1431120302-13691-2-git-send-email-killertofu@gmail.com (mailing list archive)
State New, archived
Delegated to: Jiri Kosina
Headers show

Commit Message

Gerecke, Jason May 8, 2015, 9:25 p.m. UTC
Hardware may not respond to a request for the HID_DG_CONTACTMAX feature and
we should be tolerant of such a failure. This is especially true when using
hid-replay where the hardware doesn't exist, but also for devices attached
to a flaky bus. This patch increases the number of allowable retries to
match other calls to 'wacom_get_report' and also provides a fallback which
forces 'touch_max = 16' (enough for any Wacom device seen so far).

Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
---
 drivers/hid/wacom_sys.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

Comments

Benjamin Tissoires May 14, 2015, 2:22 p.m. UTC | #1
On May 08 2015 or thereabouts, Jason Gerecke wrote:
> Hardware may not respond to a request for the HID_DG_CONTACTMAX feature and
> we should be tolerant of such a failure. This is especially true when using
> hid-replay where the hardware doesn't exist, but also for devices attached
> to a flaky bus. This patch increases the number of allowable retries to
> match other calls to 'wacom_get_report' and also provides a fallback which
> forces 'touch_max = 16' (enough for any Wacom device seen so far).
> 
> Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
> ---

Just a small nitpick given that I already asked for a v2 on 1/2:

>  drivers/hid/wacom_sys.c | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c
> index 3cd74d9..c9a7e30 100644
> --- a/drivers/hid/wacom_sys.c
> +++ b/drivers/hid/wacom_sys.c
> @@ -125,9 +125,17 @@ static void wacom_feature_mapping(struct hid_device *hdev,
>  				break;
>  			data[0] = field->report->id;
>  			ret = wacom_get_report(hdev, HID_FEATURE_REPORT,
> -						data, 2, 0);
> -			if (ret == 2)
> +						data, 2, WAC_CMD_RETRIES);
> +			if (ret == 2) {
>  				features->touch_max = data[1];
> +			}
> +			else {

the else should be on the line above :)

> +				features->touch_max = 16;
> +				dev_warn(&hdev->dev, "wacom_feature_mapping: "

hid_warn(hdev...

> +					 "could not get HID_DG_CONTACTMAX, "
> +					 "defaulting to %d\n",
> +					  features->touch_max);
> +			}
>  			kfree(data);
>  		}
>  		break;
> -- 
> 2.4.0
> 

Cheers,
Benjamin

--
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
diff mbox

Patch

diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c
index 3cd74d9..c9a7e30 100644
--- a/drivers/hid/wacom_sys.c
+++ b/drivers/hid/wacom_sys.c
@@ -125,9 +125,17 @@  static void wacom_feature_mapping(struct hid_device *hdev,
 				break;
 			data[0] = field->report->id;
 			ret = wacom_get_report(hdev, HID_FEATURE_REPORT,
-						data, 2, 0);
-			if (ret == 2)
+						data, 2, WAC_CMD_RETRIES);
+			if (ret == 2) {
 				features->touch_max = data[1];
+			}
+			else {
+				features->touch_max = 16;
+				dev_warn(&hdev->dev, "wacom_feature_mapping: "
+					 "could not get HID_DG_CONTACTMAX, "
+					 "defaulting to %d\n",
+					  features->touch_max);
+			}
 			kfree(data);
 		}
 		break;