]> Git Repo - linux.git/commitdiff
Merge branch 'for-4.19/multitouch-multiaxis' into for-linus
authorJiri Kosina <[email protected]>
Mon, 20 Aug 2018 16:09:06 +0000 (18:09 +0200)
committerJiri Kosina <[email protected]>
Mon, 20 Aug 2018 16:09:06 +0000 (18:09 +0200)
Multitouch updates:

- Dial support
- Palm rejection for touchscreens
- a few small assorted fixes

1  2 
drivers/hid/hid-core.c
include/linux/hid.h

diff --combined drivers/hid/hid-core.c
index 402ad974b31c478bfe83a59f855cce5e29c65f92,5de6f18c9bf79fbb6ef147ce166566b5f1d15600..3da354af7a0aac6ca129124eb6e511ea32c9535b
@@@ -128,9 -128,19 +128,19 @@@ static int open_collection(struct hid_p
  
        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) {
@@@ -840,6 -850,7 +850,7 @@@ static int hid_scan_report(struct hid_d
                break;
        }
  
+       kfree(parser->collection_stack);
        vfree(parser);
        return 0;
  }
@@@ -1939,29 -1950,6 +1950,29 @@@ static int hid_bus_match(struct device 
        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);
diff --combined include/linux/hid.h
index 938d9ba6d7cd34f4f463de12f654315bcd78e133,aee281522c6db21941a915f2a5a1550e4575f8ad..834e6461a69059b059556a93e29092cd68a976fc
@@@ -190,6 -190,12 +190,12 @@@ struct hid_item 
   * http://www.usb.org/developers/hidpage/HUTRR40RadioHIDUsagesFinal.pdf
   */
  #define HID_GD_WIRELESS_RADIO_CTLS    0x0001000c
+ /*
+  * System Multi-Axis, see:
+  * http://www.usb.org/developers/hidpage/HUTRR62_-_Generic_Desktop_CA_for_System_Multi-Axis_Controllers.txt
+  */
+ #define HID_GD_SYSTEM_MULTIAXIS       0x0001000e
  #define HID_GD_X              0x00010030
  #define HID_GD_Y              0x00010031
  #define HID_GD_Z              0x00010032
@@@ -638,12 -644,13 +644,13 @@@ static inline void hid_set_drvdata(stru
  struct hid_parser {
        struct hid_global     global;
        struct hid_global     global_stack[HID_GLOBAL_STACK_SIZE];
-       unsigned              global_stack_ptr;
+       unsigned int          global_stack_ptr;
        struct hid_local      local;
-       unsigned              collection_stack[HID_COLLECTION_STACK_SIZE];
-       unsigned              collection_stack_ptr;
+       unsigned int         *collection_stack;
+       unsigned int          collection_stack_ptr;
+       unsigned int          collection_stack_size;
        struct hid_device    *device;
-       unsigned              scan_flags;
+       unsigned int          scan_flags;
  };
  
  struct hid_class_descriptor {
@@@ -894,8 -901,6 +901,8 @@@ const struct hid_device_id *hid_match_i
                                         const struct hid_device_id *id);
  const struct hid_device_id *hid_match_device(struct hid_device *hdev,
                                             struct hid_driver *hdrv);
 +bool hid_compare_device_paths(struct hid_device *hdev_a,
 +                            struct hid_device *hdev_b, char separator);
  s32 hid_snto32(__u32 value, unsigned n);
  __u32 hid_field_extract(const struct hid_device *hid, __u8 *report,
                     unsigned offset, unsigned n);
This page took 0.07734 seconds and 4 git commands to generate.