.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * drivers/input/tablet/wacom_sys.c |
---|
3 | 4 | * |
---|
.. | .. |
---|
5 | 6 | */ |
---|
6 | 7 | |
---|
7 | 8 | /* |
---|
8 | | - * This program is free software; you can redistribute it and/or modify |
---|
9 | | - * it under the terms of the GNU General Public License as published by |
---|
10 | | - * the Free Software Foundation; either version 2 of the License, or |
---|
11 | | - * (at your option) any later version. |
---|
12 | 9 | */ |
---|
13 | 10 | |
---|
14 | 11 | #include "wacom_wac.h" |
---|
.. | .. |
---|
250 | 247 | field->usage[i-1].hid == HID_DG_INVERT && |
---|
251 | 248 | field->usage[i+1].hid == HID_DG_INRANGE) { |
---|
252 | 249 | usage->hid = HID_DG_BARRELSWITCH2; |
---|
| 250 | + } |
---|
| 251 | + } |
---|
| 252 | + |
---|
| 253 | + /* |
---|
| 254 | + * Wacom's AES devices use different vendor-defined usages to |
---|
| 255 | + * report serial number information compared to their branded |
---|
| 256 | + * hardware. The usages are also sometimes ill-defined and do |
---|
| 257 | + * not have the correct logical min/max values set. Lets patch |
---|
| 258 | + * the descriptor to use the branded usage convention and fix |
---|
| 259 | + * the errors. |
---|
| 260 | + */ |
---|
| 261 | + if (usage->hid == WACOM_HID_WT_SERIALNUMBER && |
---|
| 262 | + field->report_size == 16 && |
---|
| 263 | + field->index + 2 < field->report->maxfield) { |
---|
| 264 | + struct hid_field *a = field->report->field[field->index + 1]; |
---|
| 265 | + struct hid_field *b = field->report->field[field->index + 2]; |
---|
| 266 | + |
---|
| 267 | + if (a->maxusage > 0 && |
---|
| 268 | + a->usage[0].hid == HID_DG_TOOLSERIALNUMBER && |
---|
| 269 | + a->report_size == 32 && |
---|
| 270 | + b->maxusage > 0 && |
---|
| 271 | + b->usage[0].hid == 0xFF000000 && |
---|
| 272 | + b->report_size == 8) { |
---|
| 273 | + features->quirks |= WACOM_QUIRK_AESPEN; |
---|
| 274 | + usage->hid = WACOM_HID_WD_TOOLTYPE; |
---|
| 275 | + field->logical_minimum = S16_MIN; |
---|
| 276 | + field->logical_maximum = S16_MAX; |
---|
| 277 | + a->logical_minimum = S32_MIN; |
---|
| 278 | + a->logical_maximum = S32_MAX; |
---|
| 279 | + b->usage[0].hid = WACOM_HID_WD_SERIALHI; |
---|
| 280 | + b->logical_minimum = 0; |
---|
| 281 | + b->logical_maximum = U8_MAX; |
---|
253 | 282 | } |
---|
254 | 283 | } |
---|
255 | 284 | |
---|
.. | .. |
---|
2095 | 2124 | |
---|
2096 | 2125 | error = wacom_setup_pad_input_capabilities(pad_input_dev, wacom_wac); |
---|
2097 | 2126 | if (error) { |
---|
2098 | | - /* no pad in use on this interface */ |
---|
| 2127 | + /* no pad events using this interface */ |
---|
2099 | 2128 | input_free_device(pad_input_dev); |
---|
2100 | 2129 | wacom_wac->pad_input = NULL; |
---|
2101 | 2130 | pad_input_dev = NULL; |
---|
.. | .. |
---|
2725 | 2754 | wacom_wac->features = *((struct wacom_features *)id->driver_data); |
---|
2726 | 2755 | features = &wacom_wac->features; |
---|
2727 | 2756 | |
---|
2728 | | - if (features->check_for_hid_type && features->hid_type != hdev->type) { |
---|
2729 | | - error = -ENODEV; |
---|
2730 | | - goto fail; |
---|
2731 | | - } |
---|
| 2757 | + if (features->check_for_hid_type && features->hid_type != hdev->type) |
---|
| 2758 | + return -ENODEV; |
---|
2732 | 2759 | |
---|
2733 | 2760 | error = wacom_devm_kfifo_alloc(wacom); |
---|
2734 | 2761 | if (error) |
---|
2735 | | - goto fail; |
---|
| 2762 | + return error; |
---|
2736 | 2763 | |
---|
2737 | 2764 | wacom_wac->hid_data.inputmode = -1; |
---|
2738 | 2765 | wacom_wac->mode_report = -1; |
---|
.. | .. |
---|
2756 | 2783 | error = hid_parse(hdev); |
---|
2757 | 2784 | if (error) { |
---|
2758 | 2785 | hid_err(hdev, "parse failed\n"); |
---|
2759 | | - goto fail; |
---|
| 2786 | + return error; |
---|
2760 | 2787 | } |
---|
2761 | 2788 | |
---|
2762 | 2789 | error = wacom_parse_and_register(wacom, false); |
---|
2763 | 2790 | if (error) |
---|
2764 | | - goto fail; |
---|
| 2791 | + return error; |
---|
2765 | 2792 | |
---|
2766 | 2793 | if (hdev->bus == BUS_BLUETOOTH) { |
---|
2767 | 2794 | error = device_create_file(&hdev->dev, &dev_attr_speed); |
---|
.. | .. |
---|
2772 | 2799 | } |
---|
2773 | 2800 | |
---|
2774 | 2801 | return 0; |
---|
2775 | | - |
---|
2776 | | -fail: |
---|
2777 | | - hid_set_drvdata(hdev, NULL); |
---|
2778 | | - return error; |
---|
2779 | 2802 | } |
---|
2780 | 2803 | |
---|
2781 | 2804 | static void wacom_remove(struct hid_device *hdev) |
---|
.. | .. |
---|
2802 | 2825 | |
---|
2803 | 2826 | if (wacom->wacom_wac.features.type != REMOTE) |
---|
2804 | 2827 | wacom_release_resources(wacom); |
---|
2805 | | - |
---|
2806 | | - hid_set_drvdata(hdev, NULL); |
---|
2807 | 2828 | } |
---|
2808 | 2829 | |
---|
2809 | 2830 | #ifdef CONFIG_PM |
---|