]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
Merge branch 'for-4.20/core' into for-linus
authorJiri Kosina <jkosina@suse.cz>
Tue, 23 Oct 2018 11:17:27 +0000 (13:17 +0200)
committerJiri Kosina <jkosina@suse.cz>
Tue, 23 Oct 2018 11:17:27 +0000 (13:17 +0200)
Fixes and new features for driver core. Highlights:

- maximum global item tag report size gets increased to 256
- improved INPUT_PROP reporting for Digitizer devices

drivers/hid/hid-core.c
drivers/hid/hid-input.c

index 44564f61e9cc3c85250e2e6d1e5ff47ed95dcd4d..5bec9244c45b54aa943ae5363cecdc9c5d7f38f5 100644 (file)
@@ -406,7 +406,7 @@ static int hid_parser_global(struct hid_parser *parser, struct hid_item *item)
 
        case HID_GLOBAL_ITEM_TAG_REPORT_SIZE:
                parser->global.report_size = item_udata(item);
-               if (parser->global.report_size > 128) {
+               if (parser->global.report_size > 256) {
                        hid_err(parser->device, "invalid report_size %d\n",
                                        parser->global.report_size);
                        return -1;
index a481eaf39e887bad41d89bf251c0dc4a8f2a2096..ad823a01bd6570cd55efcea62b4e346d99949065 100644 (file)
@@ -758,6 +758,11 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
                break;
 
        case HID_UP_DIGITIZER:
+               if ((field->application & 0xff) == 0x01) /* Digitizer */
+                       __set_bit(INPUT_PROP_POINTER, input->propbit);
+               else if ((field->application & 0xff) == 0x02) /* Pen */
+                       __set_bit(INPUT_PROP_DIRECT, input->propbit);
+
                switch (usage->hid & 0xff) {
                case 0x00: /* Undefined */
                        goto ignore;
@@ -1516,6 +1521,7 @@ static struct hid_input *hidinput_allocate(struct hid_device *hid,
        struct hid_input *hidinput = kzalloc(sizeof(*hidinput), GFP_KERNEL);
        struct input_dev *input_dev = input_allocate_device();
        const char *suffix = NULL;
+       size_t suffix_len, name_len;
 
        if (!hidinput || !input_dev)
                goto fail;
@@ -1559,10 +1565,15 @@ static struct hid_input *hidinput_allocate(struct hid_device *hid,
        }
 
        if (suffix) {
-               hidinput->name = kasprintf(GFP_KERNEL, "%s %s",
-                                          hid->name, suffix);
-               if (!hidinput->name)
-                       goto fail;
+               name_len = strlen(hid->name);
+               suffix_len = strlen(suffix);
+               if ((name_len < suffix_len) ||
+                   strcmp(hid->name + name_len - suffix_len, suffix)) {
+                       hidinput->name = kasprintf(GFP_KERNEL, "%s %s",
+                                                  hid->name, suffix);
+                       if (!hidinput->name)
+                               goto fail;
+               }
        }
 
        input_set_drvdata(input_dev, hid);