1dde5845aSJiri Kosina /* 2229695e5SJiri Kosina * HID support for Linux 3dde5845aSJiri Kosina * 4dde5845aSJiri Kosina * Copyright (c) 1999 Andreas Gal 5dde5845aSJiri Kosina * Copyright (c) 2000-2005 Vojtech Pavlik <vojtech@suse.cz> 6dde5845aSJiri Kosina * Copyright (c) 2005 Michael Haboustak <mike-@cinci.rr.com> for Concept2, Inc 76b1968d5SJiri Kosina * Copyright (c) 2006-2012 Jiri Kosina 8dde5845aSJiri Kosina */ 9dde5845aSJiri Kosina 10dde5845aSJiri Kosina /* 11dde5845aSJiri Kosina * This program is free software; you can redistribute it and/or modify it 12dde5845aSJiri Kosina * under the terms of the GNU General Public License as published by the Free 13dde5845aSJiri Kosina * Software Foundation; either version 2 of the License, or (at your option) 14dde5845aSJiri Kosina * any later version. 15dde5845aSJiri Kosina */ 16dde5845aSJiri Kosina 174291ee30SJoe Perches #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 184291ee30SJoe Perches 19dde5845aSJiri Kosina #include <linux/module.h> 20dde5845aSJiri Kosina #include <linux/slab.h> 21dde5845aSJiri Kosina #include <linux/init.h> 22dde5845aSJiri Kosina #include <linux/kernel.h> 23dde5845aSJiri Kosina #include <linux/list.h> 24dde5845aSJiri Kosina #include <linux/mm.h> 25dde5845aSJiri Kosina #include <linux/spinlock.h> 26dde5845aSJiri Kosina #include <asm/unaligned.h> 27dde5845aSJiri Kosina #include <asm/byteorder.h> 28dde5845aSJiri Kosina #include <linux/input.h> 29dde5845aSJiri Kosina #include <linux/wait.h> 3047a80edbSJiri Kosina #include <linux/vmalloc.h> 31c4124c9bSJiri Kosina #include <linux/sched.h> 324ea54542SDavid Herrmann #include <linux/semaphore.h> 33dde5845aSJiri Kosina 34dde5845aSJiri Kosina #include <linux/hid.h> 35dde5845aSJiri Kosina #include <linux/hiddev.h> 36c080d89aSJiri Kosina #include <linux/hid-debug.h> 3786166b7bSJiri Kosina #include <linux/hidraw.h> 38dde5845aSJiri Kosina 395f22a799SJiri Slaby #include "hid-ids.h" 405f22a799SJiri Slaby 41dde5845aSJiri Kosina /* 42dde5845aSJiri Kosina * Version Information 43dde5845aSJiri Kosina */ 44dde5845aSJiri Kosina 4553149801SJiri Kosina #define DRIVER_DESC "HID core driver" 46dde5845aSJiri Kosina #define DRIVER_LICENSE "GPL" 47dde5845aSJiri Kosina 4858037eb9SJiri Kosina int hid_debug = 0; 49377e10fbSAnssi Hannula module_param_named(debug, hid_debug, int, 0600); 50cd667ce2SJiri Kosina MODULE_PARM_DESC(debug, "toggle HID debugging messages"); 5158037eb9SJiri Kosina EXPORT_SYMBOL_GPL(hid_debug); 5258037eb9SJiri Kosina 536b1968d5SJiri Kosina static int hid_ignore_special_drivers = 0; 546b1968d5SJiri Kosina module_param_named(ignore_special_drivers, hid_ignore_special_drivers, int, 0600); 55643727a9SHans Petter Selasky MODULE_PARM_DESC(ignore_special_drivers, "Ignore any special drivers and handle all devices by generic driver"); 566b1968d5SJiri Kosina 57dde5845aSJiri Kosina /* 58dde5845aSJiri Kosina * Register a new report for a device. 59dde5845aSJiri Kosina */ 60dde5845aSJiri Kosina 6190a006abSMichael Poole struct hid_report *hid_register_report(struct hid_device *device, unsigned type, unsigned id) 62dde5845aSJiri Kosina { 63dde5845aSJiri Kosina struct hid_report_enum *report_enum = device->report_enum + type; 64dde5845aSJiri Kosina struct hid_report *report; 65dde5845aSJiri Kosina 6643622021SKees Cook if (id >= HID_MAX_IDS) 6743622021SKees Cook return NULL; 68dde5845aSJiri Kosina if (report_enum->report_id_hash[id]) 69dde5845aSJiri Kosina return report_enum->report_id_hash[id]; 70dde5845aSJiri Kosina 71a3789a17SJoe Perches report = kzalloc(sizeof(struct hid_report), GFP_KERNEL); 72a3789a17SJoe Perches if (!report) 73dde5845aSJiri Kosina return NULL; 74dde5845aSJiri Kosina 75dde5845aSJiri Kosina if (id != 0) 76dde5845aSJiri Kosina report_enum->numbered = 1; 77dde5845aSJiri Kosina 78dde5845aSJiri Kosina report->id = id; 79dde5845aSJiri Kosina report->type = type; 80dde5845aSJiri Kosina report->size = 0; 81dde5845aSJiri Kosina report->device = device; 82dde5845aSJiri Kosina report_enum->report_id_hash[id] = report; 83dde5845aSJiri Kosina 84dde5845aSJiri Kosina list_add_tail(&report->list, &report_enum->report_list); 85dde5845aSJiri Kosina 86dde5845aSJiri Kosina return report; 87dde5845aSJiri Kosina } 8890a006abSMichael Poole EXPORT_SYMBOL_GPL(hid_register_report); 89dde5845aSJiri Kosina 90dde5845aSJiri Kosina /* 91dde5845aSJiri Kosina * Register a new field for this report. 92dde5845aSJiri Kosina */ 93dde5845aSJiri Kosina 94dde5845aSJiri Kosina static struct hid_field *hid_register_field(struct hid_report *report, unsigned usages, unsigned values) 95dde5845aSJiri Kosina { 96dde5845aSJiri Kosina struct hid_field *field; 97dde5845aSJiri Kosina 98dde5845aSJiri Kosina if (report->maxfield == HID_MAX_FIELDS) { 998c3d52fcSJiri Kosina hid_err(report->device, "too many fields in report\n"); 100dde5845aSJiri Kosina return NULL; 101dde5845aSJiri Kosina } 102dde5845aSJiri Kosina 103a3789a17SJoe Perches field = kzalloc((sizeof(struct hid_field) + 104a3789a17SJoe Perches usages * sizeof(struct hid_usage) + 105a3789a17SJoe Perches values * sizeof(unsigned)), GFP_KERNEL); 106a3789a17SJoe Perches if (!field) 107a3789a17SJoe Perches return NULL; 108dde5845aSJiri Kosina 109dde5845aSJiri Kosina field->index = report->maxfield++; 110dde5845aSJiri Kosina report->field[field->index] = field; 111dde5845aSJiri Kosina field->usage = (struct hid_usage *)(field + 1); 112282bfd4cSJiri Slaby field->value = (s32 *)(field->usage + usages); 113dde5845aSJiri Kosina field->report = report; 114dde5845aSJiri Kosina 115dde5845aSJiri Kosina return field; 116dde5845aSJiri Kosina } 117dde5845aSJiri Kosina 118dde5845aSJiri Kosina /* 119dde5845aSJiri Kosina * Open a collection. The type/usage is pushed on the stack. 120dde5845aSJiri Kosina */ 121dde5845aSJiri Kosina 122dde5845aSJiri Kosina static int open_collection(struct hid_parser *parser, unsigned type) 123dde5845aSJiri Kosina { 124dde5845aSJiri Kosina struct hid_collection *collection; 125dde5845aSJiri Kosina unsigned usage; 126dde5845aSJiri Kosina 127dde5845aSJiri Kosina usage = parser->local.usage[0]; 128dde5845aSJiri Kosina 129dde5845aSJiri Kosina if (parser->collection_stack_ptr == HID_COLLECTION_STACK_SIZE) { 1308c3d52fcSJiri Kosina hid_err(parser->device, "collection stack overflow\n"); 131a6fbaacfSSachin Kamat return -EINVAL; 132dde5845aSJiri Kosina } 133dde5845aSJiri Kosina 134dde5845aSJiri Kosina if (parser->device->maxcollection == parser->device->collection_size) { 135dde5845aSJiri Kosina collection = kmalloc(sizeof(struct hid_collection) * 136dde5845aSJiri Kosina parser->device->collection_size * 2, GFP_KERNEL); 137dde5845aSJiri Kosina if (collection == NULL) { 1388c3d52fcSJiri Kosina hid_err(parser->device, "failed to reallocate collection array\n"); 139a6fbaacfSSachin Kamat return -ENOMEM; 140dde5845aSJiri Kosina } 141dde5845aSJiri Kosina memcpy(collection, parser->device->collection, 142dde5845aSJiri Kosina sizeof(struct hid_collection) * 143dde5845aSJiri Kosina parser->device->collection_size); 144dde5845aSJiri Kosina memset(collection + parser->device->collection_size, 0, 145dde5845aSJiri Kosina sizeof(struct hid_collection) * 146dde5845aSJiri Kosina parser->device->collection_size); 147dde5845aSJiri Kosina kfree(parser->device->collection); 148dde5845aSJiri Kosina parser->device->collection = collection; 149dde5845aSJiri Kosina parser->device->collection_size *= 2; 150dde5845aSJiri Kosina } 151dde5845aSJiri Kosina 152dde5845aSJiri Kosina parser->collection_stack[parser->collection_stack_ptr++] = 153dde5845aSJiri Kosina parser->device->maxcollection; 154dde5845aSJiri Kosina 155dde5845aSJiri Kosina collection = parser->device->collection + 156dde5845aSJiri Kosina parser->device->maxcollection++; 157dde5845aSJiri Kosina collection->type = type; 158dde5845aSJiri Kosina collection->usage = usage; 159dde5845aSJiri Kosina collection->level = parser->collection_stack_ptr - 1; 160dde5845aSJiri Kosina 161dde5845aSJiri Kosina if (type == HID_COLLECTION_APPLICATION) 162dde5845aSJiri Kosina parser->device->maxapplication++; 163dde5845aSJiri Kosina 164dde5845aSJiri Kosina return 0; 165dde5845aSJiri Kosina } 166dde5845aSJiri Kosina 167dde5845aSJiri Kosina /* 168dde5845aSJiri Kosina * Close a collection. 169dde5845aSJiri Kosina */ 170dde5845aSJiri Kosina 171dde5845aSJiri Kosina static int close_collection(struct hid_parser *parser) 172dde5845aSJiri Kosina { 173dde5845aSJiri Kosina if (!parser->collection_stack_ptr) { 1748c3d52fcSJiri Kosina hid_err(parser->device, "collection stack underflow\n"); 175a6fbaacfSSachin Kamat return -EINVAL; 176dde5845aSJiri Kosina } 177dde5845aSJiri Kosina parser->collection_stack_ptr--; 178dde5845aSJiri Kosina return 0; 179dde5845aSJiri Kosina } 180dde5845aSJiri Kosina 181dde5845aSJiri Kosina /* 182dde5845aSJiri Kosina * Climb up the stack, search for the specified collection type 183dde5845aSJiri Kosina * and return the usage. 184dde5845aSJiri Kosina */ 185dde5845aSJiri Kosina 186dde5845aSJiri Kosina static unsigned hid_lookup_collection(struct hid_parser *parser, unsigned type) 187dde5845aSJiri Kosina { 188504499f2SJoe Perches struct hid_collection *collection = parser->device->collection; 189dde5845aSJiri Kosina int n; 190504499f2SJoe Perches 191504499f2SJoe Perches for (n = parser->collection_stack_ptr - 1; n >= 0; n--) { 192504499f2SJoe Perches unsigned index = parser->collection_stack[n]; 193504499f2SJoe Perches if (collection[index].type == type) 194504499f2SJoe Perches return collection[index].usage; 195504499f2SJoe Perches } 196dde5845aSJiri Kosina return 0; /* we know nothing about this usage type */ 197dde5845aSJiri Kosina } 198dde5845aSJiri Kosina 199dde5845aSJiri Kosina /* 200dde5845aSJiri Kosina * Add a usage to the temporary parser table. 201dde5845aSJiri Kosina */ 202dde5845aSJiri Kosina 203dde5845aSJiri Kosina static int hid_add_usage(struct hid_parser *parser, unsigned usage) 204dde5845aSJiri Kosina { 205dde5845aSJiri Kosina if (parser->local.usage_index >= HID_MAX_USAGES) { 2068c3d52fcSJiri Kosina hid_err(parser->device, "usage index exceeded\n"); 207dde5845aSJiri Kosina return -1; 208dde5845aSJiri Kosina } 209dde5845aSJiri Kosina parser->local.usage[parser->local.usage_index] = usage; 210dde5845aSJiri Kosina parser->local.collection_index[parser->local.usage_index] = 211dde5845aSJiri Kosina parser->collection_stack_ptr ? 212dde5845aSJiri Kosina parser->collection_stack[parser->collection_stack_ptr - 1] : 0; 213dde5845aSJiri Kosina parser->local.usage_index++; 214dde5845aSJiri Kosina return 0; 215dde5845aSJiri Kosina } 216dde5845aSJiri Kosina 217dde5845aSJiri Kosina /* 218dde5845aSJiri Kosina * Register a new field for this report. 219dde5845aSJiri Kosina */ 220dde5845aSJiri Kosina 221dde5845aSJiri Kosina static int hid_add_field(struct hid_parser *parser, unsigned report_type, unsigned flags) 222dde5845aSJiri Kosina { 223dde5845aSJiri Kosina struct hid_report *report; 224dde5845aSJiri Kosina struct hid_field *field; 225cc6b54aaSBenjamin Tissoires unsigned usages; 226dde5845aSJiri Kosina unsigned offset; 227cc6b54aaSBenjamin Tissoires unsigned i; 228dde5845aSJiri Kosina 229a3789a17SJoe Perches report = hid_register_report(parser->device, report_type, parser->global.report_id); 230a3789a17SJoe Perches if (!report) { 2318c3d52fcSJiri Kosina hid_err(parser->device, "hid_register_report failed\n"); 232dde5845aSJiri Kosina return -1; 233dde5845aSJiri Kosina } 234dde5845aSJiri Kosina 235bb2e1976SJiri Kosina /* Handle both signed and unsigned cases properly */ 2360cd516c2Ssrinivas pandruvada if ((parser->global.logical_minimum < 0 && 2370cd516c2Ssrinivas pandruvada parser->global.logical_maximum < 2380cd516c2Ssrinivas pandruvada parser->global.logical_minimum) || 2390cd516c2Ssrinivas pandruvada (parser->global.logical_minimum >= 0 && 2400cd516c2Ssrinivas pandruvada (__u32)parser->global.logical_maximum < 2410cd516c2Ssrinivas pandruvada (__u32)parser->global.logical_minimum)) { 2420cd516c2Ssrinivas pandruvada dbg_hid("logical range invalid 0x%x 0x%x\n", 2430cd516c2Ssrinivas pandruvada parser->global.logical_minimum, 2440cd516c2Ssrinivas pandruvada parser->global.logical_maximum); 245dde5845aSJiri Kosina return -1; 246dde5845aSJiri Kosina } 247dde5845aSJiri Kosina 248dde5845aSJiri Kosina offset = report->size; 249dde5845aSJiri Kosina report->size += parser->global.report_size * parser->global.report_count; 250dde5845aSJiri Kosina 251dde5845aSJiri Kosina if (!parser->local.usage_index) /* Ignore padding fields */ 252dde5845aSJiri Kosina return 0; 253dde5845aSJiri Kosina 254cc6b54aaSBenjamin Tissoires usages = max_t(unsigned, parser->local.usage_index, 255cc6b54aaSBenjamin Tissoires parser->global.report_count); 256dde5845aSJiri Kosina 257a3789a17SJoe Perches field = hid_register_field(report, usages, parser->global.report_count); 258a3789a17SJoe Perches if (!field) 259dde5845aSJiri Kosina return 0; 260dde5845aSJiri Kosina 261dde5845aSJiri Kosina field->physical = hid_lookup_collection(parser, HID_COLLECTION_PHYSICAL); 262dde5845aSJiri Kosina field->logical = hid_lookup_collection(parser, HID_COLLECTION_LOGICAL); 263dde5845aSJiri Kosina field->application = hid_lookup_collection(parser, HID_COLLECTION_APPLICATION); 264dde5845aSJiri Kosina 265dde5845aSJiri Kosina for (i = 0; i < usages; i++) { 266cc6b54aaSBenjamin Tissoires unsigned j = i; 267dde5845aSJiri Kosina /* Duplicate the last usage we parsed if we have excess values */ 268dde5845aSJiri Kosina if (i >= parser->local.usage_index) 269dde5845aSJiri Kosina j = parser->local.usage_index - 1; 270dde5845aSJiri Kosina field->usage[i].hid = parser->local.usage[j]; 271dde5845aSJiri Kosina field->usage[i].collection_index = 272dde5845aSJiri Kosina parser->local.collection_index[j]; 273cc6b54aaSBenjamin Tissoires field->usage[i].usage_index = i; 274dde5845aSJiri Kosina } 275dde5845aSJiri Kosina 276dde5845aSJiri Kosina field->maxusage = usages; 277dde5845aSJiri Kosina field->flags = flags; 278dde5845aSJiri Kosina field->report_offset = offset; 279dde5845aSJiri Kosina field->report_type = report_type; 280dde5845aSJiri Kosina field->report_size = parser->global.report_size; 281dde5845aSJiri Kosina field->report_count = parser->global.report_count; 282dde5845aSJiri Kosina field->logical_minimum = parser->global.logical_minimum; 283dde5845aSJiri Kosina field->logical_maximum = parser->global.logical_maximum; 284dde5845aSJiri Kosina field->physical_minimum = parser->global.physical_minimum; 285dde5845aSJiri Kosina field->physical_maximum = parser->global.physical_maximum; 286dde5845aSJiri Kosina field->unit_exponent = parser->global.unit_exponent; 287dde5845aSJiri Kosina field->unit = parser->global.unit; 288dde5845aSJiri Kosina 289dde5845aSJiri Kosina return 0; 290dde5845aSJiri Kosina } 291dde5845aSJiri Kosina 292dde5845aSJiri Kosina /* 293dde5845aSJiri Kosina * Read data value from item. 294dde5845aSJiri Kosina */ 295dde5845aSJiri Kosina 296dde5845aSJiri Kosina static u32 item_udata(struct hid_item *item) 297dde5845aSJiri Kosina { 298dde5845aSJiri Kosina switch (item->size) { 299dde5845aSJiri Kosina case 1: return item->data.u8; 300dde5845aSJiri Kosina case 2: return item->data.u16; 301dde5845aSJiri Kosina case 4: return item->data.u32; 302dde5845aSJiri Kosina } 303dde5845aSJiri Kosina return 0; 304dde5845aSJiri Kosina } 305dde5845aSJiri Kosina 306dde5845aSJiri Kosina static s32 item_sdata(struct hid_item *item) 307dde5845aSJiri Kosina { 308dde5845aSJiri Kosina switch (item->size) { 309dde5845aSJiri Kosina case 1: return item->data.s8; 310dde5845aSJiri Kosina case 2: return item->data.s16; 311dde5845aSJiri Kosina case 4: return item->data.s32; 312dde5845aSJiri Kosina } 313dde5845aSJiri Kosina return 0; 314dde5845aSJiri Kosina } 315dde5845aSJiri Kosina 316dde5845aSJiri Kosina /* 317dde5845aSJiri Kosina * Process a global item. 318dde5845aSJiri Kosina */ 319dde5845aSJiri Kosina 320dde5845aSJiri Kosina static int hid_parser_global(struct hid_parser *parser, struct hid_item *item) 321dde5845aSJiri Kosina { 322ad0e669bSNikolai Kondrashov __s32 raw_value; 323dde5845aSJiri Kosina switch (item->tag) { 324dde5845aSJiri Kosina case HID_GLOBAL_ITEM_TAG_PUSH: 325dde5845aSJiri Kosina 326dde5845aSJiri Kosina if (parser->global_stack_ptr == HID_GLOBAL_STACK_SIZE) { 3278c3d52fcSJiri Kosina hid_err(parser->device, "global environment stack overflow\n"); 328dde5845aSJiri Kosina return -1; 329dde5845aSJiri Kosina } 330dde5845aSJiri Kosina 331dde5845aSJiri Kosina memcpy(parser->global_stack + parser->global_stack_ptr++, 332dde5845aSJiri Kosina &parser->global, sizeof(struct hid_global)); 333dde5845aSJiri Kosina return 0; 334dde5845aSJiri Kosina 335dde5845aSJiri Kosina case HID_GLOBAL_ITEM_TAG_POP: 336dde5845aSJiri Kosina 337dde5845aSJiri Kosina if (!parser->global_stack_ptr) { 3388c3d52fcSJiri Kosina hid_err(parser->device, "global environment stack underflow\n"); 339dde5845aSJiri Kosina return -1; 340dde5845aSJiri Kosina } 341dde5845aSJiri Kosina 342880d29f1SJiri Slaby memcpy(&parser->global, parser->global_stack + 343880d29f1SJiri Slaby --parser->global_stack_ptr, sizeof(struct hid_global)); 344dde5845aSJiri Kosina return 0; 345dde5845aSJiri Kosina 346dde5845aSJiri Kosina case HID_GLOBAL_ITEM_TAG_USAGE_PAGE: 347dde5845aSJiri Kosina parser->global.usage_page = item_udata(item); 348dde5845aSJiri Kosina return 0; 349dde5845aSJiri Kosina 350dde5845aSJiri Kosina case HID_GLOBAL_ITEM_TAG_LOGICAL_MINIMUM: 351dde5845aSJiri Kosina parser->global.logical_minimum = item_sdata(item); 352dde5845aSJiri Kosina return 0; 353dde5845aSJiri Kosina 354dde5845aSJiri Kosina case HID_GLOBAL_ITEM_TAG_LOGICAL_MAXIMUM: 355dde5845aSJiri Kosina if (parser->global.logical_minimum < 0) 356dde5845aSJiri Kosina parser->global.logical_maximum = item_sdata(item); 357dde5845aSJiri Kosina else 358dde5845aSJiri Kosina parser->global.logical_maximum = item_udata(item); 359dde5845aSJiri Kosina return 0; 360dde5845aSJiri Kosina 361dde5845aSJiri Kosina case HID_GLOBAL_ITEM_TAG_PHYSICAL_MINIMUM: 362dde5845aSJiri Kosina parser->global.physical_minimum = item_sdata(item); 363dde5845aSJiri Kosina return 0; 364dde5845aSJiri Kosina 365dde5845aSJiri Kosina case HID_GLOBAL_ITEM_TAG_PHYSICAL_MAXIMUM: 366dde5845aSJiri Kosina if (parser->global.physical_minimum < 0) 367dde5845aSJiri Kosina parser->global.physical_maximum = item_sdata(item); 368dde5845aSJiri Kosina else 369dde5845aSJiri Kosina parser->global.physical_maximum = item_udata(item); 370dde5845aSJiri Kosina return 0; 371dde5845aSJiri Kosina 372dde5845aSJiri Kosina case HID_GLOBAL_ITEM_TAG_UNIT_EXPONENT: 373ad0e669bSNikolai Kondrashov /* Many devices provide unit exponent as a two's complement 374ad0e669bSNikolai Kondrashov * nibble due to the common misunderstanding of HID 375ad0e669bSNikolai Kondrashov * specification 1.11, 6.2.2.7 Global Items. Attempt to handle 376ad0e669bSNikolai Kondrashov * both this and the standard encoding. */ 377ad0e669bSNikolai Kondrashov raw_value = item_sdata(item); 37877463838SBenjamin Tissoires if (!(raw_value & 0xfffffff0)) 37977463838SBenjamin Tissoires parser->global.unit_exponent = hid_snto32(raw_value, 4); 38077463838SBenjamin Tissoires else 38177463838SBenjamin Tissoires parser->global.unit_exponent = raw_value; 382dde5845aSJiri Kosina return 0; 383dde5845aSJiri Kosina 384dde5845aSJiri Kosina case HID_GLOBAL_ITEM_TAG_UNIT: 385dde5845aSJiri Kosina parser->global.unit = item_udata(item); 386dde5845aSJiri Kosina return 0; 387dde5845aSJiri Kosina 388dde5845aSJiri Kosina case HID_GLOBAL_ITEM_TAG_REPORT_SIZE: 389880d29f1SJiri Slaby parser->global.report_size = item_udata(item); 39023408f95SMarek Vasut if (parser->global.report_size > 128) { 3918c3d52fcSJiri Kosina hid_err(parser->device, "invalid report_size %d\n", 392880d29f1SJiri Slaby parser->global.report_size); 393dde5845aSJiri Kosina return -1; 394dde5845aSJiri Kosina } 395dde5845aSJiri Kosina return 0; 396dde5845aSJiri Kosina 397dde5845aSJiri Kosina case HID_GLOBAL_ITEM_TAG_REPORT_COUNT: 398880d29f1SJiri Slaby parser->global.report_count = item_udata(item); 399880d29f1SJiri Slaby if (parser->global.report_count > HID_MAX_USAGES) { 4008c3d52fcSJiri Kosina hid_err(parser->device, "invalid report_count %d\n", 401880d29f1SJiri Slaby parser->global.report_count); 402dde5845aSJiri Kosina return -1; 403dde5845aSJiri Kosina } 404dde5845aSJiri Kosina return 0; 405dde5845aSJiri Kosina 406dde5845aSJiri Kosina case HID_GLOBAL_ITEM_TAG_REPORT_ID: 407880d29f1SJiri Slaby parser->global.report_id = item_udata(item); 40843622021SKees Cook if (parser->global.report_id == 0 || 40943622021SKees Cook parser->global.report_id >= HID_MAX_IDS) { 41043622021SKees Cook hid_err(parser->device, "report_id %u is invalid\n", 41143622021SKees Cook parser->global.report_id); 412dde5845aSJiri Kosina return -1; 413dde5845aSJiri Kosina } 414dde5845aSJiri Kosina return 0; 415dde5845aSJiri Kosina 416dde5845aSJiri Kosina default: 4178c3d52fcSJiri Kosina hid_err(parser->device, "unknown global tag 0x%x\n", item->tag); 418dde5845aSJiri Kosina return -1; 419dde5845aSJiri Kosina } 420dde5845aSJiri Kosina } 421dde5845aSJiri Kosina 422dde5845aSJiri Kosina /* 423dde5845aSJiri Kosina * Process a local item. 424dde5845aSJiri Kosina */ 425dde5845aSJiri Kosina 426dde5845aSJiri Kosina static int hid_parser_local(struct hid_parser *parser, struct hid_item *item) 427dde5845aSJiri Kosina { 428dde5845aSJiri Kosina __u32 data; 429dde5845aSJiri Kosina unsigned n; 430ba532198SBenjamin Tissoires __u32 count; 431dde5845aSJiri Kosina 432dde5845aSJiri Kosina data = item_udata(item); 433dde5845aSJiri Kosina 434dde5845aSJiri Kosina switch (item->tag) { 435dde5845aSJiri Kosina case HID_LOCAL_ITEM_TAG_DELIMITER: 436dde5845aSJiri Kosina 437dde5845aSJiri Kosina if (data) { 438dde5845aSJiri Kosina /* 439dde5845aSJiri Kosina * We treat items before the first delimiter 440dde5845aSJiri Kosina * as global to all usage sets (branch 0). 441dde5845aSJiri Kosina * In the moment we process only these global 442dde5845aSJiri Kosina * items and the first delimiter set. 443dde5845aSJiri Kosina */ 444dde5845aSJiri Kosina if (parser->local.delimiter_depth != 0) { 4458c3d52fcSJiri Kosina hid_err(parser->device, "nested delimiters\n"); 446dde5845aSJiri Kosina return -1; 447dde5845aSJiri Kosina } 448dde5845aSJiri Kosina parser->local.delimiter_depth++; 449dde5845aSJiri Kosina parser->local.delimiter_branch++; 450dde5845aSJiri Kosina } else { 451dde5845aSJiri Kosina if (parser->local.delimiter_depth < 1) { 4528c3d52fcSJiri Kosina hid_err(parser->device, "bogus close delimiter\n"); 453dde5845aSJiri Kosina return -1; 454dde5845aSJiri Kosina } 455dde5845aSJiri Kosina parser->local.delimiter_depth--; 456dde5845aSJiri Kosina } 45738ead6efSPaul Chavent return 0; 458dde5845aSJiri Kosina 459dde5845aSJiri Kosina case HID_LOCAL_ITEM_TAG_USAGE: 460dde5845aSJiri Kosina 461dde5845aSJiri Kosina if (parser->local.delimiter_branch > 1) { 46258037eb9SJiri Kosina dbg_hid("alternative usage ignored\n"); 463dde5845aSJiri Kosina return 0; 464dde5845aSJiri Kosina } 465dde5845aSJiri Kosina 466dde5845aSJiri Kosina if (item->size <= 2) 467dde5845aSJiri Kosina data = (parser->global.usage_page << 16) + data; 468dde5845aSJiri Kosina 469dde5845aSJiri Kosina return hid_add_usage(parser, data); 470dde5845aSJiri Kosina 471dde5845aSJiri Kosina case HID_LOCAL_ITEM_TAG_USAGE_MINIMUM: 472dde5845aSJiri Kosina 473dde5845aSJiri Kosina if (parser->local.delimiter_branch > 1) { 47458037eb9SJiri Kosina dbg_hid("alternative usage ignored\n"); 475dde5845aSJiri Kosina return 0; 476dde5845aSJiri Kosina } 477dde5845aSJiri Kosina 478dde5845aSJiri Kosina if (item->size <= 2) 479dde5845aSJiri Kosina data = (parser->global.usage_page << 16) + data; 480dde5845aSJiri Kosina 481dde5845aSJiri Kosina parser->local.usage_minimum = data; 482dde5845aSJiri Kosina return 0; 483dde5845aSJiri Kosina 484dde5845aSJiri Kosina case HID_LOCAL_ITEM_TAG_USAGE_MAXIMUM: 485dde5845aSJiri Kosina 486dde5845aSJiri Kosina if (parser->local.delimiter_branch > 1) { 48758037eb9SJiri Kosina dbg_hid("alternative usage ignored\n"); 488dde5845aSJiri Kosina return 0; 489dde5845aSJiri Kosina } 490dde5845aSJiri Kosina 491dde5845aSJiri Kosina if (item->size <= 2) 492dde5845aSJiri Kosina data = (parser->global.usage_page << 16) + data; 493dde5845aSJiri Kosina 494ba532198SBenjamin Tissoires count = data - parser->local.usage_minimum; 495ba532198SBenjamin Tissoires if (count + parser->local.usage_index >= HID_MAX_USAGES) { 496ba532198SBenjamin Tissoires /* 497ba532198SBenjamin Tissoires * We do not warn if the name is not set, we are 498ba532198SBenjamin Tissoires * actually pre-scanning the device. 499ba532198SBenjamin Tissoires */ 500ba532198SBenjamin Tissoires if (dev_name(&parser->device->dev)) 501ba532198SBenjamin Tissoires hid_warn(parser->device, 502ba532198SBenjamin Tissoires "ignoring exceeding usage max\n"); 503ba532198SBenjamin Tissoires data = HID_MAX_USAGES - parser->local.usage_index + 504ba532198SBenjamin Tissoires parser->local.usage_minimum - 1; 505ba532198SBenjamin Tissoires if (data <= 0) { 506ba532198SBenjamin Tissoires hid_err(parser->device, 507ba532198SBenjamin Tissoires "no more usage index available\n"); 508ba532198SBenjamin Tissoires return -1; 509ba532198SBenjamin Tissoires } 510ba532198SBenjamin Tissoires } 511ba532198SBenjamin Tissoires 512dde5845aSJiri Kosina for (n = parser->local.usage_minimum; n <= data; n++) 513dde5845aSJiri Kosina if (hid_add_usage(parser, n)) { 51458037eb9SJiri Kosina dbg_hid("hid_add_usage failed\n"); 515dde5845aSJiri Kosina return -1; 516dde5845aSJiri Kosina } 517dde5845aSJiri Kosina return 0; 518dde5845aSJiri Kosina 519dde5845aSJiri Kosina default: 520dde5845aSJiri Kosina 52158037eb9SJiri Kosina dbg_hid("unknown local item tag 0x%x\n", item->tag); 522dde5845aSJiri Kosina return 0; 523dde5845aSJiri Kosina } 524dde5845aSJiri Kosina return 0; 525dde5845aSJiri Kosina } 526dde5845aSJiri Kosina 527dde5845aSJiri Kosina /* 528dde5845aSJiri Kosina * Process a main item. 529dde5845aSJiri Kosina */ 530dde5845aSJiri Kosina 531dde5845aSJiri Kosina static int hid_parser_main(struct hid_parser *parser, struct hid_item *item) 532dde5845aSJiri Kosina { 533dde5845aSJiri Kosina __u32 data; 534dde5845aSJiri Kosina int ret; 535dde5845aSJiri Kosina 536dde5845aSJiri Kosina data = item_udata(item); 537dde5845aSJiri Kosina 538dde5845aSJiri Kosina switch (item->tag) { 539dde5845aSJiri Kosina case HID_MAIN_ITEM_TAG_BEGIN_COLLECTION: 540dde5845aSJiri Kosina ret = open_collection(parser, data & 0xff); 541dde5845aSJiri Kosina break; 542dde5845aSJiri Kosina case HID_MAIN_ITEM_TAG_END_COLLECTION: 543dde5845aSJiri Kosina ret = close_collection(parser); 544dde5845aSJiri Kosina break; 545dde5845aSJiri Kosina case HID_MAIN_ITEM_TAG_INPUT: 546dde5845aSJiri Kosina ret = hid_add_field(parser, HID_INPUT_REPORT, data); 547dde5845aSJiri Kosina break; 548dde5845aSJiri Kosina case HID_MAIN_ITEM_TAG_OUTPUT: 549dde5845aSJiri Kosina ret = hid_add_field(parser, HID_OUTPUT_REPORT, data); 550dde5845aSJiri Kosina break; 551dde5845aSJiri Kosina case HID_MAIN_ITEM_TAG_FEATURE: 552dde5845aSJiri Kosina ret = hid_add_field(parser, HID_FEATURE_REPORT, data); 553dde5845aSJiri Kosina break; 554dde5845aSJiri Kosina default: 5558c3d52fcSJiri Kosina hid_err(parser->device, "unknown main item tag 0x%x\n", item->tag); 556dde5845aSJiri Kosina ret = 0; 557dde5845aSJiri Kosina } 558dde5845aSJiri Kosina 559dde5845aSJiri Kosina memset(&parser->local, 0, sizeof(parser->local)); /* Reset the local parser environment */ 560dde5845aSJiri Kosina 561dde5845aSJiri Kosina return ret; 562dde5845aSJiri Kosina } 563dde5845aSJiri Kosina 564dde5845aSJiri Kosina /* 565dde5845aSJiri Kosina * Process a reserved item. 566dde5845aSJiri Kosina */ 567dde5845aSJiri Kosina 568dde5845aSJiri Kosina static int hid_parser_reserved(struct hid_parser *parser, struct hid_item *item) 569dde5845aSJiri Kosina { 57058037eb9SJiri Kosina dbg_hid("reserved item type, tag 0x%x\n", item->tag); 571dde5845aSJiri Kosina return 0; 572dde5845aSJiri Kosina } 573dde5845aSJiri Kosina 574dde5845aSJiri Kosina /* 575dde5845aSJiri Kosina * Free a report and all registered fields. The field->usage and 576dde5845aSJiri Kosina * field->value table's are allocated behind the field, so we need 577dde5845aSJiri Kosina * only to free(field) itself. 578dde5845aSJiri Kosina */ 579dde5845aSJiri Kosina 580dde5845aSJiri Kosina static void hid_free_report(struct hid_report *report) 581dde5845aSJiri Kosina { 582dde5845aSJiri Kosina unsigned n; 583dde5845aSJiri Kosina 584dde5845aSJiri Kosina for (n = 0; n < report->maxfield; n++) 585dde5845aSJiri Kosina kfree(report->field[n]); 586dde5845aSJiri Kosina kfree(report); 587dde5845aSJiri Kosina } 588dde5845aSJiri Kosina 589dde5845aSJiri Kosina /* 590a7197c2eSHenrik Rydberg * Close report. This function returns the device 591a7197c2eSHenrik Rydberg * state to the point prior to hid_open_report(). 592dde5845aSJiri Kosina */ 593a7197c2eSHenrik Rydberg static void hid_close_report(struct hid_device *device) 594dde5845aSJiri Kosina { 595dde5845aSJiri Kosina unsigned i, j; 596dde5845aSJiri Kosina 597dde5845aSJiri Kosina for (i = 0; i < HID_REPORT_TYPES; i++) { 598dde5845aSJiri Kosina struct hid_report_enum *report_enum = device->report_enum + i; 599dde5845aSJiri Kosina 60043622021SKees Cook for (j = 0; j < HID_MAX_IDS; j++) { 601dde5845aSJiri Kosina struct hid_report *report = report_enum->report_id_hash[j]; 602dde5845aSJiri Kosina if (report) 603dde5845aSJiri Kosina hid_free_report(report); 604dde5845aSJiri Kosina } 605a7197c2eSHenrik Rydberg memset(report_enum, 0, sizeof(*report_enum)); 606a7197c2eSHenrik Rydberg INIT_LIST_HEAD(&report_enum->report_list); 607dde5845aSJiri Kosina } 608dde5845aSJiri Kosina 609dde5845aSJiri Kosina kfree(device->rdesc); 610a7197c2eSHenrik Rydberg device->rdesc = NULL; 611a7197c2eSHenrik Rydberg device->rsize = 0; 612a7197c2eSHenrik Rydberg 613767fe787SJiri Kosina kfree(device->collection); 614a7197c2eSHenrik Rydberg device->collection = NULL; 615a7197c2eSHenrik Rydberg device->collection_size = 0; 616a7197c2eSHenrik Rydberg device->maxcollection = 0; 617a7197c2eSHenrik Rydberg device->maxapplication = 0; 618a7197c2eSHenrik Rydberg 619a7197c2eSHenrik Rydberg device->status &= ~HID_STAT_PARSED; 620a7197c2eSHenrik Rydberg } 621a7197c2eSHenrik Rydberg 622a7197c2eSHenrik Rydberg /* 623a7197c2eSHenrik Rydberg * Free a device structure, all reports, and all fields. 624a7197c2eSHenrik Rydberg */ 625a7197c2eSHenrik Rydberg 626a7197c2eSHenrik Rydberg static void hid_device_release(struct device *dev) 627a7197c2eSHenrik Rydberg { 628ee79a8f8SGeliang Tang struct hid_device *hid = to_hid_device(dev); 629a7197c2eSHenrik Rydberg 630a7197c2eSHenrik Rydberg hid_close_report(hid); 631a7197c2eSHenrik Rydberg kfree(hid->dev_rdesc); 632a7197c2eSHenrik Rydberg kfree(hid); 633dde5845aSJiri Kosina } 634dde5845aSJiri Kosina 635dde5845aSJiri Kosina /* 636dde5845aSJiri Kosina * Fetch a report description item from the data stream. We support long 637dde5845aSJiri Kosina * items, though they are not used yet. 638dde5845aSJiri Kosina */ 639dde5845aSJiri Kosina 640dde5845aSJiri Kosina static u8 *fetch_item(__u8 *start, __u8 *end, struct hid_item *item) 641dde5845aSJiri Kosina { 642dde5845aSJiri Kosina u8 b; 643dde5845aSJiri Kosina 644dde5845aSJiri Kosina if ((end - start) <= 0) 645dde5845aSJiri Kosina return NULL; 646dde5845aSJiri Kosina 647dde5845aSJiri Kosina b = *start++; 648dde5845aSJiri Kosina 649dde5845aSJiri Kosina item->type = (b >> 2) & 3; 650dde5845aSJiri Kosina item->tag = (b >> 4) & 15; 651dde5845aSJiri Kosina 652dde5845aSJiri Kosina if (item->tag == HID_ITEM_TAG_LONG) { 653dde5845aSJiri Kosina 654dde5845aSJiri Kosina item->format = HID_ITEM_FORMAT_LONG; 655dde5845aSJiri Kosina 656dde5845aSJiri Kosina if ((end - start) < 2) 657dde5845aSJiri Kosina return NULL; 658dde5845aSJiri Kosina 659dde5845aSJiri Kosina item->size = *start++; 660dde5845aSJiri Kosina item->tag = *start++; 661dde5845aSJiri Kosina 662dde5845aSJiri Kosina if ((end - start) < item->size) 663dde5845aSJiri Kosina return NULL; 664dde5845aSJiri Kosina 665dde5845aSJiri Kosina item->data.longdata = start; 666dde5845aSJiri Kosina start += item->size; 667dde5845aSJiri Kosina return start; 668dde5845aSJiri Kosina } 669dde5845aSJiri Kosina 670dde5845aSJiri Kosina item->format = HID_ITEM_FORMAT_SHORT; 671dde5845aSJiri Kosina item->size = b & 3; 672dde5845aSJiri Kosina 673dde5845aSJiri Kosina switch (item->size) { 674dde5845aSJiri Kosina case 0: 675dde5845aSJiri Kosina return start; 676dde5845aSJiri Kosina 677dde5845aSJiri Kosina case 1: 678dde5845aSJiri Kosina if ((end - start) < 1) 679dde5845aSJiri Kosina return NULL; 680dde5845aSJiri Kosina item->data.u8 = *start++; 681dde5845aSJiri Kosina return start; 682dde5845aSJiri Kosina 683dde5845aSJiri Kosina case 2: 684dde5845aSJiri Kosina if ((end - start) < 2) 685dde5845aSJiri Kosina return NULL; 686c105068fSHarvey Harrison item->data.u16 = get_unaligned_le16(start); 687dde5845aSJiri Kosina start = (__u8 *)((__le16 *)start + 1); 688dde5845aSJiri Kosina return start; 689dde5845aSJiri Kosina 690dde5845aSJiri Kosina case 3: 691dde5845aSJiri Kosina item->size++; 692dde5845aSJiri Kosina if ((end - start) < 4) 693dde5845aSJiri Kosina return NULL; 694c105068fSHarvey Harrison item->data.u32 = get_unaligned_le32(start); 695dde5845aSJiri Kosina start = (__u8 *)((__le32 *)start + 1); 696dde5845aSJiri Kosina return start; 697dde5845aSJiri Kosina } 698dde5845aSJiri Kosina 699dde5845aSJiri Kosina return NULL; 700dde5845aSJiri Kosina } 701dde5845aSJiri Kosina 7023dc8fc08SBenjamin Tissoires static void hid_scan_input_usage(struct hid_parser *parser, u32 usage) 703734c6609SHenrik Rydberg { 7043dc8fc08SBenjamin Tissoires struct hid_device *hid = parser->device; 7053dc8fc08SBenjamin Tissoires 7064fa3a583SHenrik Rydberg if (usage == HID_DG_CONTACTID) 7074fa3a583SHenrik Rydberg hid->group = HID_GROUP_MULTITOUCH; 708734c6609SHenrik Rydberg } 709734c6609SHenrik Rydberg 710f961bd35SBenjamin Tissoires static void hid_scan_feature_usage(struct hid_parser *parser, u32 usage) 711f961bd35SBenjamin Tissoires { 712f961bd35SBenjamin Tissoires if (usage == 0xff0000c5 && parser->global.report_count == 256 && 713f961bd35SBenjamin Tissoires parser->global.report_size == 8) 714f961bd35SBenjamin Tissoires parser->scan_flags |= HID_SCAN_FLAG_MT_WIN_8; 715f961bd35SBenjamin Tissoires } 716f961bd35SBenjamin Tissoires 7173dc8fc08SBenjamin Tissoires static void hid_scan_collection(struct hid_parser *parser, unsigned type) 7183dc8fc08SBenjamin Tissoires { 7193dc8fc08SBenjamin Tissoires struct hid_device *hid = parser->device; 720e39f2d59SAndrew Duggan int i; 7213dc8fc08SBenjamin Tissoires 7223dc8fc08SBenjamin Tissoires if (((parser->global.usage_page << 16) == HID_UP_SENSOR) && 7233dc8fc08SBenjamin Tissoires type == HID_COLLECTION_PHYSICAL) 7243dc8fc08SBenjamin Tissoires hid->group = HID_GROUP_SENSOR_HUB; 725be3b1634SAlan Wu 726be3b1634SAlan Wu if (hid->vendor == USB_VENDOR_ID_MICROSOFT && 7270439de75SStephen Just (hid->product == USB_DEVICE_ID_MS_TYPE_COVER_PRO_3 || 728c6956eb7SDonavan Lance hid->product == USB_DEVICE_ID_MS_TYPE_COVER_PRO_3_2 || 7290439de75SStephen Just hid->product == USB_DEVICE_ID_MS_TYPE_COVER_PRO_3_JP || 7300439de75SStephen Just hid->product == USB_DEVICE_ID_MS_TYPE_COVER_3 || 73118eec2cdSRaimund Roth hid->product == USB_DEVICE_ID_MS_POWER_COVER) && 732be3b1634SAlan Wu hid->group == HID_GROUP_MULTITOUCH) 733be3b1634SAlan Wu hid->group = HID_GROUP_GENERIC; 734e39f2d59SAndrew Duggan 735e39f2d59SAndrew Duggan if ((parser->global.usage_page << 16) == HID_UP_GENDESK) 736e39f2d59SAndrew Duggan for (i = 0; i < parser->local.usage_index; i++) 737e39f2d59SAndrew Duggan if (parser->local.usage[i] == HID_GD_POINTER) 738e39f2d59SAndrew Duggan parser->scan_flags |= HID_SCAN_FLAG_GD_POINTER; 739e39f2d59SAndrew Duggan 740e39f2d59SAndrew Duggan if ((parser->global.usage_page << 16) >= HID_UP_MSVENDOR) 741e39f2d59SAndrew Duggan parser->scan_flags |= HID_SCAN_FLAG_VENDOR_SPECIFIC; 7423dc8fc08SBenjamin Tissoires } 7433dc8fc08SBenjamin Tissoires 7443dc8fc08SBenjamin Tissoires static int hid_scan_main(struct hid_parser *parser, struct hid_item *item) 7453dc8fc08SBenjamin Tissoires { 7463dc8fc08SBenjamin Tissoires __u32 data; 7473dc8fc08SBenjamin Tissoires int i; 7483dc8fc08SBenjamin Tissoires 7493dc8fc08SBenjamin Tissoires data = item_udata(item); 7503dc8fc08SBenjamin Tissoires 7513dc8fc08SBenjamin Tissoires switch (item->tag) { 7523dc8fc08SBenjamin Tissoires case HID_MAIN_ITEM_TAG_BEGIN_COLLECTION: 7533dc8fc08SBenjamin Tissoires hid_scan_collection(parser, data & 0xff); 7543dc8fc08SBenjamin Tissoires break; 7553dc8fc08SBenjamin Tissoires case HID_MAIN_ITEM_TAG_END_COLLECTION: 7563dc8fc08SBenjamin Tissoires break; 7573dc8fc08SBenjamin Tissoires case HID_MAIN_ITEM_TAG_INPUT: 758e24d0d39SBenjamin Tissoires /* ignore constant inputs, they will be ignored by hid-input */ 759e24d0d39SBenjamin Tissoires if (data & HID_MAIN_ITEM_CONSTANT) 760e24d0d39SBenjamin Tissoires break; 7613dc8fc08SBenjamin Tissoires for (i = 0; i < parser->local.usage_index; i++) 7623dc8fc08SBenjamin Tissoires hid_scan_input_usage(parser, parser->local.usage[i]); 7633dc8fc08SBenjamin Tissoires break; 7643dc8fc08SBenjamin Tissoires case HID_MAIN_ITEM_TAG_OUTPUT: 7653dc8fc08SBenjamin Tissoires break; 7663dc8fc08SBenjamin Tissoires case HID_MAIN_ITEM_TAG_FEATURE: 767f961bd35SBenjamin Tissoires for (i = 0; i < parser->local.usage_index; i++) 768f961bd35SBenjamin Tissoires hid_scan_feature_usage(parser, parser->local.usage[i]); 7693dc8fc08SBenjamin Tissoires break; 7703dc8fc08SBenjamin Tissoires } 7713dc8fc08SBenjamin Tissoires 7723dc8fc08SBenjamin Tissoires /* Reset the local parser environment */ 7733dc8fc08SBenjamin Tissoires memset(&parser->local, 0, sizeof(parser->local)); 7743dc8fc08SBenjamin Tissoires 7753dc8fc08SBenjamin Tissoires return 0; 7763dc8fc08SBenjamin Tissoires } 7773dc8fc08SBenjamin Tissoires 778734c6609SHenrik Rydberg /* 779734c6609SHenrik Rydberg * Scan a report descriptor before the device is added to the bus. 780734c6609SHenrik Rydberg * Sets device groups and other properties that determine what driver 781734c6609SHenrik Rydberg * to load. 782734c6609SHenrik Rydberg */ 783734c6609SHenrik Rydberg static int hid_scan_report(struct hid_device *hid) 784734c6609SHenrik Rydberg { 7853dc8fc08SBenjamin Tissoires struct hid_parser *parser; 7863dc8fc08SBenjamin Tissoires struct hid_item item; 787734c6609SHenrik Rydberg __u8 *start = hid->dev_rdesc; 788734c6609SHenrik Rydberg __u8 *end = start + hid->dev_rsize; 7893dc8fc08SBenjamin Tissoires static int (*dispatch_type[])(struct hid_parser *parser, 7903dc8fc08SBenjamin Tissoires struct hid_item *item) = { 7913dc8fc08SBenjamin Tissoires hid_scan_main, 7923dc8fc08SBenjamin Tissoires hid_parser_global, 7933dc8fc08SBenjamin Tissoires hid_parser_local, 7943dc8fc08SBenjamin Tissoires hid_parser_reserved 7953dc8fc08SBenjamin Tissoires }; 796734c6609SHenrik Rydberg 7973dc8fc08SBenjamin Tissoires parser = vzalloc(sizeof(struct hid_parser)); 7983dc8fc08SBenjamin Tissoires if (!parser) 7993dc8fc08SBenjamin Tissoires return -ENOMEM; 8003dc8fc08SBenjamin Tissoires 8013dc8fc08SBenjamin Tissoires parser->device = hid; 802734c6609SHenrik Rydberg hid->group = HID_GROUP_GENERIC; 803734c6609SHenrik Rydberg 8043dc8fc08SBenjamin Tissoires /* 8053dc8fc08SBenjamin Tissoires * The parsing is simpler than the one in hid_open_report() as we should 8063dc8fc08SBenjamin Tissoires * be robust against hid errors. Those errors will be raised by 8073dc8fc08SBenjamin Tissoires * hid_open_report() anyway. 8083dc8fc08SBenjamin Tissoires */ 8093dc8fc08SBenjamin Tissoires while ((start = fetch_item(start, end, &item)) != NULL) 8103dc8fc08SBenjamin Tissoires dispatch_type[item.type](parser, &item); 8113dc8fc08SBenjamin Tissoires 812f961bd35SBenjamin Tissoires /* 813f961bd35SBenjamin Tissoires * Handle special flags set during scanning. 814f961bd35SBenjamin Tissoires */ 815f961bd35SBenjamin Tissoires if ((parser->scan_flags & HID_SCAN_FLAG_MT_WIN_8) && 816f961bd35SBenjamin Tissoires (hid->group == HID_GROUP_MULTITOUCH)) 817f961bd35SBenjamin Tissoires hid->group = HID_GROUP_MULTITOUCH_WIN_8; 818f961bd35SBenjamin Tissoires 819ba391e5aSBenjamin Tissoires /* 820ba391e5aSBenjamin Tissoires * Vendor specific handlings 821ba391e5aSBenjamin Tissoires */ 82229b47391SBenjamin Tissoires switch (hid->vendor) { 82329b47391SBenjamin Tissoires case USB_VENDOR_ID_WACOM: 82429b47391SBenjamin Tissoires hid->group = HID_GROUP_WACOM; 82529b47391SBenjamin Tissoires break; 826c241c5eeSBenjamin Tissoires case USB_VENDOR_ID_SYNAPTICS: 827e39f2d59SAndrew Duggan if (hid->group == HID_GROUP_GENERIC) 828e39f2d59SAndrew Duggan if ((parser->scan_flags & HID_SCAN_FLAG_VENDOR_SPECIFIC) 829e39f2d59SAndrew Duggan && (parser->scan_flags & HID_SCAN_FLAG_GD_POINTER)) 830e39f2d59SAndrew Duggan /* 831e39f2d59SAndrew Duggan * hid-rmi should take care of them, 832e39f2d59SAndrew Duggan * not hid-generic 833e39f2d59SAndrew Duggan */ 834c241c5eeSBenjamin Tissoires hid->group = HID_GROUP_RMI; 835c241c5eeSBenjamin Tissoires break; 83629b47391SBenjamin Tissoires } 83729b47391SBenjamin Tissoires 8383dc8fc08SBenjamin Tissoires vfree(parser); 839734c6609SHenrik Rydberg return 0; 840734c6609SHenrik Rydberg } 841734c6609SHenrik Rydberg 84285cdaf52SJiri Slaby /** 84385cdaf52SJiri Slaby * hid_parse_report - parse device report 84485cdaf52SJiri Slaby * 84585cdaf52SJiri Slaby * @device: hid device 84685cdaf52SJiri Slaby * @start: report start 84785cdaf52SJiri Slaby * @size: report size 84885cdaf52SJiri Slaby * 849a7197c2eSHenrik Rydberg * Allocate the device report as read by the bus driver. This function should 850a7197c2eSHenrik Rydberg * only be called from parse() in ll drivers. 851a7197c2eSHenrik Rydberg */ 852a7197c2eSHenrik Rydberg int hid_parse_report(struct hid_device *hid, __u8 *start, unsigned size) 853a7197c2eSHenrik Rydberg { 854a7197c2eSHenrik Rydberg hid->dev_rdesc = kmemdup(start, size, GFP_KERNEL); 855a7197c2eSHenrik Rydberg if (!hid->dev_rdesc) 856a7197c2eSHenrik Rydberg return -ENOMEM; 857a7197c2eSHenrik Rydberg hid->dev_rsize = size; 858a7197c2eSHenrik Rydberg return 0; 859a7197c2eSHenrik Rydberg } 860a7197c2eSHenrik Rydberg EXPORT_SYMBOL_GPL(hid_parse_report); 861a7197c2eSHenrik Rydberg 862331415ffSKees Cook static const char * const hid_report_names[] = { 863331415ffSKees Cook "HID_INPUT_REPORT", 864331415ffSKees Cook "HID_OUTPUT_REPORT", 865331415ffSKees Cook "HID_FEATURE_REPORT", 866331415ffSKees Cook }; 867331415ffSKees Cook /** 868331415ffSKees Cook * hid_validate_values - validate existing device report's value indexes 869331415ffSKees Cook * 870331415ffSKees Cook * @device: hid device 871331415ffSKees Cook * @type: which report type to examine 872331415ffSKees Cook * @id: which report ID to examine (0 for first) 873331415ffSKees Cook * @field_index: which report field to examine 874331415ffSKees Cook * @report_counts: expected number of values 875331415ffSKees Cook * 876331415ffSKees Cook * Validate the number of values in a given field of a given report, after 877331415ffSKees Cook * parsing. 878331415ffSKees Cook */ 879331415ffSKees Cook struct hid_report *hid_validate_values(struct hid_device *hid, 880331415ffSKees Cook unsigned int type, unsigned int id, 881331415ffSKees Cook unsigned int field_index, 882331415ffSKees Cook unsigned int report_counts) 883331415ffSKees Cook { 884331415ffSKees Cook struct hid_report *report; 885331415ffSKees Cook 886331415ffSKees Cook if (type > HID_FEATURE_REPORT) { 887331415ffSKees Cook hid_err(hid, "invalid HID report type %u\n", type); 888331415ffSKees Cook return NULL; 889331415ffSKees Cook } 890331415ffSKees Cook 891331415ffSKees Cook if (id >= HID_MAX_IDS) { 892331415ffSKees Cook hid_err(hid, "invalid HID report id %u\n", id); 893331415ffSKees Cook return NULL; 894331415ffSKees Cook } 895331415ffSKees Cook 896331415ffSKees Cook /* 897331415ffSKees Cook * Explicitly not using hid_get_report() here since it depends on 898331415ffSKees Cook * ->numbered being checked, which may not always be the case when 899331415ffSKees Cook * drivers go to access report values. 900331415ffSKees Cook */ 9011b15d2e5SKees Cook if (id == 0) { 9021b15d2e5SKees Cook /* 9031b15d2e5SKees Cook * Validating on id 0 means we should examine the first 9041b15d2e5SKees Cook * report in the list. 9051b15d2e5SKees Cook */ 9061b15d2e5SKees Cook report = list_entry( 9071b15d2e5SKees Cook hid->report_enum[type].report_list.next, 9081b15d2e5SKees Cook struct hid_report, list); 9091b15d2e5SKees Cook } else { 910331415ffSKees Cook report = hid->report_enum[type].report_id_hash[id]; 9111b15d2e5SKees Cook } 912331415ffSKees Cook if (!report) { 913331415ffSKees Cook hid_err(hid, "missing %s %u\n", hid_report_names[type], id); 914331415ffSKees Cook return NULL; 915331415ffSKees Cook } 916331415ffSKees Cook if (report->maxfield <= field_index) { 917331415ffSKees Cook hid_err(hid, "not enough fields in %s %u\n", 918331415ffSKees Cook hid_report_names[type], id); 919331415ffSKees Cook return NULL; 920331415ffSKees Cook } 921331415ffSKees Cook if (report->field[field_index]->report_count < report_counts) { 922331415ffSKees Cook hid_err(hid, "not enough values in %s %u field %u\n", 923331415ffSKees Cook hid_report_names[type], id, field_index); 924331415ffSKees Cook return NULL; 925331415ffSKees Cook } 926331415ffSKees Cook return report; 927331415ffSKees Cook } 928331415ffSKees Cook EXPORT_SYMBOL_GPL(hid_validate_values); 929331415ffSKees Cook 930a7197c2eSHenrik Rydberg /** 931a7197c2eSHenrik Rydberg * hid_open_report - open a driver-specific device report 932a7197c2eSHenrik Rydberg * 933a7197c2eSHenrik Rydberg * @device: hid device 934a7197c2eSHenrik Rydberg * 935dde5845aSJiri Kosina * Parse a report description into a hid_device structure. Reports are 936dde5845aSJiri Kosina * enumerated, fields are attached to these reports. 93785cdaf52SJiri Slaby * 0 returned on success, otherwise nonzero error value. 938a7197c2eSHenrik Rydberg * 939a7197c2eSHenrik Rydberg * This function (or the equivalent hid_parse() macro) should only be 940a7197c2eSHenrik Rydberg * called from probe() in drivers, before starting the device. 941dde5845aSJiri Kosina */ 942a7197c2eSHenrik Rydberg int hid_open_report(struct hid_device *device) 943dde5845aSJiri Kosina { 944dde5845aSJiri Kosina struct hid_parser *parser; 945dde5845aSJiri Kosina struct hid_item item; 946a7197c2eSHenrik Rydberg unsigned int size; 947a7197c2eSHenrik Rydberg __u8 *start; 94886e6b77eSKevin Daughtridge __u8 *buf; 949dde5845aSJiri Kosina __u8 *end; 95085cdaf52SJiri Slaby int ret; 951dde5845aSJiri Kosina static int (*dispatch_type[])(struct hid_parser *parser, 952dde5845aSJiri Kosina struct hid_item *item) = { 953dde5845aSJiri Kosina hid_parser_main, 954dde5845aSJiri Kosina hid_parser_global, 955dde5845aSJiri Kosina hid_parser_local, 956dde5845aSJiri Kosina hid_parser_reserved 957dde5845aSJiri Kosina }; 958dde5845aSJiri Kosina 959a7197c2eSHenrik Rydberg if (WARN_ON(device->status & HID_STAT_PARSED)) 960a7197c2eSHenrik Rydberg return -EBUSY; 961a7197c2eSHenrik Rydberg 962a7197c2eSHenrik Rydberg start = device->dev_rdesc; 963a7197c2eSHenrik Rydberg if (WARN_ON(!start)) 964a7197c2eSHenrik Rydberg return -ENODEV; 965a7197c2eSHenrik Rydberg size = device->dev_rsize; 966a7197c2eSHenrik Rydberg 96786e6b77eSKevin Daughtridge buf = kmemdup(start, size, GFP_KERNEL); 96886e6b77eSKevin Daughtridge if (buf == NULL) 96985cdaf52SJiri Slaby return -ENOMEM; 97086e6b77eSKevin Daughtridge 97186e6b77eSKevin Daughtridge if (device->driver->report_fixup) 97286e6b77eSKevin Daughtridge start = device->driver->report_fixup(device, buf, &size); 97386e6b77eSKevin Daughtridge else 97486e6b77eSKevin Daughtridge start = buf; 97586e6b77eSKevin Daughtridge 97686e6b77eSKevin Daughtridge start = kmemdup(start, size, GFP_KERNEL); 97786e6b77eSKevin Daughtridge kfree(buf); 97886e6b77eSKevin Daughtridge if (start == NULL) 97986e6b77eSKevin Daughtridge return -ENOMEM; 98086e6b77eSKevin Daughtridge 98186e6b77eSKevin Daughtridge device->rdesc = start; 982dde5845aSJiri Kosina device->rsize = size; 983dde5845aSJiri Kosina 984fe258020SJoe Perches parser = vzalloc(sizeof(struct hid_parser)); 98585cdaf52SJiri Slaby if (!parser) { 98685cdaf52SJiri Slaby ret = -ENOMEM; 98785cdaf52SJiri Slaby goto err; 988dde5845aSJiri Kosina } 98985cdaf52SJiri Slaby 990dde5845aSJiri Kosina parser->device = device; 991dde5845aSJiri Kosina 992dde5845aSJiri Kosina end = start + size; 993a7197c2eSHenrik Rydberg 994a7197c2eSHenrik Rydberg device->collection = kcalloc(HID_DEFAULT_NUM_COLLECTIONS, 995a7197c2eSHenrik Rydberg sizeof(struct hid_collection), GFP_KERNEL); 996a7197c2eSHenrik Rydberg if (!device->collection) { 997a7197c2eSHenrik Rydberg ret = -ENOMEM; 998a7197c2eSHenrik Rydberg goto err; 999a7197c2eSHenrik Rydberg } 1000a7197c2eSHenrik Rydberg device->collection_size = HID_DEFAULT_NUM_COLLECTIONS; 1001a7197c2eSHenrik Rydberg 100285cdaf52SJiri Slaby ret = -EINVAL; 1003dde5845aSJiri Kosina while ((start = fetch_item(start, end, &item)) != NULL) { 1004dde5845aSJiri Kosina 1005dde5845aSJiri Kosina if (item.format != HID_ITEM_FORMAT_SHORT) { 10068c3d52fcSJiri Kosina hid_err(device, "unexpected long global item\n"); 100785cdaf52SJiri Slaby goto err; 1008dde5845aSJiri Kosina } 1009dde5845aSJiri Kosina 1010dde5845aSJiri Kosina if (dispatch_type[item.type](parser, &item)) { 10118c3d52fcSJiri Kosina hid_err(device, "item %u %u %u %u parsing failed\n", 10124291ee30SJoe Perches item.format, (unsigned)item.size, 10134291ee30SJoe Perches (unsigned)item.type, (unsigned)item.tag); 101485cdaf52SJiri Slaby goto err; 1015dde5845aSJiri Kosina } 1016dde5845aSJiri Kosina 1017dde5845aSJiri Kosina if (start == end) { 1018dde5845aSJiri Kosina if (parser->collection_stack_ptr) { 10198c3d52fcSJiri Kosina hid_err(device, "unbalanced collection at end of report description\n"); 102085cdaf52SJiri Slaby goto err; 1021dde5845aSJiri Kosina } 1022dde5845aSJiri Kosina if (parser->local.delimiter_depth) { 10238c3d52fcSJiri Kosina hid_err(device, "unbalanced delimiter at end of report description\n"); 102485cdaf52SJiri Slaby goto err; 1025dde5845aSJiri Kosina } 102647a80edbSJiri Kosina vfree(parser); 1027a7197c2eSHenrik Rydberg device->status |= HID_STAT_PARSED; 102885cdaf52SJiri Slaby return 0; 1029dde5845aSJiri Kosina } 1030dde5845aSJiri Kosina } 1031dde5845aSJiri Kosina 10328c3d52fcSJiri Kosina hid_err(device, "item fetching failed at offset %d\n", (int)(end - start)); 103385cdaf52SJiri Slaby err: 103447a80edbSJiri Kosina vfree(parser); 1035a7197c2eSHenrik Rydberg hid_close_report(device); 103685cdaf52SJiri Slaby return ret; 1037dde5845aSJiri Kosina } 1038a7197c2eSHenrik Rydberg EXPORT_SYMBOL_GPL(hid_open_report); 1039dde5845aSJiri Kosina 1040dde5845aSJiri Kosina /* 1041dde5845aSJiri Kosina * Convert a signed n-bit integer to signed 32-bit integer. Common 1042dde5845aSJiri Kosina * cases are done through the compiler, the screwed things has to be 1043dde5845aSJiri Kosina * done by hand. 1044dde5845aSJiri Kosina */ 1045dde5845aSJiri Kosina 1046dde5845aSJiri Kosina static s32 snto32(__u32 value, unsigned n) 1047dde5845aSJiri Kosina { 1048dde5845aSJiri Kosina switch (n) { 1049dde5845aSJiri Kosina case 8: return ((__s8)value); 1050dde5845aSJiri Kosina case 16: return ((__s16)value); 1051dde5845aSJiri Kosina case 32: return ((__s32)value); 1052dde5845aSJiri Kosina } 1053dde5845aSJiri Kosina return value & (1 << (n - 1)) ? value | (-1 << n) : value; 1054dde5845aSJiri Kosina } 1055dde5845aSJiri Kosina 105677463838SBenjamin Tissoires s32 hid_snto32(__u32 value, unsigned n) 105777463838SBenjamin Tissoires { 105877463838SBenjamin Tissoires return snto32(value, n); 105977463838SBenjamin Tissoires } 106077463838SBenjamin Tissoires EXPORT_SYMBOL_GPL(hid_snto32); 106177463838SBenjamin Tissoires 1062dde5845aSJiri Kosina /* 1063dde5845aSJiri Kosina * Convert a signed 32-bit integer to a signed n-bit integer. 1064dde5845aSJiri Kosina */ 1065dde5845aSJiri Kosina 1066dde5845aSJiri Kosina static u32 s32ton(__s32 value, unsigned n) 1067dde5845aSJiri Kosina { 1068dde5845aSJiri Kosina s32 a = value >> (n - 1); 1069dde5845aSJiri Kosina if (a && a != -1) 1070dde5845aSJiri Kosina return value < 0 ? 1 << (n - 1) : (1 << (n - 1)) - 1; 1071dde5845aSJiri Kosina return value & ((1 << n) - 1); 1072dde5845aSJiri Kosina } 1073dde5845aSJiri Kosina 1074dde5845aSJiri Kosina /* 1075dde5845aSJiri Kosina * Extract/implement a data field from/to a little endian report (bit array). 1076dde5845aSJiri Kosina * 1077dde5845aSJiri Kosina * Code sort-of follows HID spec: 1078*5137b354SDmitry Torokhov * http://www.usb.org/developers/hidpage/HID1_11.pdf 1079dde5845aSJiri Kosina * 1080dde5845aSJiri Kosina * While the USB HID spec allows unlimited length bit fields in "report 1081dde5845aSJiri Kosina * descriptors", most devices never use more than 16 bits. 1082dde5845aSJiri Kosina * One model of UPS is claimed to report "LINEV" as a 32-bit field. 1083dde5845aSJiri Kosina * Search linux-kernel and linux-usb-devel archives for "hid-core extract". 1084dde5845aSJiri Kosina */ 1085dde5845aSJiri Kosina 1086*5137b354SDmitry Torokhov static u32 __extract(u8 *report, unsigned offset, int n) 1087*5137b354SDmitry Torokhov { 1088*5137b354SDmitry Torokhov unsigned int idx = offset / 8; 1089*5137b354SDmitry Torokhov unsigned int bit_nr = 0; 1090*5137b354SDmitry Torokhov unsigned int bit_shift = offset % 8; 1091*5137b354SDmitry Torokhov int bits_to_copy = 8 - bit_shift; 1092*5137b354SDmitry Torokhov u32 value = 0; 1093*5137b354SDmitry Torokhov u32 mask = n < 32 ? (1U << n) - 1 : ~0U; 1094*5137b354SDmitry Torokhov 1095*5137b354SDmitry Torokhov while (n > 0) { 1096*5137b354SDmitry Torokhov value |= ((u32)report[idx] >> bit_shift) << bit_nr; 1097*5137b354SDmitry Torokhov n -= bits_to_copy; 1098*5137b354SDmitry Torokhov bit_nr += bits_to_copy; 1099*5137b354SDmitry Torokhov bits_to_copy = 8; 1100*5137b354SDmitry Torokhov bit_shift = 0; 1101*5137b354SDmitry Torokhov idx++; 1102*5137b354SDmitry Torokhov } 1103*5137b354SDmitry Torokhov 1104*5137b354SDmitry Torokhov return value & mask; 1105*5137b354SDmitry Torokhov } 1106*5137b354SDmitry Torokhov 1107*5137b354SDmitry Torokhov u32 hid_field_extract(const struct hid_device *hid, u8 *report, 11084291ee30SJoe Perches unsigned offset, unsigned n) 1109dde5845aSJiri Kosina { 1110*5137b354SDmitry Torokhov if (n > 32) { 111104fba786SGoffredo Baroncelli hid_warn(hid, "hid_field_extract() called with n (%d) > 32! (%s)\n", 1112c4124c9bSJiri Kosina n, current->comm); 1113*5137b354SDmitry Torokhov n = 32; 1114*5137b354SDmitry Torokhov } 1115dde5845aSJiri Kosina 1116*5137b354SDmitry Torokhov return __extract(report, offset, n); 1117dde5845aSJiri Kosina } 111804fba786SGoffredo Baroncelli EXPORT_SYMBOL_GPL(hid_field_extract); 1119dde5845aSJiri Kosina 1120dde5845aSJiri Kosina /* 1121dde5845aSJiri Kosina * "implement" : set bits in a little endian bit stream. 1122dde5845aSJiri Kosina * Same concepts as "extract" (see comments above). 1123dde5845aSJiri Kosina * The data mangled in the bit stream remains in little endian 1124dde5845aSJiri Kosina * order the whole time. It make more sense to talk about 1125dde5845aSJiri Kosina * endianness of register values by considering a register 1126*5137b354SDmitry Torokhov * a "cached" copy of the little endian bit stream. 1127dde5845aSJiri Kosina */ 1128dde5845aSJiri Kosina 1129*5137b354SDmitry Torokhov static void __implement(u8 *report, unsigned offset, int n, u32 value) 1130*5137b354SDmitry Torokhov { 1131*5137b354SDmitry Torokhov unsigned int idx = offset / 8; 1132*5137b354SDmitry Torokhov unsigned int size = offset + n; 1133*5137b354SDmitry Torokhov unsigned int bit_shift = offset % 8; 1134*5137b354SDmitry Torokhov int bits_to_set = 8 - bit_shift; 1135*5137b354SDmitry Torokhov u8 bit_mask = 0xff << bit_shift; 1136*5137b354SDmitry Torokhov 1137*5137b354SDmitry Torokhov while (n - bits_to_set >= 0) { 1138*5137b354SDmitry Torokhov report[idx] &= ~bit_mask; 1139*5137b354SDmitry Torokhov report[idx] |= value << bit_shift; 1140*5137b354SDmitry Torokhov value >>= bits_to_set; 1141*5137b354SDmitry Torokhov n -= bits_to_set; 1142*5137b354SDmitry Torokhov bits_to_set = 8; 1143*5137b354SDmitry Torokhov bit_mask = 0xff; 1144*5137b354SDmitry Torokhov bit_shift = 0; 1145*5137b354SDmitry Torokhov idx++; 1146*5137b354SDmitry Torokhov } 1147*5137b354SDmitry Torokhov 1148*5137b354SDmitry Torokhov /* last nibble */ 1149*5137b354SDmitry Torokhov if (n) { 1150*5137b354SDmitry Torokhov if (size % 8) 1151*5137b354SDmitry Torokhov bit_mask &= (1U << (size % 8)) - 1; 1152*5137b354SDmitry Torokhov report[idx] &= ~bit_mask; 1153*5137b354SDmitry Torokhov report[idx] |= (value << bit_shift) & bit_mask; 1154*5137b354SDmitry Torokhov } 1155*5137b354SDmitry Torokhov } 1156*5137b354SDmitry Torokhov 1157*5137b354SDmitry Torokhov static void implement(const struct hid_device *hid, u8 *report, 1158*5137b354SDmitry Torokhov unsigned offset, unsigned n, u32 value) 1159*5137b354SDmitry Torokhov { 1160*5137b354SDmitry Torokhov u64 m; 1161*5137b354SDmitry Torokhov 1162*5137b354SDmitry Torokhov if (n > 32) { 11634291ee30SJoe Perches hid_warn(hid, "%s() called with n (%d) > 32! (%s)\n", 11644291ee30SJoe Perches __func__, n, current->comm); 1165*5137b354SDmitry Torokhov n = 32; 1166*5137b354SDmitry Torokhov } 1167dde5845aSJiri Kosina 1168*5137b354SDmitry Torokhov m = (1ULL << n) - 1; 1169c4124c9bSJiri Kosina if (value > m) 11704291ee30SJoe Perches hid_warn(hid, "%s() called with too large value %d! (%s)\n", 11714291ee30SJoe Perches __func__, value, current->comm); 1172dde5845aSJiri Kosina WARN_ON(value > m); 1173dde5845aSJiri Kosina value &= m; 1174dde5845aSJiri Kosina 1175*5137b354SDmitry Torokhov __implement(report, offset, n, value); 1176dde5845aSJiri Kosina } 1177dde5845aSJiri Kosina 1178dde5845aSJiri Kosina /* 1179dde5845aSJiri Kosina * Search an array for a value. 1180dde5845aSJiri Kosina */ 1181dde5845aSJiri Kosina 118216ee4cc8SJoe Perches static int search(__s32 *array, __s32 value, unsigned n) 1183dde5845aSJiri Kosina { 1184dde5845aSJiri Kosina while (n--) { 1185dde5845aSJiri Kosina if (*array++ == value) 1186dde5845aSJiri Kosina return 0; 1187dde5845aSJiri Kosina } 1188dde5845aSJiri Kosina return -1; 1189dde5845aSJiri Kosina } 1190dde5845aSJiri Kosina 119185cdaf52SJiri Slaby /** 119285cdaf52SJiri Slaby * hid_match_report - check if driver's raw_event should be called 119385cdaf52SJiri Slaby * 119485cdaf52SJiri Slaby * @hid: hid device 119585cdaf52SJiri Slaby * @report_type: type to match against 119685cdaf52SJiri Slaby * 119785cdaf52SJiri Slaby * compare hid->driver->report_table->report_type to report->type 119885cdaf52SJiri Slaby */ 119985cdaf52SJiri Slaby static int hid_match_report(struct hid_device *hid, struct hid_report *report) 1200dde5845aSJiri Kosina { 120185cdaf52SJiri Slaby const struct hid_report_id *id = hid->driver->report_table; 120285cdaf52SJiri Slaby 120385cdaf52SJiri Slaby if (!id) /* NULL means all */ 120485cdaf52SJiri Slaby return 1; 120585cdaf52SJiri Slaby 120685cdaf52SJiri Slaby for (; id->report_type != HID_TERMINATOR; id++) 120785cdaf52SJiri Slaby if (id->report_type == HID_ANY_ID || 120885cdaf52SJiri Slaby id->report_type == report->type) 120985cdaf52SJiri Slaby return 1; 121085cdaf52SJiri Slaby return 0; 121185cdaf52SJiri Slaby } 121285cdaf52SJiri Slaby 121385cdaf52SJiri Slaby /** 121485cdaf52SJiri Slaby * hid_match_usage - check if driver's event should be called 121585cdaf52SJiri Slaby * 121685cdaf52SJiri Slaby * @hid: hid device 121785cdaf52SJiri Slaby * @usage: usage to match against 121885cdaf52SJiri Slaby * 121985cdaf52SJiri Slaby * compare hid->driver->usage_table->usage_{type,code} to 122085cdaf52SJiri Slaby * usage->usage_{type,code} 122185cdaf52SJiri Slaby */ 122285cdaf52SJiri Slaby static int hid_match_usage(struct hid_device *hid, struct hid_usage *usage) 122385cdaf52SJiri Slaby { 122485cdaf52SJiri Slaby const struct hid_usage_id *id = hid->driver->usage_table; 122585cdaf52SJiri Slaby 122685cdaf52SJiri Slaby if (!id) /* NULL means all */ 122785cdaf52SJiri Slaby return 1; 122885cdaf52SJiri Slaby 122985cdaf52SJiri Slaby for (; id->usage_type != HID_ANY_ID - 1; id++) 123085cdaf52SJiri Slaby if ((id->usage_hid == HID_ANY_ID || 123185cdaf52SJiri Slaby id->usage_hid == usage->hid) && 123285cdaf52SJiri Slaby (id->usage_type == HID_ANY_ID || 123385cdaf52SJiri Slaby id->usage_type == usage->type) && 123485cdaf52SJiri Slaby (id->usage_code == HID_ANY_ID || 123585cdaf52SJiri Slaby id->usage_code == usage->code)) 123685cdaf52SJiri Slaby return 1; 123785cdaf52SJiri Slaby return 0; 123885cdaf52SJiri Slaby } 123985cdaf52SJiri Slaby 124085cdaf52SJiri Slaby static void hid_process_event(struct hid_device *hid, struct hid_field *field, 124185cdaf52SJiri Slaby struct hid_usage *usage, __s32 value, int interrupt) 124285cdaf52SJiri Slaby { 124385cdaf52SJiri Slaby struct hid_driver *hdrv = hid->driver; 124485cdaf52SJiri Slaby int ret; 124585cdaf52SJiri Slaby 12469bfc8da0SHenrik Rydberg if (!list_empty(&hid->debug_list)) 1247cd667ce2SJiri Kosina hid_dump_input(hid, usage, value); 124885cdaf52SJiri Slaby 124985cdaf52SJiri Slaby if (hdrv && hdrv->event && hid_match_usage(hid, usage)) { 125085cdaf52SJiri Slaby ret = hdrv->event(hid, field, usage, value); 125185cdaf52SJiri Slaby if (ret != 0) { 125285cdaf52SJiri Slaby if (ret < 0) 12538c3d52fcSJiri Kosina hid_err(hid, "%s's event failed with %d\n", 125485cdaf52SJiri Slaby hdrv->name, ret); 125585cdaf52SJiri Slaby return; 125685cdaf52SJiri Slaby } 125785cdaf52SJiri Slaby } 125885cdaf52SJiri Slaby 1259dde5845aSJiri Kosina if (hid->claimed & HID_CLAIMED_INPUT) 1260dde5845aSJiri Kosina hidinput_hid_event(hid, field, usage, value); 1261aa938f79SJiri Kosina if (hid->claimed & HID_CLAIMED_HIDDEV && interrupt && hid->hiddev_hid_event) 1262aa938f79SJiri Kosina hid->hiddev_hid_event(hid, field, usage, value); 1263dde5845aSJiri Kosina } 1264dde5845aSJiri Kosina 1265dde5845aSJiri Kosina /* 1266dde5845aSJiri Kosina * Analyse a received field, and fetch the data from it. The field 1267dde5845aSJiri Kosina * content is stored for next report processing (we do differential 1268dde5845aSJiri Kosina * reporting to the layer). 1269dde5845aSJiri Kosina */ 1270dde5845aSJiri Kosina 1271abdff0f7SAdrian Bunk static void hid_input_field(struct hid_device *hid, struct hid_field *field, 1272abdff0f7SAdrian Bunk __u8 *data, int interrupt) 1273dde5845aSJiri Kosina { 1274dde5845aSJiri Kosina unsigned n; 1275dde5845aSJiri Kosina unsigned count = field->report_count; 1276dde5845aSJiri Kosina unsigned offset = field->report_offset; 1277dde5845aSJiri Kosina unsigned size = field->report_size; 1278dde5845aSJiri Kosina __s32 min = field->logical_minimum; 1279dde5845aSJiri Kosina __s32 max = field->logical_maximum; 1280dde5845aSJiri Kosina __s32 *value; 1281dde5845aSJiri Kosina 1282a3789a17SJoe Perches value = kmalloc(sizeof(__s32) * count, GFP_ATOMIC); 1283a3789a17SJoe Perches if (!value) 1284dde5845aSJiri Kosina return; 1285dde5845aSJiri Kosina 1286dde5845aSJiri Kosina for (n = 0; n < count; n++) { 1287dde5845aSJiri Kosina 12884291ee30SJoe Perches value[n] = min < 0 ? 128904fba786SGoffredo Baroncelli snto32(hid_field_extract(hid, data, offset + n * size, 129004fba786SGoffredo Baroncelli size), size) : 129104fba786SGoffredo Baroncelli hid_field_extract(hid, data, offset + n * size, size); 1292dde5845aSJiri Kosina 12934291ee30SJoe Perches /* Ignore report if ErrorRollOver */ 12944291ee30SJoe Perches if (!(field->flags & HID_MAIN_ITEM_VARIABLE) && 12954291ee30SJoe Perches value[n] >= min && value[n] <= max && 12964291ee30SJoe Perches field->usage[value[n] - min].hid == HID_UP_KEYBOARD + 1) 1297dde5845aSJiri Kosina goto exit; 1298dde5845aSJiri Kosina } 1299dde5845aSJiri Kosina 1300dde5845aSJiri Kosina for (n = 0; n < count; n++) { 1301dde5845aSJiri Kosina 1302dde5845aSJiri Kosina if (HID_MAIN_ITEM_VARIABLE & field->flags) { 1303dde5845aSJiri Kosina hid_process_event(hid, field, &field->usage[n], value[n], interrupt); 1304dde5845aSJiri Kosina continue; 1305dde5845aSJiri Kosina } 1306dde5845aSJiri Kosina 1307dde5845aSJiri Kosina if (field->value[n] >= min && field->value[n] <= max 1308dde5845aSJiri Kosina && field->usage[field->value[n] - min].hid 1309dde5845aSJiri Kosina && search(value, field->value[n], count)) 1310dde5845aSJiri Kosina hid_process_event(hid, field, &field->usage[field->value[n] - min], 0, interrupt); 1311dde5845aSJiri Kosina 1312dde5845aSJiri Kosina if (value[n] >= min && value[n] <= max 1313dde5845aSJiri Kosina && field->usage[value[n] - min].hid 1314dde5845aSJiri Kosina && search(field->value, value[n], count)) 1315dde5845aSJiri Kosina hid_process_event(hid, field, &field->usage[value[n] - min], 1, interrupt); 1316dde5845aSJiri Kosina } 1317dde5845aSJiri Kosina 1318dde5845aSJiri Kosina memcpy(field->value, value, count * sizeof(__s32)); 1319dde5845aSJiri Kosina exit: 1320dde5845aSJiri Kosina kfree(value); 1321dde5845aSJiri Kosina } 1322dde5845aSJiri Kosina 1323dde5845aSJiri Kosina /* 1324dde5845aSJiri Kosina * Output the field into the report. 1325dde5845aSJiri Kosina */ 1326dde5845aSJiri Kosina 13274291ee30SJoe Perches static void hid_output_field(const struct hid_device *hid, 13284291ee30SJoe Perches struct hid_field *field, __u8 *data) 1329dde5845aSJiri Kosina { 1330dde5845aSJiri Kosina unsigned count = field->report_count; 1331dde5845aSJiri Kosina unsigned offset = field->report_offset; 1332dde5845aSJiri Kosina unsigned size = field->report_size; 1333dde5845aSJiri Kosina unsigned n; 1334dde5845aSJiri Kosina 1335dde5845aSJiri Kosina for (n = 0; n < count; n++) { 1336dde5845aSJiri Kosina if (field->logical_minimum < 0) /* signed values */ 13374291ee30SJoe Perches implement(hid, data, offset + n * size, size, 13384291ee30SJoe Perches s32ton(field->value[n], size)); 1339dde5845aSJiri Kosina else /* unsigned values */ 13404291ee30SJoe Perches implement(hid, data, offset + n * size, size, 13414291ee30SJoe Perches field->value[n]); 1342dde5845aSJiri Kosina } 1343dde5845aSJiri Kosina } 1344dde5845aSJiri Kosina 1345dde5845aSJiri Kosina /* 134627ce4050SJiri Kosina * Create a report. 'data' has to be allocated using 134727ce4050SJiri Kosina * hid_alloc_report_buf() so that it has proper size. 1348dde5845aSJiri Kosina */ 1349dde5845aSJiri Kosina 1350229695e5SJiri Kosina void hid_output_report(struct hid_report *report, __u8 *data) 1351dde5845aSJiri Kosina { 1352dde5845aSJiri Kosina unsigned n; 1353dde5845aSJiri Kosina 1354dde5845aSJiri Kosina if (report->id > 0) 1355dde5845aSJiri Kosina *data++ = report->id; 1356dde5845aSJiri Kosina 135775c28df8SPete Zaitcev memset(data, 0, ((report->size - 1) >> 3) + 1); 1358dde5845aSJiri Kosina for (n = 0; n < report->maxfield; n++) 13594291ee30SJoe Perches hid_output_field(report->device, report->field[n], data); 1360dde5845aSJiri Kosina } 1361229695e5SJiri Kosina EXPORT_SYMBOL_GPL(hid_output_report); 1362dde5845aSJiri Kosina 1363dde5845aSJiri Kosina /* 136427ce4050SJiri Kosina * Allocator for buffer that is going to be passed to hid_output_report() 136527ce4050SJiri Kosina */ 136627ce4050SJiri Kosina u8 *hid_alloc_report_buf(struct hid_report *report, gfp_t flags) 136727ce4050SJiri Kosina { 136827ce4050SJiri Kosina /* 136927ce4050SJiri Kosina * 7 extra bytes are necessary to achieve proper functionality 137027ce4050SJiri Kosina * of implement() working on 8 byte chunks 137127ce4050SJiri Kosina */ 137227ce4050SJiri Kosina 137319e4ec52SBenjamin Tissoires int len = hid_report_len(report) + 7; 137427ce4050SJiri Kosina 137527ce4050SJiri Kosina return kmalloc(len, flags); 137627ce4050SJiri Kosina } 137727ce4050SJiri Kosina EXPORT_SYMBOL_GPL(hid_alloc_report_buf); 137827ce4050SJiri Kosina 137927ce4050SJiri Kosina /* 1380dde5845aSJiri Kosina * Set a field value. The report this field belongs to has to be 1381dde5845aSJiri Kosina * created and transferred to the device, to set this value in the 1382dde5845aSJiri Kosina * device. 1383dde5845aSJiri Kosina */ 1384dde5845aSJiri Kosina 1385dde5845aSJiri Kosina int hid_set_field(struct hid_field *field, unsigned offset, __s32 value) 1386dde5845aSJiri Kosina { 1387be67b68dSKees Cook unsigned size; 1388be67b68dSKees Cook 1389be67b68dSKees Cook if (!field) 1390be67b68dSKees Cook return -1; 1391be67b68dSKees Cook 1392be67b68dSKees Cook size = field->report_size; 1393dde5845aSJiri Kosina 1394cd667ce2SJiri Kosina hid_dump_input(field->report->device, field->usage + offset, value); 1395dde5845aSJiri Kosina 1396dde5845aSJiri Kosina if (offset >= field->report_count) { 13978c3d52fcSJiri Kosina hid_err(field->report->device, "offset (%d) exceeds report_count (%d)\n", 13988c3d52fcSJiri Kosina offset, field->report_count); 1399dde5845aSJiri Kosina return -1; 1400dde5845aSJiri Kosina } 1401dde5845aSJiri Kosina if (field->logical_minimum < 0) { 1402dde5845aSJiri Kosina if (value != snto32(s32ton(value, size), size)) { 14038c3d52fcSJiri Kosina hid_err(field->report->device, "value %d is out of range\n", value); 1404dde5845aSJiri Kosina return -1; 1405dde5845aSJiri Kosina } 1406dde5845aSJiri Kosina } 1407dde5845aSJiri Kosina field->value[offset] = value; 1408dde5845aSJiri Kosina return 0; 1409dde5845aSJiri Kosina } 1410229695e5SJiri Kosina EXPORT_SYMBOL_GPL(hid_set_field); 1411dde5845aSJiri Kosina 141285cdaf52SJiri Slaby static struct hid_report *hid_get_report(struct hid_report_enum *report_enum, 141385cdaf52SJiri Slaby const u8 *data) 141485cdaf52SJiri Slaby { 141585cdaf52SJiri Slaby struct hid_report *report; 141685cdaf52SJiri Slaby unsigned int n = 0; /* Normally report number is 0 */ 141785cdaf52SJiri Slaby 141885cdaf52SJiri Slaby /* Device uses numbered reports, data[0] is report number */ 141985cdaf52SJiri Slaby if (report_enum->numbered) 142085cdaf52SJiri Slaby n = *data; 142185cdaf52SJiri Slaby 142285cdaf52SJiri Slaby report = report_enum->report_id_hash[n]; 142385cdaf52SJiri Slaby if (report == NULL) 142485cdaf52SJiri Slaby dbg_hid("undefined report_id %u received\n", n); 142585cdaf52SJiri Slaby 142685cdaf52SJiri Slaby return report; 142785cdaf52SJiri Slaby } 142885cdaf52SJiri Slaby 14294fa5a7f7SBenjamin Tissoires /* 14304fa5a7f7SBenjamin Tissoires * Implement a generic .request() callback, using .raw_request() 14314fa5a7f7SBenjamin Tissoires * DO NOT USE in hid drivers directly, but through hid_hw_request instead. 14324fa5a7f7SBenjamin Tissoires */ 14334fa5a7f7SBenjamin Tissoires void __hid_request(struct hid_device *hid, struct hid_report *report, 14344fa5a7f7SBenjamin Tissoires int reqtype) 14354fa5a7f7SBenjamin Tissoires { 14364fa5a7f7SBenjamin Tissoires char *buf; 14374fa5a7f7SBenjamin Tissoires int ret; 14384fa5a7f7SBenjamin Tissoires int len; 14394fa5a7f7SBenjamin Tissoires 14404fa5a7f7SBenjamin Tissoires buf = hid_alloc_report_buf(report, GFP_KERNEL); 14414fa5a7f7SBenjamin Tissoires if (!buf) 14424fa5a7f7SBenjamin Tissoires return; 14434fa5a7f7SBenjamin Tissoires 14444fa5a7f7SBenjamin Tissoires len = hid_report_len(report); 14454fa5a7f7SBenjamin Tissoires 14464fa5a7f7SBenjamin Tissoires if (reqtype == HID_REQ_SET_REPORT) 14474fa5a7f7SBenjamin Tissoires hid_output_report(report, buf); 14484fa5a7f7SBenjamin Tissoires 14494fa5a7f7SBenjamin Tissoires ret = hid->ll_driver->raw_request(hid, report->id, buf, len, 14504fa5a7f7SBenjamin Tissoires report->type, reqtype); 14514fa5a7f7SBenjamin Tissoires if (ret < 0) { 14524fa5a7f7SBenjamin Tissoires dbg_hid("unable to complete request: %d\n", ret); 14534fa5a7f7SBenjamin Tissoires goto out; 14544fa5a7f7SBenjamin Tissoires } 14554fa5a7f7SBenjamin Tissoires 14564fa5a7f7SBenjamin Tissoires if (reqtype == HID_REQ_GET_REPORT) 14574fa5a7f7SBenjamin Tissoires hid_input_report(hid, report->type, buf, ret, 0); 14584fa5a7f7SBenjamin Tissoires 14594fa5a7f7SBenjamin Tissoires out: 14604fa5a7f7SBenjamin Tissoires kfree(buf); 14614fa5a7f7SBenjamin Tissoires } 14624fa5a7f7SBenjamin Tissoires EXPORT_SYMBOL_GPL(__hid_request); 14634fa5a7f7SBenjamin Tissoires 1464b6787242SJiri Kosina int hid_report_raw_event(struct hid_device *hid, int type, u8 *data, int size, 146585cdaf52SJiri Slaby int interrupt) 1466aa8de2f0SJiri Kosina { 1467aa8de2f0SJiri Kosina struct hid_report_enum *report_enum = hid->report_enum + type; 1468aa8de2f0SJiri Kosina struct hid_report *report; 14696d85d037SBenjamin Tissoires struct hid_driver *hdrv; 147085cdaf52SJiri Slaby unsigned int a; 147185cdaf52SJiri Slaby int rsize, csize = size; 147285cdaf52SJiri Slaby u8 *cdata = data; 1473b6787242SJiri Kosina int ret = 0; 1474aa8de2f0SJiri Kosina 147585cdaf52SJiri Slaby report = hid_get_report(report_enum, data); 147685cdaf52SJiri Slaby if (!report) 1477b6787242SJiri Kosina goto out; 1478aa8de2f0SJiri Kosina 147985cdaf52SJiri Slaby if (report_enum->numbered) { 148085cdaf52SJiri Slaby cdata++; 148185cdaf52SJiri Slaby csize--; 1482aa8de2f0SJiri Kosina } 1483aa8de2f0SJiri Kosina 1484aa8de2f0SJiri Kosina rsize = ((report->size - 1) >> 3) + 1; 1485aa8de2f0SJiri Kosina 1486966922f2SArmando Visconti if (rsize > HID_MAX_BUFFER_SIZE) 1487966922f2SArmando Visconti rsize = HID_MAX_BUFFER_SIZE; 1488966922f2SArmando Visconti 148985cdaf52SJiri Slaby if (csize < rsize) { 149085cdaf52SJiri Slaby dbg_hid("report %d is too short, (%d < %d)\n", report->id, 149185cdaf52SJiri Slaby csize, rsize); 149285cdaf52SJiri Slaby memset(cdata + csize, 0, rsize - csize); 1493aa8de2f0SJiri Kosina } 1494aa8de2f0SJiri Kosina 1495aa8de2f0SJiri Kosina if ((hid->claimed & HID_CLAIMED_HIDDEV) && hid->hiddev_report_event) 1496aa8de2f0SJiri Kosina hid->hiddev_report_event(hid, report); 1497b6787242SJiri Kosina if (hid->claimed & HID_CLAIMED_HIDRAW) { 1498b6787242SJiri Kosina ret = hidraw_report_event(hid, data, size); 1499b6787242SJiri Kosina if (ret) 1500b6787242SJiri Kosina goto out; 1501b6787242SJiri Kosina } 1502aa8de2f0SJiri Kosina 1503cc6b54aaSBenjamin Tissoires if (hid->claimed != HID_CLAIMED_HIDRAW && report->maxfield) { 150485cdaf52SJiri Slaby for (a = 0; a < report->maxfield; a++) 150585cdaf52SJiri Slaby hid_input_field(hid, report->field[a], cdata, interrupt); 15066d85d037SBenjamin Tissoires hdrv = hid->driver; 15076d85d037SBenjamin Tissoires if (hdrv && hdrv->report) 15086d85d037SBenjamin Tissoires hdrv->report(hid, report); 1509b94e3c94SMatthieu CASTET } 1510aa8de2f0SJiri Kosina 1511aa8de2f0SJiri Kosina if (hid->claimed & HID_CLAIMED_INPUT) 1512aa8de2f0SJiri Kosina hidinput_report_event(hid, report); 1513b6787242SJiri Kosina out: 1514b6787242SJiri Kosina return ret; 151585cdaf52SJiri Slaby } 151685cdaf52SJiri Slaby EXPORT_SYMBOL_GPL(hid_report_raw_event); 151785cdaf52SJiri Slaby 151885cdaf52SJiri Slaby /** 151985cdaf52SJiri Slaby * hid_input_report - report data from lower layer (usb, bt...) 152085cdaf52SJiri Slaby * 152185cdaf52SJiri Slaby * @hid: hid device 152285cdaf52SJiri Slaby * @type: HID report type (HID_*_REPORT) 152385cdaf52SJiri Slaby * @data: report contents 152485cdaf52SJiri Slaby * @size: size of data parameter 1525ff9b00a2SJiri Kosina * @interrupt: distinguish between interrupt and control transfers 152685cdaf52SJiri Slaby * 152785cdaf52SJiri Slaby * This is data entry for lower layers. 152885cdaf52SJiri Slaby */ 152985cdaf52SJiri Slaby int hid_input_report(struct hid_device *hid, int type, u8 *data, int size, int interrupt) 153085cdaf52SJiri Slaby { 153176c317d6SJulia Lawall struct hid_report_enum *report_enum; 153276c317d6SJulia Lawall struct hid_driver *hdrv; 153385cdaf52SJiri Slaby struct hid_report *report; 153445dc1ac7SJiri Kosina int ret = 0; 153585cdaf52SJiri Slaby 15364ea54542SDavid Herrmann if (!hid) 153785cdaf52SJiri Slaby return -ENODEV; 15384ea54542SDavid Herrmann 1539c849a614SAndrew de los Reyes if (down_trylock(&hid->driver_input_lock)) 15404ea54542SDavid Herrmann return -EBUSY; 15414ea54542SDavid Herrmann 15424ea54542SDavid Herrmann if (!hid->driver) { 15434ea54542SDavid Herrmann ret = -ENODEV; 15444ea54542SDavid Herrmann goto unlock; 15454ea54542SDavid Herrmann } 154676c317d6SJulia Lawall report_enum = hid->report_enum + type; 154776c317d6SJulia Lawall hdrv = hid->driver; 154885cdaf52SJiri Slaby 154985cdaf52SJiri Slaby if (!size) { 155085cdaf52SJiri Slaby dbg_hid("empty report\n"); 15514ea54542SDavid Herrmann ret = -1; 15524ea54542SDavid Herrmann goto unlock; 155385cdaf52SJiri Slaby } 155485cdaf52SJiri Slaby 1555b94e3c94SMatthieu CASTET /* Avoid unnecessary overhead if debugfs is disabled */ 1556a5f04b9dSBenjamin Tissoires if (!list_empty(&hid->debug_list)) 1557a5f04b9dSBenjamin Tissoires hid_dump_report(hid, type, data, size); 1558b94e3c94SMatthieu CASTET 1559f77e347bSJiri Kosina report = hid_get_report(report_enum, data); 1560f77e347bSJiri Kosina 15614ea54542SDavid Herrmann if (!report) { 15624ea54542SDavid Herrmann ret = -1; 15634ea54542SDavid Herrmann goto unlock; 15644ea54542SDavid Herrmann } 1565f77e347bSJiri Kosina 156685cdaf52SJiri Slaby if (hdrv && hdrv->raw_event && hid_match_report(hid, report)) { 156785cdaf52SJiri Slaby ret = hdrv->raw_event(hid, report, data, size); 1568556483e2SFelix Rueegg if (ret < 0) 15694ea54542SDavid Herrmann goto unlock; 15704ea54542SDavid Herrmann } 157185cdaf52SJiri Slaby 1572b6787242SJiri Kosina ret = hid_report_raw_event(hid, type, data, size, interrupt); 1573aa8de2f0SJiri Kosina 15744ea54542SDavid Herrmann unlock: 1575c849a614SAndrew de los Reyes up(&hid->driver_input_lock); 157645dc1ac7SJiri Kosina return ret; 1577aa8de2f0SJiri Kosina } 1578aa8de2f0SJiri Kosina EXPORT_SYMBOL_GPL(hid_input_report); 1579aa8de2f0SJiri Kosina 15800f37cd03SJiri Kosina static bool hid_match_one_id(struct hid_device *hdev, 15810f37cd03SJiri Kosina const struct hid_device_id *id) 15820f37cd03SJiri Kosina { 15837431fb76SHenrik Rydberg return (id->bus == HID_BUS_ANY || id->bus == hdev->bus) && 15844d53b801SHenrik Rydberg (id->group == HID_GROUP_ANY || id->group == hdev->group) && 15850f37cd03SJiri Kosina (id->vendor == HID_ANY_ID || id->vendor == hdev->vendor) && 15860f37cd03SJiri Kosina (id->product == HID_ANY_ID || id->product == hdev->product); 15870f37cd03SJiri Kosina } 15880f37cd03SJiri Kosina 1589bbc21cfdSJeremy Fitzhardinge const struct hid_device_id *hid_match_id(struct hid_device *hdev, 15900f37cd03SJiri Kosina const struct hid_device_id *id) 15910f37cd03SJiri Kosina { 15920f37cd03SJiri Kosina for (; id->bus; id++) 15930f37cd03SJiri Kosina if (hid_match_one_id(hdev, id)) 15940f37cd03SJiri Kosina return id; 15950f37cd03SJiri Kosina 15960f37cd03SJiri Kosina return NULL; 15970f37cd03SJiri Kosina } 15980f37cd03SJiri Kosina 15990f37cd03SJiri Kosina static const struct hid_device_id hid_hiddev_list[] = { 1600c0bd6a42SRichard Hughes { HID_USB_DEVICE(USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS) }, 1601c0bd6a42SRichard Hughes { HID_USB_DEVICE(USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS1) }, 16020f37cd03SJiri Kosina { } 16030f37cd03SJiri Kosina }; 16040f37cd03SJiri Kosina 16050f37cd03SJiri Kosina static bool hid_hiddev(struct hid_device *hdev) 16060f37cd03SJiri Kosina { 16070f37cd03SJiri Kosina return !!hid_match_id(hdev, hid_hiddev_list); 16080f37cd03SJiri Kosina } 16090f37cd03SJiri Kosina 16106d3bfb74SAlan Ott 16116d3bfb74SAlan Ott static ssize_t 16126d3bfb74SAlan Ott read_report_descriptor(struct file *filp, struct kobject *kobj, 16136d3bfb74SAlan Ott struct bin_attribute *attr, 16146d3bfb74SAlan Ott char *buf, loff_t off, size_t count) 16156d3bfb74SAlan Ott { 16162cf83833SGeliang Tang struct device *dev = kobj_to_dev(kobj); 1617ee79a8f8SGeliang Tang struct hid_device *hdev = to_hid_device(dev); 16186d3bfb74SAlan Ott 16196d3bfb74SAlan Ott if (off >= hdev->rsize) 16206d3bfb74SAlan Ott return 0; 16216d3bfb74SAlan Ott 16226d3bfb74SAlan Ott if (off + count > hdev->rsize) 16236d3bfb74SAlan Ott count = hdev->rsize - off; 16246d3bfb74SAlan Ott 16256d3bfb74SAlan Ott memcpy(buf, hdev->rdesc + off, count); 16266d3bfb74SAlan Ott 16276d3bfb74SAlan Ott return count; 16286d3bfb74SAlan Ott } 16296d3bfb74SAlan Ott 1630a877417eSOlivier Gay static ssize_t 1631a877417eSOlivier Gay show_country(struct device *dev, struct device_attribute *attr, 1632a877417eSOlivier Gay char *buf) 1633a877417eSOlivier Gay { 1634ee79a8f8SGeliang Tang struct hid_device *hdev = to_hid_device(dev); 1635a877417eSOlivier Gay 1636a877417eSOlivier Gay return sprintf(buf, "%02x\n", hdev->country & 0xff); 1637a877417eSOlivier Gay } 1638a877417eSOlivier Gay 16396d3bfb74SAlan Ott static struct bin_attribute dev_bin_attr_report_desc = { 16406d3bfb74SAlan Ott .attr = { .name = "report_descriptor", .mode = 0444 }, 16416d3bfb74SAlan Ott .read = read_report_descriptor, 16426d3bfb74SAlan Ott .size = HID_MAX_DESCRIPTOR_SIZE, 16436d3bfb74SAlan Ott }; 16446d3bfb74SAlan Ott 1645a877417eSOlivier Gay static struct device_attribute dev_attr_country = { 1646a877417eSOlivier Gay .attr = { .name = "country", .mode = 0444 }, 1647a877417eSOlivier Gay .show = show_country, 1648a877417eSOlivier Gay }; 1649a877417eSOlivier Gay 165093c10132SJiri Slaby int hid_connect(struct hid_device *hdev, unsigned int connect_mask) 165193c10132SJiri Slaby { 165293c10132SJiri Slaby static const char *types[] = { "Device", "Pointer", "Mouse", "Device", 165393c10132SJiri Slaby "Joystick", "Gamepad", "Keyboard", "Keypad", 165493c10132SJiri Slaby "Multi-Axis Controller" 165593c10132SJiri Slaby }; 165693c10132SJiri Slaby const char *type, *bus; 165779b568b9SRichard Purdie char buf[64] = ""; 165893c10132SJiri Slaby unsigned int i; 165993c10132SJiri Slaby int len; 16606d3bfb74SAlan Ott int ret; 166193c10132SJiri Slaby 1662b5e5a37eSBastien Nocera if (hdev->quirks & HID_QUIRK_HIDDEV_FORCE) 1663b5e5a37eSBastien Nocera connect_mask |= (HID_CONNECT_HIDDEV_FORCE | HID_CONNECT_HIDDEV); 16643a343ee4SDaniel Mack if (hdev->quirks & HID_QUIRK_HIDINPUT_FORCE) 16653a343ee4SDaniel Mack connect_mask |= HID_CONNECT_HIDINPUT_FORCE; 166693c10132SJiri Slaby if (hdev->bus != BUS_USB) 166793c10132SJiri Slaby connect_mask &= ~HID_CONNECT_HIDDEV; 16680f37cd03SJiri Kosina if (hid_hiddev(hdev)) 16690f37cd03SJiri Kosina connect_mask |= HID_CONNECT_HIDDEV_FORCE; 167093c10132SJiri Slaby 167193c10132SJiri Slaby if ((connect_mask & HID_CONNECT_HIDINPUT) && !hidinput_connect(hdev, 167293c10132SJiri Slaby connect_mask & HID_CONNECT_HIDINPUT_FORCE)) 167393c10132SJiri Slaby hdev->claimed |= HID_CLAIMED_INPUT; 1674b77c3920SBenjamin Tissoires 167593c10132SJiri Slaby if ((connect_mask & HID_CONNECT_HIDDEV) && hdev->hiddev_connect && 167693c10132SJiri Slaby !hdev->hiddev_connect(hdev, 167793c10132SJiri Slaby connect_mask & HID_CONNECT_HIDDEV_FORCE)) 167893c10132SJiri Slaby hdev->claimed |= HID_CLAIMED_HIDDEV; 167993c10132SJiri Slaby if ((connect_mask & HID_CONNECT_HIDRAW) && !hidraw_connect(hdev)) 168093c10132SJiri Slaby hdev->claimed |= HID_CLAIMED_HIDRAW; 168193c10132SJiri Slaby 16827704ac93SBenjamin Tissoires if (connect_mask & HID_CONNECT_DRIVER) 16837704ac93SBenjamin Tissoires hdev->claimed |= HID_CLAIMED_DRIVER; 16847704ac93SBenjamin Tissoires 16854bc19f62SDavid Herrmann /* Drivers with the ->raw_event callback set are not required to connect 16864bc19f62SDavid Herrmann * to any other listener. */ 16874bc19f62SDavid Herrmann if (!hdev->claimed && !hdev->driver->raw_event) { 16884bc19f62SDavid Herrmann hid_err(hdev, "device has no listeners, quitting\n"); 168993c10132SJiri Slaby return -ENODEV; 169093c10132SJiri Slaby } 169193c10132SJiri Slaby 169293c10132SJiri Slaby if ((hdev->claimed & HID_CLAIMED_INPUT) && 169393c10132SJiri Slaby (connect_mask & HID_CONNECT_FF) && hdev->ff_init) 169493c10132SJiri Slaby hdev->ff_init(hdev); 169593c10132SJiri Slaby 169693c10132SJiri Slaby len = 0; 169793c10132SJiri Slaby if (hdev->claimed & HID_CLAIMED_INPUT) 169893c10132SJiri Slaby len += sprintf(buf + len, "input"); 169993c10132SJiri Slaby if (hdev->claimed & HID_CLAIMED_HIDDEV) 170093c10132SJiri Slaby len += sprintf(buf + len, "%shiddev%d", len ? "," : "", 170193c10132SJiri Slaby hdev->minor); 170293c10132SJiri Slaby if (hdev->claimed & HID_CLAIMED_HIDRAW) 170393c10132SJiri Slaby len += sprintf(buf + len, "%shidraw%d", len ? "," : "", 170493c10132SJiri Slaby ((struct hidraw *)hdev->hidraw)->minor); 170593c10132SJiri Slaby 170693c10132SJiri Slaby type = "Device"; 170793c10132SJiri Slaby for (i = 0; i < hdev->maxcollection; i++) { 170893c10132SJiri Slaby struct hid_collection *col = &hdev->collection[i]; 170993c10132SJiri Slaby if (col->type == HID_COLLECTION_APPLICATION && 171093c10132SJiri Slaby (col->usage & HID_USAGE_PAGE) == HID_UP_GENDESK && 171193c10132SJiri Slaby (col->usage & 0xffff) < ARRAY_SIZE(types)) { 171293c10132SJiri Slaby type = types[col->usage & 0xffff]; 171393c10132SJiri Slaby break; 171493c10132SJiri Slaby } 171593c10132SJiri Slaby } 171693c10132SJiri Slaby 171793c10132SJiri Slaby switch (hdev->bus) { 171893c10132SJiri Slaby case BUS_USB: 171993c10132SJiri Slaby bus = "USB"; 172093c10132SJiri Slaby break; 172193c10132SJiri Slaby case BUS_BLUETOOTH: 172293c10132SJiri Slaby bus = "BLUETOOTH"; 172393c10132SJiri Slaby break; 172406780727SDaniel Martin case BUS_I2C: 172506780727SDaniel Martin bus = "I2C"; 172606780727SDaniel Martin break; 172793c10132SJiri Slaby default: 172893c10132SJiri Slaby bus = "<UNKNOWN>"; 172993c10132SJiri Slaby } 173093c10132SJiri Slaby 1731a877417eSOlivier Gay ret = device_create_file(&hdev->dev, &dev_attr_country); 1732a877417eSOlivier Gay if (ret) 1733a877417eSOlivier Gay hid_warn(hdev, 1734a877417eSOlivier Gay "can't create sysfs country code attribute err: %d\n", ret); 1735a877417eSOlivier Gay 17364291ee30SJoe Perches hid_info(hdev, "%s: %s HID v%x.%02x %s [%s] on %s\n", 173793c10132SJiri Slaby buf, bus, hdev->version >> 8, hdev->version & 0xff, 173893c10132SJiri Slaby type, hdev->name, hdev->phys); 173993c10132SJiri Slaby 174093c10132SJiri Slaby return 0; 174193c10132SJiri Slaby } 174293c10132SJiri Slaby EXPORT_SYMBOL_GPL(hid_connect); 174393c10132SJiri Slaby 1744c4c259bcSJiri Kosina void hid_disconnect(struct hid_device *hdev) 1745c4c259bcSJiri Kosina { 1746a877417eSOlivier Gay device_remove_file(&hdev->dev, &dev_attr_country); 1747c4c259bcSJiri Kosina if (hdev->claimed & HID_CLAIMED_INPUT) 1748c4c259bcSJiri Kosina hidinput_disconnect(hdev); 1749c4c259bcSJiri Kosina if (hdev->claimed & HID_CLAIMED_HIDDEV) 1750c4c259bcSJiri Kosina hdev->hiddev_disconnect(hdev); 1751c4c259bcSJiri Kosina if (hdev->claimed & HID_CLAIMED_HIDRAW) 1752c4c259bcSJiri Kosina hidraw_disconnect(hdev); 17539c5c6ed7SBenjamin Tissoires hdev->claimed = 0; 1754c4c259bcSJiri Kosina } 1755c4c259bcSJiri Kosina EXPORT_SYMBOL_GPL(hid_disconnect); 1756c4c259bcSJiri Kosina 175700315e4fSJiri Kosina /* 175800315e4fSJiri Kosina * A list of devices for which there is a specialized driver on HID bus. 175900315e4fSJiri Kosina * 176000315e4fSJiri Kosina * Please note that for multitouch devices (driven by hid-multitouch driver), 176100315e4fSJiri Kosina * there is a proper autodetection and autoloading in place (based on presence 176200315e4fSJiri Kosina * of HID_DG_CONTACTID), so those devices don't need to be added to this list, 176300315e4fSJiri Kosina * as we are doing the right thing in hid_scan_usage(). 176483499b52SAlexander Holler * 176583499b52SAlexander Holler * Autodetection for (USB) HID sensor hubs exists too. If a collection of type 176683499b52SAlexander Holler * physical is found inside a usage page of type sensor, hid-sensor-hub will be 176783499b52SAlexander Holler * used as a driver. See hid_scan_report(). 176800315e4fSJiri Kosina */ 1769ce06b9d6SDmitry Torokhov static const struct hid_device_id hid_have_special_driver[] = { 177014a21cd4SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_WCP32PU) }, 177114a21cd4SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_X5_005D) }, 1772b7e1b203SLech Perczak { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_RP_649) }, 1773c0dbcc33SSergei Kolzun { HID_USB_DEVICE(USB_VENDOR_ID_ACRUX, 0x0802) }, 1774e17f5d76STristan Rice { HID_USB_DEVICE(USB_VENDOR_ID_ACRUX, 0xf705) }, 17758c19a515SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MIGHTYMOUSE) }, 1776128537ceSMichael Poole { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGICMOUSE) }, 1777a462230eSChase Douglas { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGICTRACKPAD) }, 17788c19a515SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ANSI) }, 17798c19a515SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ISO) }, 17808c19a515SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ANSI) }, 17818c19a515SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ISO) }, 17828c19a515SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_JIS) }, 17838c19a515SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ANSI) }, 17848c19a515SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ISO) }, 17858c19a515SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_JIS) }, 17868c19a515SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ANSI) }, 17878c19a515SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ISO) }, 17888c19a515SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_JIS) }, 1789fef3f571SRyan Finnie { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_MINI_ANSI) }, 1790fef3f571SRyan Finnie { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_MINI_ISO) }, 1791fef3f571SRyan Finnie { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_MINI_JIS) }, 17928c19a515SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ANSI) }, 17938c19a515SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ISO) }, 17948c19a515SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_JIS) }, 17958c19a515SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ANSI) }, 17968c19a515SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ISO) }, 17978c19a515SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_JIS) }, 17989a4a5574SBenjamin Tissoires { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL) }, 17999a4a5574SBenjamin Tissoires { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL2) }, 18009a4a5574SBenjamin Tissoires { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL3) }, 18019a4a5574SBenjamin Tissoires { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL4) }, 18029a4a5574SBenjamin Tissoires { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL5) }, 1803ee8a1a0aSJan Scholz { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI) }, 1804ee8a1a0aSJan Scholz { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ISO) }, 1805ee8a1a0aSJan Scholz { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_JIS) }, 18068c19a515SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ANSI) }, 18078c19a515SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ISO) }, 18088c19a515SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_JIS) }, 18098c19a515SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_ANSI) }, 18108c19a515SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_ISO) }, 18118c19a515SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_JIS) }, 1812a96d6ef3SHenrik Rydberg { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI) }, 1813a96d6ef3SHenrik Rydberg { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ISO) }, 1814a96d6ef3SHenrik Rydberg { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_JIS) }, 181599b9f758SEdgar (gimli) Hucek { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI) }, 181699b9f758SEdgar (gimli) Hucek { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_ISO) }, 181799b9f758SEdgar (gimli) Hucek { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_JIS) }, 181899b9f758SEdgar (gimli) Hucek { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_ANSI) }, 181999b9f758SEdgar (gimli) Hucek { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_ISO) }, 182099b9f758SEdgar (gimli) Hucek { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS) }, 182147340bd9SAndy Botting { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_ANSI) }, 182247340bd9SAndy Botting { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_ISO) }, 182347340bd9SAndy Botting { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_JIS) }, 1824213f9da8SGökçen Eraslan { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_ANSI) }, 1825213f9da8SGökçen Eraslan { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_ISO) }, 1826213f9da8SGökçen Eraslan { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_JIS) }, 18274a4c8799SDan Bastone { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_REVB_ANSI) }, 18284a4c8799SDan Bastone { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_REVB_ISO) }, 18294a4c8799SDan Bastone { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_REVB_JIS) }, 1830f6f554f0SJiri Kosina { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6_ANSI) }, 1831f6f554f0SJiri Kosina { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6_ISO) }, 1832f6f554f0SJiri Kosina { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6_JIS) }, 1833d762cc29SNobuhiro Iwamatsu { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_ANSI) }, 1834d762cc29SNobuhiro Iwamatsu { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_ISO) }, 1835d762cc29SNobuhiro Iwamatsu { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_JIS) }, 1836b2e6ad7dSRyan Bourgeois { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_ANSI) }, 1837b2e6ad7dSRyan Bourgeois { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_ISO) }, 1838b2e6ad7dSRyan Bourgeois { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_JIS) }, 18398d80da90SDirk Hohndel { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_ANSI) }, 18408d80da90SDirk Hohndel { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_ISO) }, 18418d80da90SDirk Hohndel { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_JIS) }, 18429d9a04eeSDmitry Torokhov { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING8_ANSI) }, 18439d9a04eeSDmitry Torokhov { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING8_ISO) }, 18449d9a04eeSDmitry Torokhov { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING8_JIS) }, 1845a4a2c545SHenrik Rydberg { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING9_ANSI) }, 1846a4a2c545SHenrik Rydberg { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING9_ISO) }, 1847a4a2c545SHenrik Rydberg { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING9_JIS) }, 184823aeb61eSChristian Schuerer-Waldheim { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI) }, 184923aeb61eSChristian Schuerer-Waldheim { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO) }, 185023aeb61eSChristian Schuerer-Waldheim { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS) }, 1851f9af7b9eSBen Hutchings { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ANSI) }, 1852ad734bc1SAndreas Krist { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ISO) }, 1853bd4a7ce1SHuei-Horng Yo { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_JIS) }, 18548c19a515SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) }, 18558c19a515SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) }, 1856212da74dSJosenivaldo Benito Junior { HID_USB_DEVICE(USB_VENDOR_ID_AUREAL, USB_DEVICE_ID_AUREAL_W01RN) }, 1857b5635b12SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_BELKIN, USB_DEVICE_ID_FLIP_KVM) }, 1858fc38a8a6SHuang Bo { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185BFM, 0x2208) }, 1859fc38a8a6SHuang Bo { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185PC, 0x5506) }, 1860fc38a8a6SHuang Bo { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185V2PC, 0x1850) }, 1861fc38a8a6SHuang Bo { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185V2BFM, 0x5500) }, 1862bf280628SWayne Thomas { HID_USB_DEVICE(USB_VENDOR_ID_BTC, USB_DEVICE_ID_BTC_EMPREX_REMOTE) }, 1863c3dc66deSJiri Kosina { HID_USB_DEVICE(USB_VENDOR_ID_BTC, USB_DEVICE_ID_BTC_EMPREX_REMOTE_2) }, 18643b239cd7SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION) }, 18651ce31b25SRaphaël Doursenaud { HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION_SOLAR) }, 1866fcfacfd3SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_TACTICAL_PAD) }, 1867b9e4b1e0SDennis Kügler { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_WIRELESS) }, 18683596bb92SKeng-Yu Lin { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_WIRELESS2) }, 18692d8767bbSCyrus Lien { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_AK1D) }, 18709a1d78a3SНиколай Кудрявцев { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_ACER_SWITCH12) }, 18716f78193eSClément Vuchener { HID_USB_DEVICE(USB_VENDOR_ID_CORSAIR, USB_DEVICE_ID_CORSAIR_K90) }, 18723a370ca1SDon Prince { HID_USB_DEVICE(USB_VENDOR_ID_CREATIVELABS, USB_DEVICE_ID_PRODIKEYS_PCMIDI) }, 1873e932d817SDavid Barksdale { HID_USB_DEVICE(USB_VENDOR_ID_CYGNAL, USB_DEVICE_ID_CYGNAL_CP2112) }, 18740f221320SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_1) }, 18750f221320SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_2) }, 1876e8d0eab4SJiri Kosina { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_3) }, 187776c9d8feSLionel Vaux { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_4) }, 18780f221320SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_MOUSE) }, 18793f866fbdSRichard Walmsley { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, 0x0006) }, 1880e05eefb9SNikolai Kondrashov { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, 0x0011) }, 188164b386eaSRichard Nauber { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_BM084) }, 1882d23efc19SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_ELO, 0x0009) }, 1883d23efc19SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_ELO, 0x0030) }, 188404561c5aSIgnaz Forster { HID_USB_DEVICE(USB_VENDOR_ID_EMS, USB_DEVICE_ID_EMS_TRIO_LINKER_PLUS_II) }, 18851f243e30SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_EZKEY, USB_DEVICE_ID_BTC_8193) }, 18865181e594SJiri Kosina { HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PSX_ADAPTOR) }, 1887578f3a35SJiri Kosina { HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PCS_ADAPTOR) }, 1888931830aaSBenjamin Tissoires { HID_USB_DEVICE(USB_VENDOR_ID_GEMBIRD, USB_DEVICE_ID_GEMBIRD_JPD_DUALFORCE2) }, 18895181e594SJiri Kosina { HID_USB_DEVICE(USB_VENDOR_ID_GREENASIA, 0x0003) }, 189042859e0bSLukasz Lubojanski { HID_USB_DEVICE(USB_VENDOR_ID_GREENASIA, 0x0012) }, 1891949f8fefSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE) }, 18921e093206SJiri Kosina { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE_2) }, 1893c2fd1a4eSCory Maccarrone { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE_3) }, 1894d946e65eSAnssi Hannula { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK, USB_DEVICE_ID_HOLTEK_ON_LINE_GRIP) }, 1895ff9bf5a2STom Harwood { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_KEYBOARD) }, 189640d3597fSJiri Kosina { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A04A) }, 189740d3597fSJiri Kosina { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A067) }, 1898274be3ebSKharlamov Alexey { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A070) }, 1899f1a4914bSAnders F. U. Kiær { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A072) }, 19007da7cbbbSAnders F. U. Kiær { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A081) }, 19015df4eb05SJohn DeSilva { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A0C2) }, 1902e917e98fSNikolai Kondrashov { HID_USB_DEVICE(USB_VENDOR_ID_HUION, USB_DEVICE_ID_HUION_TABLET) }, 1903aaca9cc0SMichael Karcher { HID_USB_DEVICE(USB_VENDOR_ID_JESS2, USB_DEVICE_ID_JESS2_COLOR_RUMBLE_PAD) }, 19044ddfe028SBastien Nocera { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_ION, USB_DEVICE_ID_ICADE) }, 1905fdf93aa3SJiri Kosina { HID_USB_DEVICE(USB_VENDOR_ID_KENSINGTON, USB_DEVICE_ID_KS_SLIMBLADE) }, 1906177900e8SJiri Kosina { HID_USB_DEVICE(USB_VENDOR_ID_KEYTOUCH, USB_DEVICE_ID_KEYTOUCH_IEC) }, 19073685c18eSBenjamin Tissoires { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_GENIUS_GILA_GAMING_MOUSE) }, 19084a2c94c9SBenjamin Tissoires { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_GENIUS_MANTICORE) }, 19090adb9c2cSBenjamin Tissoires { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_GENIUS_GX_IMPERATOR) }, 191079422741SJiri Kosina { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_ERGO_525V) }, 191122ca20b2SNikolai Kondrashov { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_EASYPEN_I405X) }, 191222ca20b2SNikolai Kondrashov { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_MOUSEPEN_I608X) }, 19132bacedadSGiedrius Statkevičius { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_MOUSEPEN_I608X_2) }, 191422ca20b2SNikolai Kondrashov { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_EASYPEN_M610X) }, 1915feb6faf1SMilan Plzik { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_PENSKETCH_M912) }, 1916b5635b12SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_LABTEC, USB_DEVICE_ID_LABTEC_WIRELESS_KEYBOARD) }, 191775b07022SChris Schlund { HID_USB_DEVICE(USB_VENDOR_ID_LCPOWER, USB_DEVICE_ID_LCPOWER_LC1000 ) }, 191894723bfaSJamie Lentin #if IS_ENABLED(CONFIG_HID_LENOVO) 1919c1dcad2dSBernhard Seibold { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_TPKBD) }, 1920f3d4ff0eSJamie Lentin { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_CUSBKBD) }, 1921f3d4ff0eSJamie Lentin { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_CBTKBD) }, 1922181a8b91SBenjamin Tissoires { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_TPPRODOCK) }, 1923aad932e7SAndres Freund #endif 19245f22a799SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_MX3000_RECEIVER) }, 19255f22a799SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_S510_RECEIVER) }, 19265f22a799SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_S510_RECEIVER_2) }, 19275f22a799SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RECEIVER) }, 19285844c1cdSDavid Dillow { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_PS3) }, 19292f31c525SBenjamin Tissoires { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_T651) }, 19305f22a799SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_DINOVO_DESKTOP) }, 19315f22a799SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_DINOVO_EDGE) }, 19325f22a799SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_DINOVO_MINI) }, 19335f22a799SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_ELITE_KBD) }, 19345f22a799SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_CORDLESS_DESKTOP_LX500) }, 19355f22a799SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_EXTREME_3D) }, 19365f22a799SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WHEEL) }, 19372c6118e4SHendrik Iben { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD_CORD) }, 1938606bd0a8SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD) }, 1939606bd0a8SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD2_2) }, 194029fae1c8SSimon Wood { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G29_WHEEL) }, 19417bfd2927SSimon Wood { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G920_WHEEL) }, 1942606bd0a8SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WINGMAN_F3D) }, 1943fd30ea8cSJiri Kosina { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WINGMAN_FFG ) }, 1944606bd0a8SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_FORCE3D_PRO) }, 194574f292caSGary Stein { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_FLIGHT_SYSTEM_G940) }, 1946606bd0a8SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MOMO_WHEEL) }, 1947606bd0a8SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MOMO_WHEEL2) }, 1948bd04363dSElias Vanderstuyft { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_VIBRATION_WHEEL) }, 19495623a24aSJiri Kosina { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_DFP_WHEEL) }, 1950e00ddc9bSMichal Malý { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_DFGT_WHEEL) }, 1951243b706dSChristophe Borivant { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G25_WHEEL) }, 1952fdc6807fSPeter Gundermann { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G27_WHEEL) }, 19530944e964SKonstantin Khlebnikov #if IS_ENABLED(CONFIG_HID_LOGITECH_DJ) 1954534a7b8eSNestor Lopez Casado { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_UNIFYING_RECEIVER) }, 1955534a7b8eSNestor Lopez Casado { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_UNIFYING_RECEIVER_2) }, 19560944e964SKonstantin Khlebnikov #endif 195732c88cbcSSimon Wood { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WII_WHEEL) }, 1958606bd0a8SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD2) }, 195924985cf6SJiri Kosina { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_SPACETRAVELLER) }, 196024985cf6SJiri Kosina { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_SPACENAVIGATOR) }, 1961236db47cSBruno Prémont { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICOLCD) }, 1962236db47cSBruno Prémont { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICOLCD_BOOTLOADER) }, 1963b580169aSJiri Kosina { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_COMFORT_MOUSE_4500) }, 196478a849a6SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_SIDEWINDER_GV) }, 196578a849a6SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_NE4K) }, 196689759e20SAdam Jiang { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_NE4K_JP) }, 1967ef567cf9SJakub Sitnicki { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_NE7K) }, 196878a849a6SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_LK6K) }, 196978a849a6SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_USB) }, 1970f3b83d71SJiri Kosina { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_DIGITAL_MEDIA_3K) }, 197178a849a6SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_WIRELESS_OPTICAL_DESKTOP_3_0) }, 19723faed1afSHans de Goede { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_OFFICE_KB) }, 19730439de75SStephen Just { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_PRO_3) }, 1974c6956eb7SDonavan Lance { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_PRO_3_2) }, 19750439de75SStephen Just { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_PRO_3_JP) }, 1976be3b1634SAlan Wu { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3) }, 197718eec2cdSRaimund Roth { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_POWER_COVER) }, 19783b8006e5SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_MONTEREY, USB_DEVICE_ID_GENIUS_KB29E) }, 1979f471d948SJanne Kanniainen { HID_USB_DEVICE(USB_VENDOR_ID_MSI, USB_DEVICE_ID_MSI_GT683R_LED_PANEL) }, 198094011f93SRafi Rubin { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN) }, 19816e32819eSmicki { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_1) }, 19826e32819eSmicki { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_2) }, 19836e32819eSmicki { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_3) }, 19846e32819eSmicki { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_4) }, 19856e32819eSmicki { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_5) }, 19866e32819eSmicki { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_6) }, 19876e32819eSmicki { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_7) }, 19886e32819eSmicki { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_8) }, 19896e32819eSmicki { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_9) }, 19906e32819eSmicki { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_10) }, 19916e32819eSmicki { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_11) }, 19926e32819eSmicki { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_12) }, 19936e32819eSmicki { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_13) }, 19946e32819eSmicki { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_14) }, 19956e32819eSmicki { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_15) }, 19966e32819eSmicki { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_16) }, 19976e32819eSmicki { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_17) }, 19986e32819eSmicki { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_18) }, 1999270fdc07SHerton Ronaldo Krzesinski { HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_PKB1700) }, 2000cd9ec30dSJohnathon Harris { HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_WKB2000) }, 2001ffe51d0dSChristian Gmeiner { HID_USB_DEVICE(USB_VENDOR_ID_PENMOUNT, USB_DEVICE_ID_PENMOUNT_6000) }, 20021e762532SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_PETALYNX, USB_DEVICE_ID_PETALYNX_MAXTER_REMOTE) }, 20031a3f83f6SJD Cole { HID_USB_DEVICE(USB_VENDOR_ID_PLANTRONICS, HID_ANY_ID) }, 2004f6a04605STerry Lambert { HID_USB_DEVICE(USB_VENDOR_ID_PRIMAX, USB_DEVICE_ID_PRIMAX_KEYBOARD) }, 2005ca9bbdccSStefan Achatz #if IS_ENABLED(CONFIG_HID_ROCCAT) 2006e68cc603SStefan Achatz { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_ARVO) }, 2007d41c2a70SStefan Achatz { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_ISKU) }, 2008e078809dSStefan Achatz { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_ISKUFX) }, 2009e078809dSStefan Achatz { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_KONE) }, 201047dbdbffSStefan Achatz { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_KONEPLUS) }, 20118936aa31SStefan Achatz { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_KONEPURE) }, 2012a4be0ed3SStefan Achatz { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_KONEPURE_OPTICAL) }, 2013e078809dSStefan Achatz { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_KONEXTD) }, 20140e70f97fSStefan Achatz { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_KOVAPLUS) }, 20154424f616SStefan Achatz { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_LUA) }, 2016cb7cf3daSStefan Achatz { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_PYRA_WIRED) }, 20173fce2246SStefan Achatz { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_PYRA_WIRELESS) }, 20186f3a1936SStefan Achatz { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_RYOS_MK) }, 20196f3a1936SStefan Achatz { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_RYOS_MK_GLOW) }, 20206f3a1936SStefan Achatz { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_RYOS_MK_PRO) }, 20216a2a6390SStefan Achatz { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_SAVU) }, 2022ca9bbdccSStefan Achatz #endif 202337c492c8SHarald Brinkmann #if IS_ENABLED(CONFIG_HID_SAITEK) 20241e93674aSAndreas Hübner { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_PS1000) }, 2025afe98939SDarren Salt { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_RAT7_OLD) }, 202637c492c8SHarald Brinkmann { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_RAT7) }, 202737c492c8SHarald Brinkmann { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_MMO7) }, 20288ffd341cSHarald Brinkmann { HID_USB_DEVICE(USB_VENDOR_ID_MADCATZ, USB_DEVICE_ID_MADCATZ_RAT5) }, 20297bb9d643SVille Aakko { HID_USB_DEVICE(USB_VENDOR_ID_MADCATZ, USB_DEVICE_ID_MADCATZ_RAT9) }, 203037c492c8SHarald Brinkmann #endif 2031980a3da6SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_IR_REMOTE) }, 2032b355850bSDon Prince { HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_WIRELESS_KBD_MOUSE) }, 2033d586dca0SJiri Kosina { HID_USB_DEVICE(USB_VENDOR_ID_SKYCABLE, USB_DEVICE_ID_SKYCABLE_WIRELESS_PRESENTER) }, 203468a49e51SFrank Praznik { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SMK, USB_DEVICE_ID_SMK_PS3_BDREMOTE) }, 2035f04d5140SColin Leitner { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_BUZZ_CONTROLLER) }, 2036f04d5140SColin Leitner { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_WIRELESS_BUZZ_CONTROLLER) }, 20377c886d09SFrank Praznik { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_MOTION_CONTROLLER) }, 2038a4afa854SSimon Wood { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_MOTION_CONTROLLER) }, 203935dca5b4SJiri Kosina { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_NAVIGATION_CONTROLLER) }, 20406eabaaa0SSimon Wood { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_NAVIGATION_CONTROLLER) }, 204190231e7eSJiri Slaby { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_BDREMOTE) }, 2042bd28ce00SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) }, 2043f9ce7c28SBastien Nocera { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) }, 20440bd88dd3SFrank Praznik { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS4_CONTROLLER) }, 20450bd88dd3SFrank Praznik { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS4_CONTROLLER) }, 2046cc6e0bbbSJiri Kosina { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE) }, 2047c1e0ac19SFernando Luis Vázquez Cao { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_VAIO_VGP_MOUSE) }, 204875dbb953SSimon Wood { HID_USB_DEVICE(USB_VENDOR_ID_STEELSERIES, USB_DEVICE_ID_STEELSERIES_SRWS1) }, 20498c19a515SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_SUNPLUS, USB_DEVICE_ID_SUNPLUS_WDESKTOP) }, 205030ba2fbdSVivien Didelot { HID_USB_DEVICE(USB_VENDOR_ID_THINGM, USB_DEVICE_ID_BLINK1) }, 2051daedb3d6SAnssi Hannula { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb300) }, 2052daedb3d6SAnssi Hannula { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb304) }, 20537a84b133SRuben Aos Garralda { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb323) }, 20547a84b133SRuben Aos Garralda { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb324) }, 2055daedb3d6SAnssi Hannula { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb651) }, 20563ee8f0a2SMarkus Rathgeb { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb653) }, 2057daedb3d6SAnssi Hannula { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb654) }, 2058d65c3768SSimon Wood { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb65a) }, 2059740363fbSJiri Kosina { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE_BT) }, 206044ea35c1SJarod Wilson { HID_USB_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE) }, 20619b028649SForest Wilkinson { HID_USB_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE_PRO) }, 2062f14f526dSLev Babiev { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED, USB_DEVICE_ID_TOPSEED_CYBERLINK) }, 206354001081SKees Bakker { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED2, USB_DEVICE_ID_TOPSEED2_RF_COMBO) }, 2064711a680eSBruno Premont { HID_USB_DEVICE(USB_VENDOR_ID_TWINHAN, USB_DEVICE_ID_TWINHAN_IR_REMOTE) }, 206541fa9230SNikolai Kondrashov { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_PF1209) }, 2066f8a489ccSNikolai Kondrashov { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP4030U) }, 2067f8a489ccSNikolai Kondrashov { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP5540U) }, 2068f8a489ccSNikolai Kondrashov { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP8060U) }, 20696be914f1SNikolai Kondrashov { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP1062) }, 2070d1257081SNikolai Kondrashov { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_WIRELESS_TABLET_TWHL850) }, 2071eb4e426aSNikolai Kondrashov { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_TWHA60) }, 2072fac733f0SJussi Kivilinna { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_SMARTJOY_PLUS) }, 207342fc04e5SSean Young { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_SUPER_JOY_BOX_3) }, 2074ad395ccaSSean Young { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_DUAL_USB_JOYPAD) }, 20751bcc2067SSean Young { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP_LTD, USB_DEVICE_ID_SUPER_JOY_BOX_3_PRO) }, 20761bcc2067SSean Young { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP_LTD, USB_DEVICE_ID_SUPER_DUAL_BOX_PRO) }, 20771bcc2067SSean Young { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP_LTD, USB_DEVICE_ID_SUPER_JOY_BOX_5_PRO) }, 20786e5e9a06SSean Young { HID_USB_DEVICE(USB_VENDOR_ID_PLAYDOTCOM, USB_DEVICE_ID_PLAYDOTCOM_EMS_USBII) }, 207972a46344SNikolai Kondrashov { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_SLIM_TABLET_5_8_INCH) }, 208000e7f964SNikolai Kondrashov { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_SLIM_TABLET_12_1_INCH) }, 20814fdc18d1SNikolai Kondrashov { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_Q_PAD) }, 2082a786e83cSNikolai Kondrashov { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_PID_0038) }, 208372a46344SNikolai Kondrashov { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_MEDIA_TABLET_10_6_INCH) }, 20848f1acc32SNikolai Kondrashov { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_MEDIA_TABLET_14_1_INCH) }, 2085d2ee4dd9SNikolai Kondrashov { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_SIRIUS_BATTERY_FREE_TABLET) }, 208674bc6953SStefan Kriwanek { HID_USB_DEVICE(USB_VENDOR_ID_X_TENSIONS, USB_DEVICE_ID_SPEEDLINK_VAD_CEZANNE) }, 2087cb2c9e3fSOlivier Scherler { HID_USB_DEVICE(USB_VENDOR_ID_XIN_MO, USB_DEVICE_ID_XIN_MO_DUAL_ARCADE) }, 2088daedb3d6SAnssi Hannula { HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS, 0x0005) }, 2089daedb3d6SAnssi Hannula { HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS, 0x0030) }, 2090a9885c8fSDon Prince { HID_USB_DEVICE(USB_VENDOR_ID_ZYDACRON, USB_DEVICE_ID_ZYDACRON_REMOTE_CONTROL) }, 20918c19a515SJiri Slaby 209278a849a6SJiri Slaby { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_BT) }, 209302fb72a0SDavid Herrmann { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_NINTENDO, USB_DEVICE_ID_NINTENDO_WIIMOTE) }, 2094a33042faSDavid Herrmann { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_NINTENDO, USB_DEVICE_ID_NINTENDO_WIIMOTE2) }, 2095e9287099SAndrew Duggan { HID_USB_DEVICE(USB_VENDOR_ID_RAZER, USB_DEVICE_ID_RAZER_BLADE_14) }, 209685cdaf52SJiri Slaby { } 209785cdaf52SJiri Slaby }; 209885cdaf52SJiri Slaby 20993a6f82f7SJiri Slaby struct hid_dynid { 21003a6f82f7SJiri Slaby struct list_head list; 21013a6f82f7SJiri Slaby struct hid_device_id id; 21023a6f82f7SJiri Slaby }; 21033a6f82f7SJiri Slaby 21043a6f82f7SJiri Slaby /** 21053a6f82f7SJiri Slaby * store_new_id - add a new HID device ID to this driver and re-probe devices 21063a6f82f7SJiri Slaby * @driver: target device driver 21073a6f82f7SJiri Slaby * @buf: buffer for scanning device ID data 21083a6f82f7SJiri Slaby * @count: input size 21093a6f82f7SJiri Slaby * 21103a6f82f7SJiri Slaby * Adds a new dynamic hid device ID to this driver, 21113a6f82f7SJiri Slaby * and causes the driver to probe for all devices again. 21123a6f82f7SJiri Slaby */ 21133a6f82f7SJiri Slaby static ssize_t store_new_id(struct device_driver *drv, const char *buf, 21143a6f82f7SJiri Slaby size_t count) 21153a6f82f7SJiri Slaby { 2116ba91a967SGeliang Tang struct hid_driver *hdrv = to_hid_driver(drv); 21173a6f82f7SJiri Slaby struct hid_dynid *dynid; 21183a6f82f7SJiri Slaby __u32 bus, vendor, product; 21193a6f82f7SJiri Slaby unsigned long driver_data = 0; 21203a6f82f7SJiri Slaby int ret; 21213a6f82f7SJiri Slaby 21223a6f82f7SJiri Slaby ret = sscanf(buf, "%x %x %x %lx", 21233a6f82f7SJiri Slaby &bus, &vendor, &product, &driver_data); 21243a6f82f7SJiri Slaby if (ret < 3) 21253a6f82f7SJiri Slaby return -EINVAL; 21263a6f82f7SJiri Slaby 21273a6f82f7SJiri Slaby dynid = kzalloc(sizeof(*dynid), GFP_KERNEL); 21283a6f82f7SJiri Slaby if (!dynid) 21293a6f82f7SJiri Slaby return -ENOMEM; 21303a6f82f7SJiri Slaby 21313a6f82f7SJiri Slaby dynid->id.bus = bus; 21324d53b801SHenrik Rydberg dynid->id.group = HID_GROUP_ANY; 21333a6f82f7SJiri Slaby dynid->id.vendor = vendor; 21343a6f82f7SJiri Slaby dynid->id.product = product; 21353a6f82f7SJiri Slaby dynid->id.driver_data = driver_data; 21363a6f82f7SJiri Slaby 21373a6f82f7SJiri Slaby spin_lock(&hdrv->dyn_lock); 21383a6f82f7SJiri Slaby list_add_tail(&dynid->list, &hdrv->dyn_list); 21393a6f82f7SJiri Slaby spin_unlock(&hdrv->dyn_lock); 21403a6f82f7SJiri Slaby 21413a6f82f7SJiri Slaby ret = driver_attach(&hdrv->driver); 21423a6f82f7SJiri Slaby 21433a6f82f7SJiri Slaby return ret ? : count; 21443a6f82f7SJiri Slaby } 21453a6f82f7SJiri Slaby static DRIVER_ATTR(new_id, S_IWUSR, NULL, store_new_id); 21463a6f82f7SJiri Slaby 21473a6f82f7SJiri Slaby static void hid_free_dynids(struct hid_driver *hdrv) 21483a6f82f7SJiri Slaby { 21493a6f82f7SJiri Slaby struct hid_dynid *dynid, *n; 21503a6f82f7SJiri Slaby 21513a6f82f7SJiri Slaby spin_lock(&hdrv->dyn_lock); 21523a6f82f7SJiri Slaby list_for_each_entry_safe(dynid, n, &hdrv->dyn_list, list) { 21533a6f82f7SJiri Slaby list_del(&dynid->list); 21543a6f82f7SJiri Slaby kfree(dynid); 21553a6f82f7SJiri Slaby } 21563a6f82f7SJiri Slaby spin_unlock(&hdrv->dyn_lock); 21573a6f82f7SJiri Slaby } 21583a6f82f7SJiri Slaby 21593a6f82f7SJiri Slaby static const struct hid_device_id *hid_match_device(struct hid_device *hdev, 21603a6f82f7SJiri Slaby struct hid_driver *hdrv) 21613a6f82f7SJiri Slaby { 21623a6f82f7SJiri Slaby struct hid_dynid *dynid; 21633a6f82f7SJiri Slaby 21643a6f82f7SJiri Slaby spin_lock(&hdrv->dyn_lock); 21653a6f82f7SJiri Slaby list_for_each_entry(dynid, &hdrv->dyn_list, list) { 21663a6f82f7SJiri Slaby if (hid_match_one_id(hdev, &dynid->id)) { 21673a6f82f7SJiri Slaby spin_unlock(&hdrv->dyn_lock); 21683a6f82f7SJiri Slaby return &dynid->id; 21693a6f82f7SJiri Slaby } 21703a6f82f7SJiri Slaby } 21713a6f82f7SJiri Slaby spin_unlock(&hdrv->dyn_lock); 21723a6f82f7SJiri Slaby 21733a6f82f7SJiri Slaby return hid_match_id(hdev, hdrv->id_table); 21743a6f82f7SJiri Slaby } 21753a6f82f7SJiri Slaby 217685cdaf52SJiri Slaby static int hid_bus_match(struct device *dev, struct device_driver *drv) 217785cdaf52SJiri Slaby { 2178ba91a967SGeliang Tang struct hid_driver *hdrv = to_hid_driver(drv); 2179ee79a8f8SGeliang Tang struct hid_device *hdev = to_hid_device(dev); 218085cdaf52SJiri Slaby 2181070748edSHenrik Rydberg return hid_match_device(hdev, hdrv) != NULL; 218285cdaf52SJiri Slaby } 218385cdaf52SJiri Slaby 218485cdaf52SJiri Slaby static int hid_device_probe(struct device *dev) 218585cdaf52SJiri Slaby { 2186ba91a967SGeliang Tang struct hid_driver *hdrv = to_hid_driver(dev->driver); 2187ee79a8f8SGeliang Tang struct hid_device *hdev = to_hid_device(dev); 218885cdaf52SJiri Slaby const struct hid_device_id *id; 218985cdaf52SJiri Slaby int ret = 0; 219085cdaf52SJiri Slaby 21914ea54542SDavid Herrmann if (down_interruptible(&hdev->driver_lock)) 21924ea54542SDavid Herrmann return -EINTR; 2193c849a614SAndrew de los Reyes if (down_interruptible(&hdev->driver_input_lock)) { 2194c849a614SAndrew de los Reyes ret = -EINTR; 2195c849a614SAndrew de los Reyes goto unlock_driver_lock; 2196c849a614SAndrew de los Reyes } 2197c849a614SAndrew de los Reyes hdev->io_started = false; 21984ea54542SDavid Herrmann 219985cdaf52SJiri Slaby if (!hdev->driver) { 22003a6f82f7SJiri Slaby id = hid_match_device(hdev, hdrv); 2201ba623a77SDan Carpenter if (id == NULL) { 2202ba623a77SDan Carpenter ret = -ENODEV; 2203ba623a77SDan Carpenter goto unlock; 2204ba623a77SDan Carpenter } 2205c500c971SJiri Slaby 220685cdaf52SJiri Slaby hdev->driver = hdrv; 2207c500c971SJiri Slaby if (hdrv->probe) { 2208c500c971SJiri Slaby ret = hdrv->probe(hdev, id); 2209c500c971SJiri Slaby } else { /* default probe */ 2210a7197c2eSHenrik Rydberg ret = hid_open_report(hdev); 2211c500c971SJiri Slaby if (!ret) 221293c10132SJiri Slaby ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); 2213c500c971SJiri Slaby } 2214a7197c2eSHenrik Rydberg if (ret) { 2215a7197c2eSHenrik Rydberg hid_close_report(hdev); 2216c500c971SJiri Slaby hdev->driver = NULL; 221785cdaf52SJiri Slaby } 2218a7197c2eSHenrik Rydberg } 2219ba623a77SDan Carpenter unlock: 2220c849a614SAndrew de los Reyes if (!hdev->io_started) 2221c849a614SAndrew de los Reyes up(&hdev->driver_input_lock); 2222c849a614SAndrew de los Reyes unlock_driver_lock: 22234ea54542SDavid Herrmann up(&hdev->driver_lock); 222485cdaf52SJiri Slaby return ret; 222585cdaf52SJiri Slaby } 222685cdaf52SJiri Slaby 222785cdaf52SJiri Slaby static int hid_device_remove(struct device *dev) 222885cdaf52SJiri Slaby { 2229ee79a8f8SGeliang Tang struct hid_device *hdev = to_hid_device(dev); 22304ea54542SDavid Herrmann struct hid_driver *hdrv; 2231c849a614SAndrew de los Reyes int ret = 0; 223285cdaf52SJiri Slaby 22334ea54542SDavid Herrmann if (down_interruptible(&hdev->driver_lock)) 22344ea54542SDavid Herrmann return -EINTR; 2235c849a614SAndrew de los Reyes if (down_interruptible(&hdev->driver_input_lock)) { 2236c849a614SAndrew de los Reyes ret = -EINTR; 2237c849a614SAndrew de los Reyes goto unlock_driver_lock; 2238c849a614SAndrew de los Reyes } 2239c849a614SAndrew de los Reyes hdev->io_started = false; 22404ea54542SDavid Herrmann 22414ea54542SDavid Herrmann hdrv = hdev->driver; 224285cdaf52SJiri Slaby if (hdrv) { 224385cdaf52SJiri Slaby if (hdrv->remove) 224485cdaf52SJiri Slaby hdrv->remove(hdev); 2245c500c971SJiri Slaby else /* default remove */ 2246c500c971SJiri Slaby hid_hw_stop(hdev); 2247a7197c2eSHenrik Rydberg hid_close_report(hdev); 224885cdaf52SJiri Slaby hdev->driver = NULL; 224985cdaf52SJiri Slaby } 225085cdaf52SJiri Slaby 2251c849a614SAndrew de los Reyes if (!hdev->io_started) 2252c849a614SAndrew de los Reyes up(&hdev->driver_input_lock); 2253c849a614SAndrew de los Reyes unlock_driver_lock: 22544ea54542SDavid Herrmann up(&hdev->driver_lock); 2255c849a614SAndrew de los Reyes return ret; 225685cdaf52SJiri Slaby } 225785cdaf52SJiri Slaby 22584d53b801SHenrik Rydberg static ssize_t modalias_show(struct device *dev, struct device_attribute *a, 22594d53b801SHenrik Rydberg char *buf) 22604d53b801SHenrik Rydberg { 22614d53b801SHenrik Rydberg struct hid_device *hdev = container_of(dev, struct hid_device, dev); 22624d53b801SHenrik Rydberg 2263dfa0c5faSRasmus Villemoes return scnprintf(buf, PAGE_SIZE, "hid:b%04Xg%04Xv%08Xp%08X\n", 22644d53b801SHenrik Rydberg hdev->bus, hdev->group, hdev->vendor, hdev->product); 22654d53b801SHenrik Rydberg } 22660d4260e0SGreg Kroah-Hartman static DEVICE_ATTR_RO(modalias); 22674d53b801SHenrik Rydberg 22680d4260e0SGreg Kroah-Hartman static struct attribute *hid_dev_attrs[] = { 22690d4260e0SGreg Kroah-Hartman &dev_attr_modalias.attr, 22700d4260e0SGreg Kroah-Hartman NULL, 22714d53b801SHenrik Rydberg }; 227254f32fd5SAndy Lutomirski static struct bin_attribute *hid_dev_bin_attrs[] = { 227354f32fd5SAndy Lutomirski &dev_bin_attr_report_desc, 227454f32fd5SAndy Lutomirski NULL 227554f32fd5SAndy Lutomirski }; 227654f32fd5SAndy Lutomirski static const struct attribute_group hid_dev_group = { 227754f32fd5SAndy Lutomirski .attrs = hid_dev_attrs, 227854f32fd5SAndy Lutomirski .bin_attrs = hid_dev_bin_attrs, 227954f32fd5SAndy Lutomirski }; 228054f32fd5SAndy Lutomirski __ATTRIBUTE_GROUPS(hid_dev); 22814d53b801SHenrik Rydberg 228285cdaf52SJiri Slaby static int hid_uevent(struct device *dev, struct kobj_uevent_env *env) 228385cdaf52SJiri Slaby { 2284ee79a8f8SGeliang Tang struct hid_device *hdev = to_hid_device(dev); 228585cdaf52SJiri Slaby 228685cdaf52SJiri Slaby if (add_uevent_var(env, "HID_ID=%04X:%08X:%08X", 228785cdaf52SJiri Slaby hdev->bus, hdev->vendor, hdev->product)) 228885cdaf52SJiri Slaby return -ENOMEM; 228985cdaf52SJiri Slaby 229085cdaf52SJiri Slaby if (add_uevent_var(env, "HID_NAME=%s", hdev->name)) 229185cdaf52SJiri Slaby return -ENOMEM; 229285cdaf52SJiri Slaby 229385cdaf52SJiri Slaby if (add_uevent_var(env, "HID_PHYS=%s", hdev->phys)) 229485cdaf52SJiri Slaby return -ENOMEM; 229585cdaf52SJiri Slaby 229685cdaf52SJiri Slaby if (add_uevent_var(env, "HID_UNIQ=%s", hdev->uniq)) 229785cdaf52SJiri Slaby return -ENOMEM; 229885cdaf52SJiri Slaby 22994d53b801SHenrik Rydberg if (add_uevent_var(env, "MODALIAS=hid:b%04Xg%04Xv%08Xp%08X", 23004d53b801SHenrik Rydberg hdev->bus, hdev->group, hdev->vendor, hdev->product)) 230185cdaf52SJiri Slaby return -ENOMEM; 230285cdaf52SJiri Slaby 230385cdaf52SJiri Slaby return 0; 230485cdaf52SJiri Slaby } 230585cdaf52SJiri Slaby 230685cdaf52SJiri Slaby static struct bus_type hid_bus_type = { 230785cdaf52SJiri Slaby .name = "hid", 23080d4260e0SGreg Kroah-Hartman .dev_groups = hid_dev_groups, 230985cdaf52SJiri Slaby .match = hid_bus_match, 231085cdaf52SJiri Slaby .probe = hid_device_probe, 231185cdaf52SJiri Slaby .remove = hid_device_remove, 231285cdaf52SJiri Slaby .uevent = hid_uevent, 231385cdaf52SJiri Slaby }; 231485cdaf52SJiri Slaby 2315bae7eb33SJiri Kosina /* a list of devices that shouldn't be handled by HID core at all */ 2316d458a9dfSJiri Slaby static const struct hid_device_id hid_ignore_list[] = { 2317d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_ACECAD, USB_DEVICE_ID_ACECAD_FLAIR) }, 2318d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_ACECAD, USB_DEVICE_ID_ACECAD_302) }, 2319d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_ADS_TECH, USB_DEVICE_ID_ADS_TECH_RADIO_SI470X) }, 2320d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_01) }, 2321d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_10) }, 2322d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_20) }, 2323d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_21) }, 2324d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_22) }, 2325d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_23) }, 2326d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_24) }, 2327d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_AIRCABLE, USB_DEVICE_ID_AIRCABLE1) }, 2328d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_ALCOR, USB_DEVICE_ID_ALCOR_USBRS232) }, 232977f720b7SStephane Chatty { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_LCM)}, 233077f720b7SStephane Chatty { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_LCM2)}, 233162a56582SAlexey Klimov { HID_USB_DEVICE(USB_VENDOR_ID_AVERMEDIA, USB_DEVICE_ID_AVER_FM_MR800) }, 233211030183SHans de Goede { HID_USB_DEVICE(USB_VENDOR_ID_AXENTIA, USB_DEVICE_ID_AXENTIA_FM_RADIO) }, 2333d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_BERKSHIRE, USB_DEVICE_ID_BERKSHIRE_PCWD) }, 2334d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_CIDC, 0x0103) }, 2335d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_CYGNAL, USB_DEVICE_ID_CYGNAL_RADIO_SI470X) }, 2336adc23259SDinesh Ram { HID_USB_DEVICE(USB_VENDOR_ID_CYGNAL, USB_DEVICE_ID_CYGNAL_RADIO_SI4713) }, 2337d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_CMEDIA, USB_DEVICE_ID_CM109) }, 2338d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_HIDCOM) }, 2339d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_ULTRAMOUSE) }, 23405f6108cfSAlexey Klimov { HID_USB_DEVICE(USB_VENDOR_ID_DEALEXTREAME, USB_DEVICE_ID_DEALEXTREAME_RADIO_SI4701) }, 2341d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_DELORME, USB_DEVICE_ID_DELORME_EARTHMATE) }, 2342d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_DELORME, USB_DEVICE_ID_DELORME_EM_LT20) }, 234373bc7d31SMelchior FRANZ { HID_USB_DEVICE(USB_VENDOR_ID_DREAM_CHEEKY, 0x0004) }, 2344789aaa2eSDan Delaney { HID_USB_DEVICE(USB_VENDOR_ID_DREAM_CHEEKY, 0x000a) }, 23456ccfe64cSBenjamin Tissoires { HID_I2C_DEVICE(USB_VENDOR_ID_ELAN, 0x0400) }, 2346534fcb3bSMichele Curti { HID_I2C_DEVICE(USB_VENDOR_ID_ELAN, 0x0401) }, 2347d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_ESSENTIAL_REALITY, USB_DEVICE_ID_ESSENTIAL_REALITY_P5) }, 234870c66567SPetr Štetiar { HID_USB_DEVICE(USB_VENDOR_ID_ETT, USB_DEVICE_ID_TC5UH) }, 2349df506f2cSPetr Štetiar { HID_USB_DEVICE(USB_VENDOR_ID_ETT, USB_DEVICE_ID_TC4UM) }, 2350b1807719SBenjamin Tissoires { HID_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH, 0x0001) }, 2351d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH, 0x0002) }, 2352d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH, 0x0004) }, 2353d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GOTOP, USB_DEVICE_ID_SUPER_Q2) }, 2354d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GOTOP, USB_DEVICE_ID_GOGOPEN) }, 2355d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GOTOP, USB_DEVICE_ID_PENPOWER) }, 2356d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GRETAGMACBETH, USB_DEVICE_ID_GRETAGMACBETH_HUEY) }, 2357d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GRIFFIN, USB_DEVICE_ID_POWERMATE) }, 2358d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GRIFFIN, USB_DEVICE_ID_SOUNDKNOB) }, 23598e2ce73eSHans de Goede { HID_USB_DEVICE(USB_VENDOR_ID_GRIFFIN, USB_DEVICE_ID_RADIOSHARK) }, 2360d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_90) }, 2361d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_100) }, 2362d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_101) }, 2363d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_103) }, 2364d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_104) }, 2365d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_105) }, 2366d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_106) }, 2367d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_107) }, 2368d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_108) }, 2369d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_200) }, 2370d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_201) }, 2371d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_202) }, 2372d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_203) }, 2373d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_204) }, 2374d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_205) }, 2375d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_206) }, 2376d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_207) }, 2377d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_300) }, 2378d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_301) }, 2379d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_302) }, 2380d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_303) }, 2381d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_304) }, 2382d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_305) }, 2383d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_306) }, 2384d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_307) }, 2385d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_308) }, 2386d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_309) }, 2387d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_400) }, 2388d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_401) }, 2389d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_402) }, 2390d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_403) }, 2391d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_404) }, 2392d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_405) }, 2393d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_500) }, 2394d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_501) }, 2395d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_502) }, 2396d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_503) }, 2397d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_504) }, 2398d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1000) }, 2399d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1001) }, 2400d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1002) }, 2401d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1003) }, 2402d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1004) }, 2403d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1005) }, 2404d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1006) }, 2405d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1007) }, 2406d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_IMATION, USB_DEVICE_ID_DISC_STAKKA) }, 240731b9779cSVincent Palatin { HID_USB_DEVICE(USB_VENDOR_ID_JABRA, USB_DEVICE_ID_JABRA_SPEAK_410) }, 240831b9779cSVincent Palatin { HID_USB_DEVICE(USB_VENDOR_ID_JABRA, USB_DEVICE_ID_JABRA_SPEAK_510) }, 240943c1a0a9SPatrick Plattes { HID_USB_DEVICE(USB_VENDOR_ID_JABRA, USB_DEVICE_ID_JABRA_GN9350E) }, 2410d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_KBGEAR, USB_DEVICE_ID_KBGEAR_JAMSTUDIO) }, 2411c91c21c5SAlexey Klimov { HID_USB_DEVICE(USB_VENDOR_ID_KWORLD, USB_DEVICE_ID_KWORLD_RADIO_FM700) }, 2412d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_GPEN_560) }, 2413eb8141ccSLamarque Vieira Souza { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_KYE, 0x0058) }, 2414d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_CASSY) }, 2415ce97cac8SMichael Hund { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_CASSY2) }, 2416d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_POCKETCASSY) }, 2417ce97cac8SMichael Hund { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_POCKETCASSY2) }, 2418d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MOBILECASSY) }, 2419ce97cac8SMichael Hund { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MOBILECASSY2) }, 2420ce97cac8SMichael Hund { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MICROCASSYVOLTAGE) }, 2421ce97cac8SMichael Hund { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MICROCASSYCURRENT) }, 2422ce97cac8SMichael Hund { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MICROCASSYTIME) }, 2423ce97cac8SMichael Hund { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MICROCASSYTEMPERATURE) }, 2424ce97cac8SMichael Hund { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MICROCASSYPH) }, 2425d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_JWM) }, 2426d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_DMMP) }, 2427d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_UMIP) }, 2428ce97cac8SMichael Hund { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_UMIC) }, 2429ce97cac8SMichael Hund { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_UMIB) }, 2430ce97cac8SMichael Hund { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_XRAY) }, 2431d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_XRAY2) }, 2432d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_VIDEOCOM) }, 2433ce97cac8SMichael Hund { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MOTOR) }, 2434d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_COM3LAB) }, 2435d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_TELEPORT) }, 2436d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_NETWORKANALYSER) }, 2437d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_POWERCONTROL) }, 2438d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MACHINETEST) }, 2439ce97cac8SMichael Hund { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MOSTANALYSER) }, 2440ce97cac8SMichael Hund { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MOSTANALYSER2) }, 2441ce97cac8SMichael Hund { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_ABSESP) }, 2442ce97cac8SMichael Hund { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_AUTODATABUS) }, 2443ce97cac8SMichael Hund { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MCT) }, 2444ce97cac8SMichael Hund { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_HYBRID) }, 2445ce97cac8SMichael Hund { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_HEATCONTROL) }, 24463ffb62cbSYuri Khan { HID_USB_DEVICE(USB_VENDOR_ID_MADCATZ, USB_DEVICE_ID_MADCATZ_BEATPAD) }, 2447d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_MCC, USB_DEVICE_ID_MCC_PMD1024LS) }, 2448d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_MCC, USB_DEVICE_ID_MCC_PMD1208LS) }, 2449d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICKIT1) }, 2450d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICKIT2) }, 2451a8c8316bSKristian Evensen { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICK16F1454) }, 245284f6ea1dSKristian Evensen { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICK16F1454_V2) }, 2453d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_NATIONAL_SEMICONDUCTOR, USB_DEVICE_ID_N_S_HARMONY) }, 2454d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100) }, 2455d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 20) }, 2456d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 30) }, 2457d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 100) }, 2458d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 108) }, 2459d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 118) }, 2460d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 200) }, 2461d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 300) }, 2462d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 400) }, 2463d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 500) }, 2464d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_PANJIT, 0x0001) }, 2465d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_PANJIT, 0x0002) }, 2466d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_PANJIT, 0x0003) }, 2467d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_PANJIT, 0x0004) }, 24684cfae3e8SHenning Glawe { HID_USB_DEVICE(USB_VENDOR_ID_PHILIPS, USB_DEVICE_ID_PHILIPS_IEEE802154_DONGLE) }, 246935cfd1d9SMichael Tokarev { HID_USB_DEVICE(USB_VENDOR_ID_POWERCOM, USB_DEVICE_ID_POWERCOM_UPS) }, 24708491ee10SJan Steinhoff #if defined(CONFIG_MOUSE_SYNAPTICS_USB) || defined(CONFIG_MOUSE_SYNAPTICS_USB_MODULE) 24718491ee10SJan Steinhoff { HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_TP) }, 24728491ee10SJan Steinhoff { HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_INT_TP) }, 24738491ee10SJan Steinhoff { HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_CPAD) }, 24748491ee10SJan Steinhoff { HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_STICK) }, 24758491ee10SJan Steinhoff { HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_WP) }, 24768491ee10SJan Steinhoff { HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_COMP_TP) }, 24778491ee10SJan Steinhoff { HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_WTP) }, 24788491ee10SJan Steinhoff { HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_DPAD) }, 24798491ee10SJan Steinhoff #endif 2480d458a9dfSJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_YEALINK, USB_DEVICE_ID_YEALINK_P1K_P4K_B2K) }, 2481759db9eaSChristian Vogel { HID_USB_DEVICE(USB_VENDOR_ID_RISO_KAGAKU, USB_DEVICE_ID_RI_KA_WEBMAIL) }, 2482d458a9dfSJiri Slaby { } 2483d458a9dfSJiri Slaby }; 2484d458a9dfSJiri Slaby 2485b4d8e473SJiri Slaby /** 2486b4d8e473SJiri Slaby * hid_mouse_ignore_list - mouse devices which should not be handled by the hid layer 2487b4d8e473SJiri Slaby * 2488b4d8e473SJiri Slaby * There are composite devices for which we want to ignore only a certain 2489b4d8e473SJiri Slaby * interface. This is a list of devices for which only the mouse interface will 2490b4d8e473SJiri Slaby * be ignored. This allows a dedicated driver to take care of the interface. 2491b4d8e473SJiri Slaby */ 2492b4d8e473SJiri Slaby static const struct hid_device_id hid_mouse_ignore_list[] = { 2493b4d8e473SJiri Slaby /* appletouch driver */ 2494b4d8e473SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ANSI) }, 2495b4d8e473SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ISO) }, 2496b4d8e473SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ANSI) }, 2497b4d8e473SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ISO) }, 2498b4d8e473SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_JIS) }, 2499b4d8e473SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ANSI) }, 2500b4d8e473SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ISO) }, 2501b4d8e473SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_JIS) }, 2502b4d8e473SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ANSI) }, 2503b4d8e473SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ISO) }, 2504b4d8e473SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_JIS) }, 2505b4d8e473SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ANSI) }, 2506b4d8e473SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ISO) }, 2507b4d8e473SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_JIS) }, 2508b4d8e473SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ANSI) }, 2509b4d8e473SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ISO) }, 2510b4d8e473SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_JIS) }, 2511b4d8e473SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_ANSI) }, 2512b4d8e473SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_ISO) }, 2513b4d8e473SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_JIS) }, 2514ac26fca3SJiri Kosina { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI) }, 2515ac26fca3SJiri Kosina { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ISO) }, 2516ac26fca3SJiri Kosina { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_JIS) }, 251799b9f758SEdgar (gimli) Hucek { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI) }, 251899b9f758SEdgar (gimli) Hucek { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_ISO) }, 251999b9f758SEdgar (gimli) Hucek { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_JIS) }, 252099b9f758SEdgar (gimli) Hucek { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_ANSI) }, 252199b9f758SEdgar (gimli) Hucek { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_ISO) }, 252299b9f758SEdgar (gimli) Hucek { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS) }, 252347340bd9SAndy Botting { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_ANSI) }, 252447340bd9SAndy Botting { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_ISO) }, 252547340bd9SAndy Botting { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_JIS) }, 2526213f9da8SGökçen Eraslan { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_ANSI) }, 2527213f9da8SGökçen Eraslan { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_ISO) }, 2528213f9da8SGökçen Eraslan { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_JIS) }, 25294b086910SJiri Kosina { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6_ANSI) }, 25304b086910SJiri Kosina { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6_ISO) }, 25314b086910SJiri Kosina { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6_JIS) }, 25324b086910SJiri Kosina { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_ANSI) }, 25334b086910SJiri Kosina { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_ISO) }, 25344b086910SJiri Kosina { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_JIS) }, 2535b2e6ad7dSRyan Bourgeois { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_ANSI) }, 2536b2e6ad7dSRyan Bourgeois { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_ISO) }, 2537b2e6ad7dSRyan Bourgeois { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_JIS) }, 25388d80da90SDirk Hohndel { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_ANSI) }, 25398d80da90SDirk Hohndel { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_ISO) }, 25408d80da90SDirk Hohndel { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_JIS) }, 25419d9a04eeSDmitry Torokhov { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING8_ANSI) }, 25429d9a04eeSDmitry Torokhov { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING8_ISO) }, 25439d9a04eeSDmitry Torokhov { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING8_JIS) }, 2544a4a2c545SHenrik Rydberg { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING9_ANSI) }, 2545a4a2c545SHenrik Rydberg { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING9_ISO) }, 2546a4a2c545SHenrik Rydberg { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING9_JIS) }, 2547b4d8e473SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) }, 2548b4d8e473SJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) }, 2549b4d8e473SJiri Slaby { } 2550b4d8e473SJiri Slaby }; 2551b4d8e473SJiri Slaby 25524529eefaSLamarque V. Souza bool hid_ignore(struct hid_device *hdev) 2553d458a9dfSJiri Slaby { 25544529eefaSLamarque V. Souza if (hdev->quirks & HID_QUIRK_NO_IGNORE) 25554529eefaSLamarque V. Souza return false; 25564529eefaSLamarque V. Souza if (hdev->quirks & HID_QUIRK_IGNORE) 25574529eefaSLamarque V. Souza return true; 25584529eefaSLamarque V. Souza 2559d458a9dfSJiri Slaby switch (hdev->vendor) { 2560d458a9dfSJiri Slaby case USB_VENDOR_ID_CODEMERCS: 2561d458a9dfSJiri Slaby /* ignore all Code Mercenaries IOWarrior devices */ 2562d458a9dfSJiri Slaby if (hdev->product >= USB_DEVICE_ID_CODEMERCS_IOW_FIRST && 2563d458a9dfSJiri Slaby hdev->product <= USB_DEVICE_ID_CODEMERCS_IOW_LAST) 2564d458a9dfSJiri Slaby return true; 2565d458a9dfSJiri Slaby break; 2566d458a9dfSJiri Slaby case USB_VENDOR_ID_LOGITECH: 2567d458a9dfSJiri Slaby if (hdev->product >= USB_DEVICE_ID_LOGITECH_HARMONY_FIRST && 2568d458a9dfSJiri Slaby hdev->product <= USB_DEVICE_ID_LOGITECH_HARMONY_LAST) 2569d458a9dfSJiri Slaby return true; 257065dd3b69SHans Verkuil /* 257165dd3b69SHans Verkuil * The Keene FM transmitter USB device has the same USB ID as 257265dd3b69SHans Verkuil * the Logitech AudioHub Speaker, but it should ignore the hid. 257365dd3b69SHans Verkuil * Check if the name is that of the Keene device. 257465dd3b69SHans Verkuil * For reference: the name of the AudioHub is 257565dd3b69SHans Verkuil * "HOLTEK AudioHub Speaker". 257665dd3b69SHans Verkuil */ 257765dd3b69SHans Verkuil if (hdev->product == USB_DEVICE_ID_LOGITECH_AUDIOHUB && 257865dd3b69SHans Verkuil !strcmp(hdev->name, "HOLTEK B-LINK USB Audio ")) 257965dd3b69SHans Verkuil return true; 2580d458a9dfSJiri Slaby break; 258131f7fd79SJarod Wilson case USB_VENDOR_ID_SOUNDGRAPH: 258231f7fd79SJarod Wilson if (hdev->product >= USB_DEVICE_ID_SOUNDGRAPH_IMON_FIRST && 258331f7fd79SJarod Wilson hdev->product <= USB_DEVICE_ID_SOUNDGRAPH_IMON_LAST) 258431f7fd79SJarod Wilson return true; 258531f7fd79SJarod Wilson break; 2586bba5394aSXing Wei case USB_VENDOR_ID_HANWANG: 2587bba5394aSXing Wei if (hdev->product >= USB_DEVICE_ID_HANWANG_TABLET_FIRST && 2588bba5394aSXing Wei hdev->product <= USB_DEVICE_ID_HANWANG_TABLET_LAST) 2589bba5394aSXing Wei return true; 2590bba5394aSXing Wei break; 25916dc1418eSTomoki Sekiyama case USB_VENDOR_ID_JESS: 25926dc1418eSTomoki Sekiyama if (hdev->product == USB_DEVICE_ID_JESS_YUREX && 25936dc1418eSTomoki Sekiyama hdev->type == HID_TYPE_USBNONE) 25946dc1418eSTomoki Sekiyama return true; 25956dc1418eSTomoki Sekiyama break; 259630b6b7d8SIan Abbott case USB_VENDOR_ID_VELLEMAN: 259730b6b7d8SIan Abbott /* These are not HID devices. They are handled by comedi. */ 259830b6b7d8SIan Abbott if ((hdev->product >= USB_DEVICE_ID_VELLEMAN_K8055_FIRST && 259930b6b7d8SIan Abbott hdev->product <= USB_DEVICE_ID_VELLEMAN_K8055_LAST) || 260030b6b7d8SIan Abbott (hdev->product >= USB_DEVICE_ID_VELLEMAN_K8061_FIRST && 260130b6b7d8SIan Abbott hdev->product <= USB_DEVICE_ID_VELLEMAN_K8061_LAST)) 260230b6b7d8SIan Abbott return true; 260330b6b7d8SIan Abbott break; 26045b4617d8SAlexey Klimov case USB_VENDOR_ID_ATMEL_V_USB: 26055b4617d8SAlexey Klimov /* Masterkit MA901 usb radio based on Atmel tiny85 chip and 26065b4617d8SAlexey Klimov * it has the same USB ID as many Atmel V-USB devices. This 26075b4617d8SAlexey Klimov * usb radio is handled by radio-ma901.c driver so we want 26085b4617d8SAlexey Klimov * ignore the hid. Check the name, bus, product and ignore 26095b4617d8SAlexey Klimov * if we have MA901 usb radio. 26105b4617d8SAlexey Klimov */ 26115b4617d8SAlexey Klimov if (hdev->product == USB_DEVICE_ID_ATMEL_V_USB && 26125b4617d8SAlexey Klimov hdev->bus == BUS_USB && 26135b4617d8SAlexey Klimov strncmp(hdev->name, "www.masterkit.ru MA901", 22) == 0) 26145b4617d8SAlexey Klimov return true; 26155b4617d8SAlexey Klimov break; 2616d458a9dfSJiri Slaby } 2617d458a9dfSJiri Slaby 2618b4d8e473SJiri Slaby if (hdev->type == HID_TYPE_USBMOUSE && 2619b4d8e473SJiri Slaby hid_match_id(hdev, hid_mouse_ignore_list)) 2620b4d8e473SJiri Slaby return true; 2621b4d8e473SJiri Slaby 2622d458a9dfSJiri Slaby return !!hid_match_id(hdev, hid_ignore_list); 2623d458a9dfSJiri Slaby } 26244529eefaSLamarque V. Souza EXPORT_SYMBOL_GPL(hid_ignore); 2625d458a9dfSJiri Slaby 262685cdaf52SJiri Slaby int hid_add_device(struct hid_device *hdev) 262785cdaf52SJiri Slaby { 262885cdaf52SJiri Slaby static atomic_t id = ATOMIC_INIT(0); 262985cdaf52SJiri Slaby int ret; 263085cdaf52SJiri Slaby 263185cdaf52SJiri Slaby if (WARN_ON(hdev->status & HID_STAT_ADDED)) 263285cdaf52SJiri Slaby return -EBUSY; 263385cdaf52SJiri Slaby 2634d458a9dfSJiri Slaby /* we need to kill them here, otherwise they will stay allocated to 2635d458a9dfSJiri Slaby * wait for coming driver */ 26364529eefaSLamarque V. Souza if (hid_ignore(hdev)) 2637d458a9dfSJiri Slaby return -ENODEV; 2638d458a9dfSJiri Slaby 2639a7197c2eSHenrik Rydberg /* 26403c86726cSBenjamin Tissoires * Check for the mandatory transport channel. 26413c86726cSBenjamin Tissoires */ 26423c86726cSBenjamin Tissoires if (!hdev->ll_driver->raw_request) { 26433c86726cSBenjamin Tissoires hid_err(hdev, "transport driver missing .raw_request()\n"); 26443c86726cSBenjamin Tissoires return -EINVAL; 26453c86726cSBenjamin Tissoires } 26463c86726cSBenjamin Tissoires 26473c86726cSBenjamin Tissoires /* 2648a7197c2eSHenrik Rydberg * Read the device report descriptor once and use as template 2649a7197c2eSHenrik Rydberg * for the driver-specific modifications. 2650a7197c2eSHenrik Rydberg */ 2651a7197c2eSHenrik Rydberg ret = hdev->ll_driver->parse(hdev); 2652a7197c2eSHenrik Rydberg if (ret) 2653a7197c2eSHenrik Rydberg return ret; 2654a7197c2eSHenrik Rydberg if (!hdev->dev_rdesc) 2655a7197c2eSHenrik Rydberg return -ENODEV; 2656a7197c2eSHenrik Rydberg 2657734c6609SHenrik Rydberg /* 2658734c6609SHenrik Rydberg * Scan generic devices for group information 2659734c6609SHenrik Rydberg */ 2660734c6609SHenrik Rydberg if (hid_ignore_special_drivers || 26619578f41aSBenjamin Tissoires (!hdev->group && 26629578f41aSBenjamin Tissoires !hid_match_id(hdev, hid_have_special_driver))) { 2663734c6609SHenrik Rydberg ret = hid_scan_report(hdev); 2664734c6609SHenrik Rydberg if (ret) 2665734c6609SHenrik Rydberg hid_warn(hdev, "bad device descriptor (%d)\n", ret); 2666734c6609SHenrik Rydberg } 2667734c6609SHenrik Rydberg 26686bbe586fSKay Sievers /* XXX hack, any other cleaner solution after the driver core 26696bbe586fSKay Sievers * is converted to allow more than 20 bytes as the device name? */ 26706bbe586fSKay Sievers dev_set_name(&hdev->dev, "%04X:%04X:%04X.%04X", hdev->bus, 267185cdaf52SJiri Slaby hdev->vendor, hdev->product, atomic_inc_return(&id)); 267285cdaf52SJiri Slaby 26734da361b6SBruno Prémont hid_debug_register(hdev, dev_name(&hdev->dev)); 267485cdaf52SJiri Slaby ret = device_add(&hdev->dev); 267585cdaf52SJiri Slaby if (!ret) 267685cdaf52SJiri Slaby hdev->status |= HID_STAT_ADDED; 26774da361b6SBruno Prémont else 26784da361b6SBruno Prémont hid_debug_unregister(hdev); 2679a635f9ddSJiri Kosina 268085cdaf52SJiri Slaby return ret; 268185cdaf52SJiri Slaby } 268285cdaf52SJiri Slaby EXPORT_SYMBOL_GPL(hid_add_device); 268385cdaf52SJiri Slaby 268485cdaf52SJiri Slaby /** 268585cdaf52SJiri Slaby * hid_allocate_device - allocate new hid device descriptor 268685cdaf52SJiri Slaby * 268785cdaf52SJiri Slaby * Allocate and initialize hid device, so that hid_destroy_device might be 268885cdaf52SJiri Slaby * used to free it. 268985cdaf52SJiri Slaby * 269085cdaf52SJiri Slaby * New hid_device pointer is returned on success, otherwise ERR_PTR encoded 269185cdaf52SJiri Slaby * error value. 269285cdaf52SJiri Slaby */ 269385cdaf52SJiri Slaby struct hid_device *hid_allocate_device(void) 269485cdaf52SJiri Slaby { 269585cdaf52SJiri Slaby struct hid_device *hdev; 269685cdaf52SJiri Slaby int ret = -ENOMEM; 269785cdaf52SJiri Slaby 269885cdaf52SJiri Slaby hdev = kzalloc(sizeof(*hdev), GFP_KERNEL); 269985cdaf52SJiri Slaby if (hdev == NULL) 270085cdaf52SJiri Slaby return ERR_PTR(ret); 270185cdaf52SJiri Slaby 270285cdaf52SJiri Slaby device_initialize(&hdev->dev); 270385cdaf52SJiri Slaby hdev->dev.release = hid_device_release; 270485cdaf52SJiri Slaby hdev->dev.bus = &hid_bus_type; 270564bebefcSFu, Zhonghui device_enable_async_suspend(&hdev->dev); 270685cdaf52SJiri Slaby 2707a7197c2eSHenrik Rydberg hid_close_report(hdev); 270885cdaf52SJiri Slaby 2709cd667ce2SJiri Kosina init_waitqueue_head(&hdev->debug_wait); 2710cd667ce2SJiri Kosina INIT_LIST_HEAD(&hdev->debug_list); 27111deb9d34SJiri Kosina spin_lock_init(&hdev->debug_list_lock); 27124ea54542SDavid Herrmann sema_init(&hdev->driver_lock, 1); 2713c849a614SAndrew de los Reyes sema_init(&hdev->driver_input_lock, 1); 2714cd667ce2SJiri Kosina 271585cdaf52SJiri Slaby return hdev; 271685cdaf52SJiri Slaby } 271785cdaf52SJiri Slaby EXPORT_SYMBOL_GPL(hid_allocate_device); 271885cdaf52SJiri Slaby 271985cdaf52SJiri Slaby static void hid_remove_device(struct hid_device *hdev) 272085cdaf52SJiri Slaby { 272185cdaf52SJiri Slaby if (hdev->status & HID_STAT_ADDED) { 272285cdaf52SJiri Slaby device_del(&hdev->dev); 2723a635f9ddSJiri Kosina hid_debug_unregister(hdev); 272485cdaf52SJiri Slaby hdev->status &= ~HID_STAT_ADDED; 272585cdaf52SJiri Slaby } 2726a7197c2eSHenrik Rydberg kfree(hdev->dev_rdesc); 2727a7197c2eSHenrik Rydberg hdev->dev_rdesc = NULL; 2728a7197c2eSHenrik Rydberg hdev->dev_rsize = 0; 272985cdaf52SJiri Slaby } 273085cdaf52SJiri Slaby 273185cdaf52SJiri Slaby /** 273285cdaf52SJiri Slaby * hid_destroy_device - free previously allocated device 273385cdaf52SJiri Slaby * 273485cdaf52SJiri Slaby * @hdev: hid device 273585cdaf52SJiri Slaby * 273685cdaf52SJiri Slaby * If you allocate hid_device through hid_allocate_device, you should ever 273785cdaf52SJiri Slaby * free by this function. 273885cdaf52SJiri Slaby */ 273985cdaf52SJiri Slaby void hid_destroy_device(struct hid_device *hdev) 274085cdaf52SJiri Slaby { 274185cdaf52SJiri Slaby hid_remove_device(hdev); 274285cdaf52SJiri Slaby put_device(&hdev->dev); 274385cdaf52SJiri Slaby } 274485cdaf52SJiri Slaby EXPORT_SYMBOL_GPL(hid_destroy_device); 274585cdaf52SJiri Slaby 274685cdaf52SJiri Slaby int __hid_register_driver(struct hid_driver *hdrv, struct module *owner, 274785cdaf52SJiri Slaby const char *mod_name) 274885cdaf52SJiri Slaby { 27493a6f82f7SJiri Slaby int ret; 27503a6f82f7SJiri Slaby 275185cdaf52SJiri Slaby hdrv->driver.name = hdrv->name; 275285cdaf52SJiri Slaby hdrv->driver.bus = &hid_bus_type; 275385cdaf52SJiri Slaby hdrv->driver.owner = owner; 275485cdaf52SJiri Slaby hdrv->driver.mod_name = mod_name; 275585cdaf52SJiri Slaby 27563a6f82f7SJiri Slaby INIT_LIST_HEAD(&hdrv->dyn_list); 27573a6f82f7SJiri Slaby spin_lock_init(&hdrv->dyn_lock); 27583a6f82f7SJiri Slaby 27593a6f82f7SJiri Slaby ret = driver_register(&hdrv->driver); 27603a6f82f7SJiri Slaby if (ret) 27613a6f82f7SJiri Slaby return ret; 27623a6f82f7SJiri Slaby 27633a6f82f7SJiri Slaby ret = driver_create_file(&hdrv->driver, &driver_attr_new_id); 27643a6f82f7SJiri Slaby if (ret) 27653a6f82f7SJiri Slaby driver_unregister(&hdrv->driver); 27663a6f82f7SJiri Slaby 27673a6f82f7SJiri Slaby return ret; 276885cdaf52SJiri Slaby } 276985cdaf52SJiri Slaby EXPORT_SYMBOL_GPL(__hid_register_driver); 277085cdaf52SJiri Slaby 277185cdaf52SJiri Slaby void hid_unregister_driver(struct hid_driver *hdrv) 277285cdaf52SJiri Slaby { 27733a6f82f7SJiri Slaby driver_remove_file(&hdrv->driver, &driver_attr_new_id); 277485cdaf52SJiri Slaby driver_unregister(&hdrv->driver); 27753a6f82f7SJiri Slaby hid_free_dynids(hdrv); 277685cdaf52SJiri Slaby } 277785cdaf52SJiri Slaby EXPORT_SYMBOL_GPL(hid_unregister_driver); 277885cdaf52SJiri Slaby 27790361a28dSOliver Neukum int hid_check_keys_pressed(struct hid_device *hid) 27800361a28dSOliver Neukum { 27810361a28dSOliver Neukum struct hid_input *hidinput; 27820361a28dSOliver Neukum int i; 27830361a28dSOliver Neukum 2784e5288eb5SJiri Kosina if (!(hid->claimed & HID_CLAIMED_INPUT)) 2785e5288eb5SJiri Kosina return 0; 2786e5288eb5SJiri Kosina 27870361a28dSOliver Neukum list_for_each_entry(hidinput, &hid->inputs, list) { 27880361a28dSOliver Neukum for (i = 0; i < BITS_TO_LONGS(KEY_MAX); i++) 27890361a28dSOliver Neukum if (hidinput->input->key[i]) 27900361a28dSOliver Neukum return 1; 27910361a28dSOliver Neukum } 27920361a28dSOliver Neukum 27930361a28dSOliver Neukum return 0; 27940361a28dSOliver Neukum } 27950361a28dSOliver Neukum 27960361a28dSOliver Neukum EXPORT_SYMBOL_GPL(hid_check_keys_pressed); 27970361a28dSOliver Neukum 279886166b7bSJiri Kosina static int __init hid_init(void) 279986166b7bSJiri Kosina { 280085cdaf52SJiri Slaby int ret; 280185cdaf52SJiri Slaby 2802a635f9ddSJiri Kosina if (hid_debug) 28034291ee30SJoe Perches pr_warn("hid_debug is now used solely for parser and driver debugging.\n" 28044291ee30SJoe Perches "debugfs is now used for inspecting the device (report descriptor, reports)\n"); 2805a635f9ddSJiri Kosina 280685cdaf52SJiri Slaby ret = bus_register(&hid_bus_type); 280785cdaf52SJiri Slaby if (ret) { 28084291ee30SJoe Perches pr_err("can't register hid bus\n"); 280985cdaf52SJiri Slaby goto err; 281085cdaf52SJiri Slaby } 281185cdaf52SJiri Slaby 281285cdaf52SJiri Slaby ret = hidraw_init(); 281385cdaf52SJiri Slaby if (ret) 281485cdaf52SJiri Slaby goto err_bus; 281585cdaf52SJiri Slaby 2816a635f9ddSJiri Kosina hid_debug_init(); 2817a635f9ddSJiri Kosina 281885cdaf52SJiri Slaby return 0; 281985cdaf52SJiri Slaby err_bus: 282085cdaf52SJiri Slaby bus_unregister(&hid_bus_type); 282185cdaf52SJiri Slaby err: 282285cdaf52SJiri Slaby return ret; 282386166b7bSJiri Kosina } 282486166b7bSJiri Kosina 282586166b7bSJiri Kosina static void __exit hid_exit(void) 282686166b7bSJiri Kosina { 2827a635f9ddSJiri Kosina hid_debug_exit(); 282886166b7bSJiri Kosina hidraw_exit(); 282985cdaf52SJiri Slaby bus_unregister(&hid_bus_type); 283086166b7bSJiri Kosina } 283186166b7bSJiri Kosina 283286166b7bSJiri Kosina module_init(hid_init); 283386166b7bSJiri Kosina module_exit(hid_exit); 283486166b7bSJiri Kosina 283588adb72bSJiri Kosina MODULE_AUTHOR("Andreas Gal"); 283688adb72bSJiri Kosina MODULE_AUTHOR("Vojtech Pavlik"); 283788adb72bSJiri Kosina MODULE_AUTHOR("Jiri Kosina"); 2838aa938f79SJiri Kosina MODULE_LICENSE(DRIVER_LICENSE); 2839aa938f79SJiri Kosina 2840