Skip to content

Commit

Permalink
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel…
Browse files Browse the repository at this point in the history
…/git/jikos/hid

Pull HID updates from Jiri Kosina:

 - touch_max detection improvements and quirk handling fixes in wacom
   driver from Jason Gerecke and Ping Cheng

 - Palm rejection from Dmitry Torokhov and _dial support from Benjamin
   Tissoires for hid-multitouch driver

 - Low voltage support for i2c-hid driver from Stephen Boyd

 - Guitar-Hero support from Nicolas Adenis-Lamarre

 - other assorted small fixes and device ID additions

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid: (40 commits)
  HID: intel_ish-hid: tx_buf memory leak on probe/remove
  HID: intel-ish-hid: Prevent loading of driver on Mehlow
  HID: cougar: Add support for the Cougar 500k Gaming Keyboard
  HID: cougar: make compare_device_paths reusable
  HID: intel-ish-hid: remove redundant variable num_frags
  HID: multitouch: handle palm for touchscreens
  HID: multitouch: touchscreens also use confidence reports
  HID: multitouch: report MT_TOOL_PALM for non-confident touches
  HID: microsoft: support the Surface Dial
  HID: core: do not upper bound the collection stack
  HID: input: enable Totem on the Dell Canvas 27
  HID: multitouch: remove one copy of values
  HID: multitouch: ditch mt_report_id
  HID: multitouch: store a per application quirks value
  HID: multitouch: Store per collection multitouch data
  HID: multitouch: make sure the static list of class is not changed
  input: add MT_TOOL_DIAL
  HID: elan: Add support for touchpad on the Toshiba Click Mini L9W
  HID: elan: Add USB-id for HP x2 10-n000nd touchpad
  HID: elan: Add a flag for selecting if the touchpad has a LED
  ...
  • Loading branch information
torvalds committed Aug 20, 2018
2 parents 61c4fc1 + 1429b47 commit 7a324b3
Show file tree
Hide file tree
Showing 27 changed files with 1,824 additions and 748 deletions.
3 changes: 2 additions & 1 deletion Documentation/devicetree/bindings/input/hid-over-i2c.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ device-specific compatible properties, which should be used in addition to the

- compatible:
* "wacom,w9013" (Wacom W9013 digitizer). Supports:
- vdd-supply
- vdd-supply (3.3V)
- vddl-supply (1.8V)
- post-power-on-delay-ms

- vdd-supply: phandle of the regulator that provides the supply voltage.
Expand Down
12 changes: 6 additions & 6 deletions Documentation/input/multi-touch-protocol.rst
Original file line number Diff line number Diff line change
Expand Up @@ -310,12 +310,12 @@ ABS_MT_TOOL_Y
ABS_MT_TOOL_TYPE
The type of approaching tool. A lot of kernel drivers cannot distinguish
between different tool types, such as a finger or a pen. In such cases, the
event should be omitted. The protocol currently supports MT_TOOL_FINGER,
MT_TOOL_PEN, and MT_TOOL_PALM [#f2]_. For type B devices, this event is
handled by input core; drivers should instead use
input_mt_report_slot_state(). A contact's ABS_MT_TOOL_TYPE may change over
time while still touching the device, because the firmware may not be able
to determine which tool is being used when it first appears.
event should be omitted. The protocol currently mainly supports
MT_TOOL_FINGER, MT_TOOL_PEN, and MT_TOOL_PALM [#f2]_.
For type B devices, this event is handled by input core; drivers should
instead use input_mt_report_slot_state(). A contact's ABS_MT_TOOL_TYPE may
change over time while still touching the device, because the firmware may
not be able to determine which tool is being used when it first appears.

ABS_MT_BLOB_ID
The BLOB_ID groups several packets together into one arbitrarily shaped
Expand Down
10 changes: 10 additions & 0 deletions drivers/hid/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,16 @@ config HID_CORSAIR
- Vengeance K90
- Scimitar PRO RGB

config HID_COUGAR
tristate "Cougar devices"
depends on HID
help
Support for Cougar devices that are not fully compliant with the
HID standard.

Supported devices:
- Cougar 500k Gaming Keyboard

config HID_PRODIKEYS
tristate "Prodikeys PC-MIDI Keyboard support"
depends on HID && SND
Expand Down
1 change: 1 addition & 0 deletions drivers/hid/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ obj-$(CONFIG_HID_CHERRY) += hid-cherry.o
obj-$(CONFIG_HID_CHICONY) += hid-chicony.o
obj-$(CONFIG_HID_CMEDIA) += hid-cmedia.o
obj-$(CONFIG_HID_CORSAIR) += hid-corsair.o
obj-$(CONFIG_HID_COUGAR) += hid-cougar.o
obj-$(CONFIG_HID_CP2112) += hid-cp2112.o
obj-$(CONFIG_HID_CYPRESS) += hid-cypress.o
obj-$(CONFIG_HID_DRAGONRISE) += hid-dr.o
Expand Down
40 changes: 37 additions & 3 deletions drivers/hid/hid-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,19 @@ static int open_collection(struct hid_parser *parser, unsigned type)

usage = parser->local.usage[0];

if (parser->collection_stack_ptr == HID_COLLECTION_STACK_SIZE) {
hid_err(parser->device, "collection stack overflow\n");
return -EINVAL;
if (parser->collection_stack_ptr == parser->collection_stack_size) {
unsigned int *collection_stack;
unsigned int new_size = parser->collection_stack_size +
HID_COLLECTION_STACK_SIZE;

collection_stack = krealloc(parser->collection_stack,
new_size * sizeof(unsigned int),
GFP_KERNEL);
if (!collection_stack)
return -ENOMEM;

parser->collection_stack = collection_stack;
parser->collection_stack_size = new_size;
}

if (parser->device->maxcollection == parser->device->collection_size) {
Expand Down Expand Up @@ -840,6 +850,7 @@ static int hid_scan_report(struct hid_device *hid)
break;
}

kfree(parser->collection_stack);
vfree(parser);
return 0;
}
Expand Down Expand Up @@ -1939,6 +1950,29 @@ static int hid_bus_match(struct device *dev, struct device_driver *drv)
return hid_match_device(hdev, hdrv) != NULL;
}

/**
* hid_compare_device_paths - check if both devices share the same path
* @hdev_a: hid device
* @hdev_b: hid device
* @separator: char to use as separator
*
* Check if two devices share the same path up to the last occurrence of
* the separator char. Both paths must exist (i.e., zero-length paths
* don't match).
*/
bool hid_compare_device_paths(struct hid_device *hdev_a,
struct hid_device *hdev_b, char separator)
{
int n1 = strrchr(hdev_a->phys, separator) - hdev_a->phys;
int n2 = strrchr(hdev_b->phys, separator) - hdev_b->phys;

if (n1 != n2 || n1 <= 0 || n2 <= 0)
return false;

return !strncmp(hdev_a->phys, hdev_b->phys, n1);
}
EXPORT_SYMBOL_GPL(hid_compare_device_paths);

static int hid_device_probe(struct device *dev)
{
struct hid_driver *hdrv = to_hid_driver(dev->driver);
Expand Down
Loading

0 comments on commit 7a324b3

Please sign in to comment.