Merge branches 'for-5.2/fixes', 'for-5.3/doc', 'for-5.3/ish', 'for-5.3/logitech'...
[sfrench/cifs-2.6.git] / drivers / hid / wacom_sys.c
index a8633b1437b2bb87b7f51f77ce8fb2e31d3fb464..53bddb50aebaf500f0f5059a9fd2cba56e7b4182 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * drivers/input/tablet/wacom_sys.c
  *
@@ -5,10 +6,6 @@
  */
 
 /*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
  */
 
 #include "wacom_wac.h"
@@ -307,18 +304,23 @@ static void wacom_feature_mapping(struct hid_device *hdev,
        wacom_hid_usage_quirk(hdev, field, usage);
 
        switch (equivalent_usage) {
+       case WACOM_HID_WD_TOUCH_RING_SETTING:
+               wacom->generic_has_leds = true;
+               break;
        case HID_DG_CONTACTMAX:
                /* leave touch_max as is if predefined */
                if (!features->touch_max) {
                        /* read manually */
-                       data = kzalloc(2, GFP_KERNEL);
+                       n = hid_report_len(field->report);
+                       data = hid_alloc_report_buf(field->report, GFP_KERNEL);
                        if (!data)
                                break;
                        data[0] = field->report->id;
                        ret = wacom_get_report(hdev, HID_FEATURE_REPORT,
-                                               data, 2, WAC_CMD_RETRIES);
-                       if (ret == 2) {
-                               features->touch_max = data[1];
+                                              data, n, WAC_CMD_RETRIES);
+                       if (ret == n) {
+                               ret = hid_report_raw_event(hdev,
+                                       HID_FEATURE_REPORT, data, n, 0);
                        } else {
                                features->touch_max = 16;
                                hid_warn(hdev, "wacom_feature_mapping: "