1dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina/* 2229695e51efc4ed5e04ab471c82591d0f432909dJiri Kosina * HID support for Linux 3dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina * 4dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina * Copyright (c) 1999 Andreas Gal 5dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina * Copyright (c) 2000-2005 Vojtech Pavlik <vojtech@suse.cz> 6dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina * Copyright (c) 2005 Michael Haboustak <mike-@cinci.rr.com> for Concept2, Inc 77d39e849912f0c3c8c6fc94be7bf7d120b1ee0baJiri Kosina * Copyright (c) 2006-2010 Jiri Kosina 8dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina */ 9dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 10dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina/* 11dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina * This program is free software; you can redistribute it and/or modify it 12dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina * under the terms of the GNU General Public License as published by the Free 13dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina * Software Foundation; either version 2 of the License, or (at your option) 14dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina * any later version. 15dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina */ 16dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 174291ee305e9bb0699504a66f0e2b7aefcf0512a5Joe Perches#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 184291ee305e9bb0699504a66f0e2b7aefcf0512a5Joe Perches 19dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina#include <linux/module.h> 20dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina#include <linux/slab.h> 21dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina#include <linux/init.h> 22dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina#include <linux/kernel.h> 23dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina#include <linux/list.h> 24dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina#include <linux/mm.h> 25dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina#include <linux/spinlock.h> 26dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina#include <asm/unaligned.h> 27dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina#include <asm/byteorder.h> 28dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina#include <linux/input.h> 29dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina#include <linux/wait.h> 3047a80edb1d80ae644ea374a016c8e68d43d2671fJiri Kosina#include <linux/vmalloc.h> 31c4124c9b68bf8ecf1e8afedad3a22e18666cb6f3Jiri Kosina#include <linux/sched.h> 324ea5454203d991ec85264f64f89ca8855fce69b0David Herrmann#include <linux/semaphore.h> 33dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 34dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina#include <linux/hid.h> 35dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina#include <linux/hiddev.h> 36c080d89ad91e98fec0e8fc5f448a1ad899bd85c7Jiri Kosina#include <linux/hid-debug.h> 3786166b7bcda0bcb53525114fa1c87ac432be478eJiri Kosina#include <linux/hidraw.h> 38dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 395f22a7992349c5ca3842190be52d5e9a1dd7adf4Jiri Slaby#include "hid-ids.h" 405f22a7992349c5ca3842190be52d5e9a1dd7adf4Jiri Slaby 41dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina/* 42dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina * Version Information 43dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina */ 44dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 45531498013163c72cee8540e98e12c0c430c7fe87Jiri Kosina#define DRIVER_DESC "HID core driver" 46dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina#define DRIVER_LICENSE "GPL" 47dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 4858037eb961f859607b161c50d9d4ecb374de1e8fJiri Kosinaint hid_debug = 0; 49377e10fbb4ef219f540d06796e9fb0d3ec35a58fAnssi Hannulamodule_param_named(debug, hid_debug, int, 0600); 50cd667ce24796700e1a0e6e7528efc61c96ff832eJiri KosinaMODULE_PARM_DESC(debug, "toggle HID debugging messages"); 5158037eb961f859607b161c50d9d4ecb374de1e8fJiri KosinaEXPORT_SYMBOL_GPL(hid_debug); 5258037eb961f859607b161c50d9d4ecb374de1e8fJiri Kosina 53dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina/* 54dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina * Register a new report for a device. 55dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina */ 56dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 5790a006abf8015c8cab893555244d8fc673b24839Michael Poolestruct hid_report *hid_register_report(struct hid_device *device, unsigned type, unsigned id) 58dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina{ 59dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina struct hid_report_enum *report_enum = device->report_enum + type; 60dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina struct hid_report *report; 61dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 62dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina if (report_enum->report_id_hash[id]) 63dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina return report_enum->report_id_hash[id]; 64dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 65a3789a1783d37f2772ba5046b26416c98dfe1bfaJoe Perches report = kzalloc(sizeof(struct hid_report), GFP_KERNEL); 66a3789a1783d37f2772ba5046b26416c98dfe1bfaJoe Perches if (!report) 67dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina return NULL; 68dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 69dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina if (id != 0) 70dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina report_enum->numbered = 1; 71dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 72dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina report->id = id; 73dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina report->type = type; 74dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina report->size = 0; 75dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina report->device = device; 76dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina report_enum->report_id_hash[id] = report; 77dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 78dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina list_add_tail(&report->list, &report_enum->report_list); 79dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 80dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina return report; 81dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina} 8290a006abf8015c8cab893555244d8fc673b24839Michael PooleEXPORT_SYMBOL_GPL(hid_register_report); 83dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 84dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina/* 85dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina * Register a new field for this report. 86dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina */ 87dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 88dde5845a529ff753364a6d1aea61180946270bfaJiri Kosinastatic struct hid_field *hid_register_field(struct hid_report *report, unsigned usages, unsigned values) 89dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina{ 90dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina struct hid_field *field; 91dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 92dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina if (report->maxfield == HID_MAX_FIELDS) { 938c3d52fc393b5be8b14dad67053ed83195f0d002Jiri Kosina hid_err(report->device, "too many fields in report\n"); 94dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina return NULL; 95dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina } 96dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 97a3789a1783d37f2772ba5046b26416c98dfe1bfaJoe Perches field = kzalloc((sizeof(struct hid_field) + 98a3789a1783d37f2772ba5046b26416c98dfe1bfaJoe Perches usages * sizeof(struct hid_usage) + 99a3789a1783d37f2772ba5046b26416c98dfe1bfaJoe Perches values * sizeof(unsigned)), GFP_KERNEL); 100a3789a1783d37f2772ba5046b26416c98dfe1bfaJoe Perches if (!field) 101a3789a1783d37f2772ba5046b26416c98dfe1bfaJoe Perches return NULL; 102dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 103dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina field->index = report->maxfield++; 104dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina report->field[field->index] = field; 105dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina field->usage = (struct hid_usage *)(field + 1); 106282bfd4cbcc2bbeb1a2cad1f42debd378e0b5ac9Jiri Slaby field->value = (s32 *)(field->usage + usages); 107dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina field->report = report; 108dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 109dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina return field; 110dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina} 111dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 112dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina/* 113dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina * Open a collection. The type/usage is pushed on the stack. 114dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina */ 115dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 116dde5845a529ff753364a6d1aea61180946270bfaJiri Kosinastatic int open_collection(struct hid_parser *parser, unsigned type) 117dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina{ 118dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina struct hid_collection *collection; 119dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina unsigned usage; 120dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 121dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina usage = parser->local.usage[0]; 122dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 123dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina if (parser->collection_stack_ptr == HID_COLLECTION_STACK_SIZE) { 1248c3d52fc393b5be8b14dad67053ed83195f0d002Jiri Kosina hid_err(parser->device, "collection stack overflow\n"); 125dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina return -1; 126dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina } 127dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 128dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina if (parser->device->maxcollection == parser->device->collection_size) { 129dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina collection = kmalloc(sizeof(struct hid_collection) * 130dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina parser->device->collection_size * 2, GFP_KERNEL); 131dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina if (collection == NULL) { 1328c3d52fc393b5be8b14dad67053ed83195f0d002Jiri Kosina hid_err(parser->device, "failed to reallocate collection array\n"); 133dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina return -1; 134dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina } 135dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina memcpy(collection, parser->device->collection, 136dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina sizeof(struct hid_collection) * 137dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina parser->device->collection_size); 138dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina memset(collection + parser->device->collection_size, 0, 139dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina sizeof(struct hid_collection) * 140dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina parser->device->collection_size); 141dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina kfree(parser->device->collection); 142dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina parser->device->collection = collection; 143dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina parser->device->collection_size *= 2; 144dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina } 145dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 146dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina parser->collection_stack[parser->collection_stack_ptr++] = 147dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina parser->device->maxcollection; 148dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 149dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina collection = parser->device->collection + 150dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina parser->device->maxcollection++; 151dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina collection->type = type; 152dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina collection->usage = usage; 153dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina collection->level = parser->collection_stack_ptr - 1; 154dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 155dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina if (type == HID_COLLECTION_APPLICATION) 156dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina parser->device->maxapplication++; 157dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 158dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina return 0; 159dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina} 160dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 161dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina/* 162dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina * Close a collection. 163dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina */ 164dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 165dde5845a529ff753364a6d1aea61180946270bfaJiri Kosinastatic int close_collection(struct hid_parser *parser) 166dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina{ 167dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina if (!parser->collection_stack_ptr) { 1688c3d52fc393b5be8b14dad67053ed83195f0d002Jiri Kosina hid_err(parser->device, "collection stack underflow\n"); 169dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina return -1; 170dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina } 171dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina parser->collection_stack_ptr--; 172dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina return 0; 173dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina} 174dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 175dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina/* 176dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina * Climb up the stack, search for the specified collection type 177dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina * and return the usage. 178dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina */ 179dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 180dde5845a529ff753364a6d1aea61180946270bfaJiri Kosinastatic unsigned hid_lookup_collection(struct hid_parser *parser, unsigned type) 181dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina{ 182504499f22c08a03e2e19dc88d31aa0ecd2ac815eJoe Perches struct hid_collection *collection = parser->device->collection; 183dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina int n; 184504499f22c08a03e2e19dc88d31aa0ecd2ac815eJoe Perches 185504499f22c08a03e2e19dc88d31aa0ecd2ac815eJoe Perches for (n = parser->collection_stack_ptr - 1; n >= 0; n--) { 186504499f22c08a03e2e19dc88d31aa0ecd2ac815eJoe Perches unsigned index = parser->collection_stack[n]; 187504499f22c08a03e2e19dc88d31aa0ecd2ac815eJoe Perches if (collection[index].type == type) 188504499f22c08a03e2e19dc88d31aa0ecd2ac815eJoe Perches return collection[index].usage; 189504499f22c08a03e2e19dc88d31aa0ecd2ac815eJoe Perches } 190dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina return 0; /* we know nothing about this usage type */ 191dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina} 192dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 193dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina/* 194dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina * Add a usage to the temporary parser table. 195dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina */ 196dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 197dde5845a529ff753364a6d1aea61180946270bfaJiri Kosinastatic int hid_add_usage(struct hid_parser *parser, unsigned usage) 198dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina{ 199dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina if (parser->local.usage_index >= HID_MAX_USAGES) { 2008c3d52fc393b5be8b14dad67053ed83195f0d002Jiri Kosina hid_err(parser->device, "usage index exceeded\n"); 201dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina return -1; 202dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina } 203dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina parser->local.usage[parser->local.usage_index] = usage; 204dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina parser->local.collection_index[parser->local.usage_index] = 205dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina parser->collection_stack_ptr ? 206dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina parser->collection_stack[parser->collection_stack_ptr - 1] : 0; 207dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina parser->local.usage_index++; 208dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina return 0; 209dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina} 210dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 211dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina/* 212dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina * Register a new field for this report. 213dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina */ 214dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 215dde5845a529ff753364a6d1aea61180946270bfaJiri Kosinastatic int hid_add_field(struct hid_parser *parser, unsigned report_type, unsigned flags) 216dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina{ 217dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina struct hid_report *report; 218dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina struct hid_field *field; 219dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina int usages; 220dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina unsigned offset; 221dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina int i; 222dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 223a3789a1783d37f2772ba5046b26416c98dfe1bfaJoe Perches report = hid_register_report(parser->device, report_type, parser->global.report_id); 224a3789a1783d37f2772ba5046b26416c98dfe1bfaJoe Perches if (!report) { 2258c3d52fc393b5be8b14dad67053ed83195f0d002Jiri Kosina hid_err(parser->device, "hid_register_report failed\n"); 226dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina return -1; 227dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina } 228dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 229dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina if (parser->global.logical_maximum < parser->global.logical_minimum) { 2308c3d52fc393b5be8b14dad67053ed83195f0d002Jiri Kosina hid_err(parser->device, "logical range invalid %d %d\n", 2318c3d52fc393b5be8b14dad67053ed83195f0d002Jiri Kosina parser->global.logical_minimum, parser->global.logical_maximum); 232dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina return -1; 233dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina } 234dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 235dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina offset = report->size; 236dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina report->size += parser->global.report_size * parser->global.report_count; 237dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 238dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina if (!parser->local.usage_index) /* Ignore padding fields */ 239dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina return 0; 240dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 241dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina usages = max_t(int, parser->local.usage_index, parser->global.report_count); 242dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 243a3789a1783d37f2772ba5046b26416c98dfe1bfaJoe Perches field = hid_register_field(report, usages, parser->global.report_count); 244a3789a1783d37f2772ba5046b26416c98dfe1bfaJoe Perches if (!field) 245dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina return 0; 246dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 247dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina field->physical = hid_lookup_collection(parser, HID_COLLECTION_PHYSICAL); 248dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina field->logical = hid_lookup_collection(parser, HID_COLLECTION_LOGICAL); 249dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina field->application = hid_lookup_collection(parser, HID_COLLECTION_APPLICATION); 250dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 251dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina for (i = 0; i < usages; i++) { 252dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina int j = i; 253dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina /* Duplicate the last usage we parsed if we have excess values */ 254dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina if (i >= parser->local.usage_index) 255dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina j = parser->local.usage_index - 1; 256dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina field->usage[i].hid = parser->local.usage[j]; 257dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina field->usage[i].collection_index = 258dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina parser->local.collection_index[j]; 259dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina } 260dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 261dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina field->maxusage = usages; 262dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina field->flags = flags; 263dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina field->report_offset = offset; 264dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina field->report_type = report_type; 265dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina field->report_size = parser->global.report_size; 266dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina field->report_count = parser->global.report_count; 267dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina field->logical_minimum = parser->global.logical_minimum; 268dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina field->logical_maximum = parser->global.logical_maximum; 269dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina field->physical_minimum = parser->global.physical_minimum; 270dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina field->physical_maximum = parser->global.physical_maximum; 271dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina field->unit_exponent = parser->global.unit_exponent; 272dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina field->unit = parser->global.unit; 273dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 274dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina return 0; 275dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina} 276dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 277dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina/* 278dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina * Read data value from item. 279dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina */ 280dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 281dde5845a529ff753364a6d1aea61180946270bfaJiri Kosinastatic u32 item_udata(struct hid_item *item) 282dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina{ 283dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina switch (item->size) { 284880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby case 1: return item->data.u8; 285880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby case 2: return item->data.u16; 286880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby case 4: return item->data.u32; 287dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina } 288dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina return 0; 289dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina} 290dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 291dde5845a529ff753364a6d1aea61180946270bfaJiri Kosinastatic s32 item_sdata(struct hid_item *item) 292dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina{ 293dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina switch (item->size) { 294880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby case 1: return item->data.s8; 295880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby case 2: return item->data.s16; 296880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby case 4: return item->data.s32; 297dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina } 298dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina return 0; 299dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina} 300dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 301dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina/* 302dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina * Process a global item. 303dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina */ 304dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 305dde5845a529ff753364a6d1aea61180946270bfaJiri Kosinastatic int hid_parser_global(struct hid_parser *parser, struct hid_item *item) 306dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina{ 307dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina switch (item->tag) { 308880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby case HID_GLOBAL_ITEM_TAG_PUSH: 309dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 310880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby if (parser->global_stack_ptr == HID_GLOBAL_STACK_SIZE) { 3118c3d52fc393b5be8b14dad67053ed83195f0d002Jiri Kosina hid_err(parser->device, "global environment stack overflow\n"); 312880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby return -1; 313880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby } 314dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 315880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby memcpy(parser->global_stack + parser->global_stack_ptr++, 316880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby &parser->global, sizeof(struct hid_global)); 317880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby return 0; 318dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 319880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby case HID_GLOBAL_ITEM_TAG_POP: 320dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 321880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby if (!parser->global_stack_ptr) { 3228c3d52fc393b5be8b14dad67053ed83195f0d002Jiri Kosina hid_err(parser->device, "global environment stack underflow\n"); 323880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby return -1; 324880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby } 325dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 326880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby memcpy(&parser->global, parser->global_stack + 327880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby --parser->global_stack_ptr, sizeof(struct hid_global)); 328880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby return 0; 329dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 330880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby case HID_GLOBAL_ITEM_TAG_USAGE_PAGE: 331880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby parser->global.usage_page = item_udata(item); 332880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby return 0; 333dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 334880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby case HID_GLOBAL_ITEM_TAG_LOGICAL_MINIMUM: 335880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby parser->global.logical_minimum = item_sdata(item); 336880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby return 0; 337dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 338880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby case HID_GLOBAL_ITEM_TAG_LOGICAL_MAXIMUM: 339880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby if (parser->global.logical_minimum < 0) 340880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby parser->global.logical_maximum = item_sdata(item); 341880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby else 342880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby parser->global.logical_maximum = item_udata(item); 343880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby return 0; 344dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 345880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby case HID_GLOBAL_ITEM_TAG_PHYSICAL_MINIMUM: 346880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby parser->global.physical_minimum = item_sdata(item); 347880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby return 0; 348dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 349880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby case HID_GLOBAL_ITEM_TAG_PHYSICAL_MAXIMUM: 350880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby if (parser->global.physical_minimum < 0) 351880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby parser->global.physical_maximum = item_sdata(item); 352880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby else 353880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby parser->global.physical_maximum = item_udata(item); 354880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby return 0; 355dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 356880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby case HID_GLOBAL_ITEM_TAG_UNIT_EXPONENT: 357880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby parser->global.unit_exponent = item_sdata(item); 358880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby return 0; 359dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 360880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby case HID_GLOBAL_ITEM_TAG_UNIT: 361880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby parser->global.unit = item_udata(item); 362880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby return 0; 363dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 364880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby case HID_GLOBAL_ITEM_TAG_REPORT_SIZE: 365880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby parser->global.report_size = item_udata(item); 366e46e927b9b7e8d95526e69322855243882b7e1a3Chase Douglas if (parser->global.report_size > 96) { 3678c3d52fc393b5be8b14dad67053ed83195f0d002Jiri Kosina hid_err(parser->device, "invalid report_size %d\n", 368880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby parser->global.report_size); 369880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby return -1; 370880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby } 371880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby return 0; 372dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 373880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby case HID_GLOBAL_ITEM_TAG_REPORT_COUNT: 374880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby parser->global.report_count = item_udata(item); 375880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby if (parser->global.report_count > HID_MAX_USAGES) { 3768c3d52fc393b5be8b14dad67053ed83195f0d002Jiri Kosina hid_err(parser->device, "invalid report_count %d\n", 377880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby parser->global.report_count); 378880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby return -1; 379880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby } 380880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby return 0; 381dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 382880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby case HID_GLOBAL_ITEM_TAG_REPORT_ID: 383880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby parser->global.report_id = item_udata(item); 384880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby if (parser->global.report_id == 0) { 3858c3d52fc393b5be8b14dad67053ed83195f0d002Jiri Kosina hid_err(parser->device, "report_id 0 is invalid\n"); 386dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina return -1; 387880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby } 388880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby return 0; 389880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby 390880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby default: 3918c3d52fc393b5be8b14dad67053ed83195f0d002Jiri Kosina hid_err(parser->device, "unknown global tag 0x%x\n", item->tag); 392880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby return -1; 393dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina } 394dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina} 395dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 396dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina/* 397dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina * Process a local item. 398dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina */ 399dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 400dde5845a529ff753364a6d1aea61180946270bfaJiri Kosinastatic int hid_parser_local(struct hid_parser *parser, struct hid_item *item) 401dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina{ 402dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina __u32 data; 403dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina unsigned n; 404dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 405dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina data = item_udata(item); 406dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 407dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina switch (item->tag) { 408880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby case HID_LOCAL_ITEM_TAG_DELIMITER: 409880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby 410880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby if (data) { 411880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby /* 412880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby * We treat items before the first delimiter 413880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby * as global to all usage sets (branch 0). 414880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby * In the moment we process only these global 415880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby * items and the first delimiter set. 416880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby */ 417880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby if (parser->local.delimiter_depth != 0) { 4188c3d52fc393b5be8b14dad67053ed83195f0d002Jiri Kosina hid_err(parser->device, "nested delimiters\n"); 419880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby return -1; 420dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina } 421880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby parser->local.delimiter_depth++; 422880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby parser->local.delimiter_branch++; 423880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby } else { 424880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby if (parser->local.delimiter_depth < 1) { 4258c3d52fc393b5be8b14dad67053ed83195f0d002Jiri Kosina hid_err(parser->device, "bogus close delimiter\n"); 426880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby return -1; 427dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina } 428880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby parser->local.delimiter_depth--; 429880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby } 430880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby return 1; 431dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 432880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby case HID_LOCAL_ITEM_TAG_USAGE: 433dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 434880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby if (parser->local.delimiter_branch > 1) { 435880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby dbg_hid("alternative usage ignored\n"); 436880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby return 0; 437880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby } 438dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 439880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby if (item->size <= 2) 440880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby data = (parser->global.usage_page << 16) + data; 441dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 442880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby return hid_add_usage(parser, data); 443dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 444880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby case HID_LOCAL_ITEM_TAG_USAGE_MINIMUM: 445dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 446880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby if (parser->local.delimiter_branch > 1) { 447880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby dbg_hid("alternative usage ignored\n"); 448dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina return 0; 449880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby } 450dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 451880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby if (item->size <= 2) 452880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby data = (parser->global.usage_page << 16) + data; 453dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 454880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby parser->local.usage_minimum = data; 455880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby return 0; 456dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 457880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby case HID_LOCAL_ITEM_TAG_USAGE_MAXIMUM: 458dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 459880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby if (parser->local.delimiter_branch > 1) { 460880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby dbg_hid("alternative usage ignored\n"); 461dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina return 0; 462880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby } 463dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 464880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby if (item->size <= 2) 465880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby data = (parser->global.usage_page << 16) + data; 466dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 467880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby for (n = parser->local.usage_minimum; n <= data; n++) 468880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby if (hid_add_usage(parser, n)) { 469880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby dbg_hid("hid_add_usage failed\n"); 470880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby return -1; 471880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby } 472880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby return 0; 473880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby 474880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby default: 475880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby 476880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby dbg_hid("unknown local item tag 0x%x\n", item->tag); 477880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby return 0; 478dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina } 479dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina return 0; 480dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina} 481dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 482dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina/* 483dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina * Process a main item. 484dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina */ 485dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 486dde5845a529ff753364a6d1aea61180946270bfaJiri Kosinastatic int hid_parser_main(struct hid_parser *parser, struct hid_item *item) 487dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina{ 488dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina __u32 data; 489dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina int ret; 490dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 491dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina data = item_udata(item); 492dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 493dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina switch (item->tag) { 494880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby case HID_MAIN_ITEM_TAG_BEGIN_COLLECTION: 495880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby ret = open_collection(parser, data & 0xff); 496880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby break; 497880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby case HID_MAIN_ITEM_TAG_END_COLLECTION: 498880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby ret = close_collection(parser); 499880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby break; 500880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby case HID_MAIN_ITEM_TAG_INPUT: 501880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby ret = hid_add_field(parser, HID_INPUT_REPORT, data); 502880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby break; 503880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby case HID_MAIN_ITEM_TAG_OUTPUT: 504880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby ret = hid_add_field(parser, HID_OUTPUT_REPORT, data); 505880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby break; 506880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby case HID_MAIN_ITEM_TAG_FEATURE: 507880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby ret = hid_add_field(parser, HID_FEATURE_REPORT, data); 508880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby break; 509880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby default: 5108c3d52fc393b5be8b14dad67053ed83195f0d002Jiri Kosina hid_err(parser->device, "unknown main item tag 0x%x\n", item->tag); 511880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby ret = 0; 512dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina } 513dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 514dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina memset(&parser->local, 0, sizeof(parser->local)); /* Reset the local parser environment */ 515dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 516dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina return ret; 517dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina} 518dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 519dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina/* 520dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina * Process a reserved item. 521dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina */ 522dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 523dde5845a529ff753364a6d1aea61180946270bfaJiri Kosinastatic int hid_parser_reserved(struct hid_parser *parser, struct hid_item *item) 524dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina{ 52558037eb961f859607b161c50d9d4ecb374de1e8fJiri Kosina dbg_hid("reserved item type, tag 0x%x\n", item->tag); 526dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina return 0; 527dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina} 528dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 529dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina/* 530dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina * Free a report and all registered fields. The field->usage and 531dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina * field->value table's are allocated behind the field, so we need 532dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina * only to free(field) itself. 533dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina */ 534dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 535dde5845a529ff753364a6d1aea61180946270bfaJiri Kosinastatic void hid_free_report(struct hid_report *report) 536dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina{ 537dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina unsigned n; 538dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 539dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina for (n = 0; n < report->maxfield; n++) 540dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina kfree(report->field[n]); 541dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina kfree(report); 542dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina} 543dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 544dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina/* 545dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina * Free a device structure, all reports, and all fields. 546dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina */ 547dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 54885cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slabystatic void hid_device_release(struct device *dev) 549dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina{ 55085cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby struct hid_device *device = container_of(dev, struct hid_device, dev); 55185cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby unsigned i, j; 552dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 553dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina for (i = 0; i < HID_REPORT_TYPES; i++) { 554dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina struct hid_report_enum *report_enum = device->report_enum + i; 555dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 556dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina for (j = 0; j < 256; j++) { 557dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina struct hid_report *report = report_enum->report_id_hash[j]; 558dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina if (report) 559dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina hid_free_report(report); 560dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina } 561dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina } 562dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 563dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina kfree(device->rdesc); 564767fe7877c2928b5633992ee60a49ad4516dc2afJiri Kosina kfree(device->collection); 565dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina kfree(device); 566dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina} 567dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 568dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina/* 569dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina * Fetch a report description item from the data stream. We support long 570dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina * items, though they are not used yet. 571dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina */ 572dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 573dde5845a529ff753364a6d1aea61180946270bfaJiri Kosinastatic u8 *fetch_item(__u8 *start, __u8 *end, struct hid_item *item) 574dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina{ 575dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina u8 b; 576dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 577dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina if ((end - start) <= 0) 578dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina return NULL; 579dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 580dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina b = *start++; 581dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 582dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina item->type = (b >> 2) & 3; 583dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina item->tag = (b >> 4) & 15; 584dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 585dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina if (item->tag == HID_ITEM_TAG_LONG) { 586dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 587dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina item->format = HID_ITEM_FORMAT_LONG; 588dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 589dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina if ((end - start) < 2) 590dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina return NULL; 591dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 592dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina item->size = *start++; 593dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina item->tag = *start++; 594dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 595dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina if ((end - start) < item->size) 596dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina return NULL; 597dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 598dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina item->data.longdata = start; 599dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina start += item->size; 600dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina return start; 601dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina } 602dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 603dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina item->format = HID_ITEM_FORMAT_SHORT; 604dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina item->size = b & 3; 605dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 606dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina switch (item->size) { 607880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby case 0: 608880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby return start; 609dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 610880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby case 1: 611880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby if ((end - start) < 1) 612880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby return NULL; 613880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby item->data.u8 = *start++; 614880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby return start; 615880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby 616880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby case 2: 617880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby if ((end - start) < 2) 618880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby return NULL; 619880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby item->data.u16 = get_unaligned_le16(start); 620880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby start = (__u8 *)((__le16 *)start + 1); 621880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby return start; 622880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby 623880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby case 3: 624880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby item->size++; 625880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby if ((end - start) < 4) 626880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby return NULL; 627880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby item->data.u32 = get_unaligned_le32(start); 628880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby start = (__u8 *)((__le32 *)start + 1); 629880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby return start; 630dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina } 631dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 632dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina return NULL; 633dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina} 634dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 63585cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby/** 63685cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby * hid_parse_report - parse device report 63785cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby * 63885cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby * @device: hid device 63985cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby * @start: report start 64085cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby * @size: report size 64185cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby * 642dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina * Parse a report description into a hid_device structure. Reports are 643dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina * enumerated, fields are attached to these reports. 64485cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby * 0 returned on success, otherwise nonzero error value. 645dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina */ 64685cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slabyint hid_parse_report(struct hid_device *device, __u8 *start, 64785cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby unsigned size) 648dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina{ 649dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina struct hid_parser *parser; 650dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina struct hid_item item; 651dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina __u8 *end; 65285cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby int ret; 653dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina static int (*dispatch_type[])(struct hid_parser *parser, 654dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina struct hid_item *item) = { 655dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina hid_parser_main, 656dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina hid_parser_global, 657dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina hid_parser_local, 658dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina hid_parser_reserved 659dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina }; 660dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 661c500c9714011edab021591340042787722db9cf0Jiri Slaby if (device->driver->report_fixup) 66273e4008ddddc84d5f2499c17012b340a0dae153eNikolai Kondrashov start = device->driver->report_fixup(device, start, &size); 663c500c9714011edab021591340042787722db9cf0Jiri Slaby 6641721a238ba5df9e870ed952464d38714261f5be9Julia Lawall device->rdesc = kmemdup(start, size, GFP_KERNEL); 66585cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby if (device->rdesc == NULL) 66685cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby return -ENOMEM; 667dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina device->rsize = size; 668dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 669fe2580204d8bbcd18540736a283ed0b784c6a024Joe Perches parser = vzalloc(sizeof(struct hid_parser)); 67085cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby if (!parser) { 67185cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby ret = -ENOMEM; 67285cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby goto err; 673dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina } 67485cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby 675dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina parser->device = device; 676dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 677dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina end = start + size; 67885cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby ret = -EINVAL; 679dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina while ((start = fetch_item(start, end, &item)) != NULL) { 680dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 681dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina if (item.format != HID_ITEM_FORMAT_SHORT) { 6828c3d52fc393b5be8b14dad67053ed83195f0d002Jiri Kosina hid_err(device, "unexpected long global item\n"); 68385cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby goto err; 684dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina } 685dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 686dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina if (dispatch_type[item.type](parser, &item)) { 6878c3d52fc393b5be8b14dad67053ed83195f0d002Jiri Kosina hid_err(device, "item %u %u %u %u parsing failed\n", 6884291ee305e9bb0699504a66f0e2b7aefcf0512a5Joe Perches item.format, (unsigned)item.size, 6894291ee305e9bb0699504a66f0e2b7aefcf0512a5Joe Perches (unsigned)item.type, (unsigned)item.tag); 69085cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby goto err; 691dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina } 692dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 693dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina if (start == end) { 694dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina if (parser->collection_stack_ptr) { 6958c3d52fc393b5be8b14dad67053ed83195f0d002Jiri Kosina hid_err(device, "unbalanced collection at end of report description\n"); 69685cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby goto err; 697dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina } 698dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina if (parser->local.delimiter_depth) { 6998c3d52fc393b5be8b14dad67053ed83195f0d002Jiri Kosina hid_err(device, "unbalanced delimiter at end of report description\n"); 70085cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby goto err; 701dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina } 70247a80edb1d80ae644ea374a016c8e68d43d2671fJiri Kosina vfree(parser); 70385cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby return 0; 704dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina } 705dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina } 706dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 7078c3d52fc393b5be8b14dad67053ed83195f0d002Jiri Kosina hid_err(device, "item fetching failed at offset %d\n", (int)(end - start)); 70885cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slabyerr: 70947a80edb1d80ae644ea374a016c8e68d43d2671fJiri Kosina vfree(parser); 71085cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby return ret; 711dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina} 712229695e51efc4ed5e04ab471c82591d0f432909dJiri KosinaEXPORT_SYMBOL_GPL(hid_parse_report); 713dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 714dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina/* 715dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina * Convert a signed n-bit integer to signed 32-bit integer. Common 716dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina * cases are done through the compiler, the screwed things has to be 717dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina * done by hand. 718dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina */ 719dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 720dde5845a529ff753364a6d1aea61180946270bfaJiri Kosinastatic s32 snto32(__u32 value, unsigned n) 721dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina{ 722dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina switch (n) { 723880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby case 8: return ((__s8)value); 724880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby case 16: return ((__s16)value); 725880d29f109428be1d027adf919a7457d8fe41fd3Jiri Slaby case 32: return ((__s32)value); 726dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina } 727dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina return value & (1 << (n - 1)) ? value | (-1 << n) : value; 728dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina} 729dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 730dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina/* 731dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina * Convert a signed 32-bit integer to a signed n-bit integer. 732dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina */ 733dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 734dde5845a529ff753364a6d1aea61180946270bfaJiri Kosinastatic u32 s32ton(__s32 value, unsigned n) 735dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina{ 736dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina s32 a = value >> (n - 1); 737dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina if (a && a != -1) 738dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina return value < 0 ? 1 << (n - 1) : (1 << (n - 1)) - 1; 739dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina return value & ((1 << n) - 1); 740dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina} 741dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 742dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina/* 743dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina * Extract/implement a data field from/to a little endian report (bit array). 744dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina * 745dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina * Code sort-of follows HID spec: 746dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina * http://www.usb.org/developers/devclass_docs/HID1_11.pdf 747dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina * 748dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina * While the USB HID spec allows unlimited length bit fields in "report 749dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina * descriptors", most devices never use more than 16 bits. 750dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina * One model of UPS is claimed to report "LINEV" as a 32-bit field. 751dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina * Search linux-kernel and linux-usb-devel archives for "hid-core extract". 752dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina */ 753dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 75416ee4cc82b5dbb81a5dbfedcdb268b9467fe4605Joe Perchesstatic __u32 extract(const struct hid_device *hid, __u8 *report, 75516ee4cc82b5dbb81a5dbfedcdb268b9467fe4605Joe Perches unsigned offset, unsigned n) 756dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina{ 757dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina u64 x; 758dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 759c4124c9b68bf8ecf1e8afedad3a22e18666cb6f3Jiri Kosina if (n > 32) 7604291ee305e9bb0699504a66f0e2b7aefcf0512a5Joe Perches hid_warn(hid, "extract() called with n (%d) > 32! (%s)\n", 7614291ee305e9bb0699504a66f0e2b7aefcf0512a5Joe Perches n, current->comm); 762dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 763dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina report += offset >> 3; /* adjust byte index */ 764229695e51efc4ed5e04ab471c82591d0f432909dJiri Kosina offset &= 7; /* now only need bit offset into one byte */ 765c105068f2b35343eecf2bf16ee29a362b6121fa3Harvey Harrison x = get_unaligned_le64(report); 766229695e51efc4ed5e04ab471c82591d0f432909dJiri Kosina x = (x >> offset) & ((1ULL << n) - 1); /* extract bit field */ 767dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina return (u32) x; 768dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina} 769dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 770dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina/* 771dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina * "implement" : set bits in a little endian bit stream. 772dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina * Same concepts as "extract" (see comments above). 773dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina * The data mangled in the bit stream remains in little endian 774dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina * order the whole time. It make more sense to talk about 775dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina * endianness of register values by considering a register 776dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina * a "cached" copy of the little endiad bit stream. 777dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina */ 77816ee4cc82b5dbb81a5dbfedcdb268b9467fe4605Joe Perchesstatic void implement(const struct hid_device *hid, __u8 *report, 77916ee4cc82b5dbb81a5dbfedcdb268b9467fe4605Joe Perches unsigned offset, unsigned n, __u32 value) 780dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina{ 7816f0168d2dacd7972d887e1ca27943ef8af7512a5Harvey Harrison u64 x; 782dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina u64 m = (1ULL << n) - 1; 783dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 784c4124c9b68bf8ecf1e8afedad3a22e18666cb6f3Jiri Kosina if (n > 32) 7854291ee305e9bb0699504a66f0e2b7aefcf0512a5Joe Perches hid_warn(hid, "%s() called with n (%d) > 32! (%s)\n", 7864291ee305e9bb0699504a66f0e2b7aefcf0512a5Joe Perches __func__, n, current->comm); 787dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 788c4124c9b68bf8ecf1e8afedad3a22e18666cb6f3Jiri Kosina if (value > m) 7894291ee305e9bb0699504a66f0e2b7aefcf0512a5Joe Perches hid_warn(hid, "%s() called with too large value %d! (%s)\n", 7904291ee305e9bb0699504a66f0e2b7aefcf0512a5Joe Perches __func__, value, current->comm); 791dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina WARN_ON(value > m); 792dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina value &= m; 793dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 794dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina report += offset >> 3; 795dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina offset &= 7; 796dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 7976f0168d2dacd7972d887e1ca27943ef8af7512a5Harvey Harrison x = get_unaligned_le64(report); 7986f0168d2dacd7972d887e1ca27943ef8af7512a5Harvey Harrison x &= ~(m << offset); 7996f0168d2dacd7972d887e1ca27943ef8af7512a5Harvey Harrison x |= ((u64)value) << offset; 8006f0168d2dacd7972d887e1ca27943ef8af7512a5Harvey Harrison put_unaligned_le64(x, report); 801dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina} 802dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 803dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina/* 804dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina * Search an array for a value. 805dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina */ 806dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 80716ee4cc82b5dbb81a5dbfedcdb268b9467fe4605Joe Perchesstatic int search(__s32 *array, __s32 value, unsigned n) 808dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina{ 809dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina while (n--) { 810dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina if (*array++ == value) 811dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina return 0; 812dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina } 813dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina return -1; 814dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina} 815dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 81685cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby/** 81785cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby * hid_match_report - check if driver's raw_event should be called 81885cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby * 81985cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby * @hid: hid device 82085cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby * @report_type: type to match against 82185cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby * 82285cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby * compare hid->driver->report_table->report_type to report->type 82385cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby */ 82485cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slabystatic int hid_match_report(struct hid_device *hid, struct hid_report *report) 825dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina{ 82685cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby const struct hid_report_id *id = hid->driver->report_table; 82785cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby 82885cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby if (!id) /* NULL means all */ 82985cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby return 1; 83085cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby 83185cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby for (; id->report_type != HID_TERMINATOR; id++) 83285cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby if (id->report_type == HID_ANY_ID || 83385cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby id->report_type == report->type) 83485cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby return 1; 83585cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby return 0; 83685cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby} 83785cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby 83885cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby/** 83985cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby * hid_match_usage - check if driver's event should be called 84085cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby * 84185cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby * @hid: hid device 84285cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby * @usage: usage to match against 84385cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby * 84485cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby * compare hid->driver->usage_table->usage_{type,code} to 84585cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby * usage->usage_{type,code} 84685cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby */ 84785cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slabystatic int hid_match_usage(struct hid_device *hid, struct hid_usage *usage) 84885cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby{ 84985cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby const struct hid_usage_id *id = hid->driver->usage_table; 85085cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby 85185cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby if (!id) /* NULL means all */ 85285cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby return 1; 85385cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby 85485cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby for (; id->usage_type != HID_ANY_ID - 1; id++) 85585cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby if ((id->usage_hid == HID_ANY_ID || 85685cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby id->usage_hid == usage->hid) && 85785cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby (id->usage_type == HID_ANY_ID || 85885cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby id->usage_type == usage->type) && 85985cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby (id->usage_code == HID_ANY_ID || 86085cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby id->usage_code == usage->code)) 86185cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby return 1; 86285cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby return 0; 86385cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby} 86485cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby 86585cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slabystatic void hid_process_event(struct hid_device *hid, struct hid_field *field, 86685cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby struct hid_usage *usage, __s32 value, int interrupt) 86785cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby{ 86885cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby struct hid_driver *hdrv = hid->driver; 86985cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby int ret; 87085cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby 871cd667ce24796700e1a0e6e7528efc61c96ff832eJiri Kosina hid_dump_input(hid, usage, value); 87285cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby 87385cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby if (hdrv && hdrv->event && hid_match_usage(hid, usage)) { 87485cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby ret = hdrv->event(hid, field, usage, value); 87585cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby if (ret != 0) { 87685cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby if (ret < 0) 8778c3d52fc393b5be8b14dad67053ed83195f0d002Jiri Kosina hid_err(hid, "%s's event failed with %d\n", 87885cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby hdrv->name, ret); 87985cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby return; 88085cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby } 88185cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby } 88285cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby 883dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina if (hid->claimed & HID_CLAIMED_INPUT) 884dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina hidinput_hid_event(hid, field, usage, value); 885aa938f7974b82cfd9ee955031987344f332b7c77Jiri Kosina if (hid->claimed & HID_CLAIMED_HIDDEV && interrupt && hid->hiddev_hid_event) 886aa938f7974b82cfd9ee955031987344f332b7c77Jiri Kosina hid->hiddev_hid_event(hid, field, usage, value); 887dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina} 888dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 889dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina/* 890dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina * Analyse a received field, and fetch the data from it. The field 891dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina * content is stored for next report processing (we do differential 892dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina * reporting to the layer). 893dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina */ 894dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 895abdff0f7749a6696ba2a4238b675cbc55abcdb7aAdrian Bunkstatic void hid_input_field(struct hid_device *hid, struct hid_field *field, 896abdff0f7749a6696ba2a4238b675cbc55abcdb7aAdrian Bunk __u8 *data, int interrupt) 897dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina{ 898dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina unsigned n; 899dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina unsigned count = field->report_count; 900dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina unsigned offset = field->report_offset; 901dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina unsigned size = field->report_size; 902dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina __s32 min = field->logical_minimum; 903dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina __s32 max = field->logical_maximum; 904dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina __s32 *value; 905dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 906a3789a1783d37f2772ba5046b26416c98dfe1bfaJoe Perches value = kmalloc(sizeof(__s32) * count, GFP_ATOMIC); 907a3789a1783d37f2772ba5046b26416c98dfe1bfaJoe Perches if (!value) 908dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina return; 909dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 910dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina for (n = 0; n < count; n++) { 911dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 9124291ee305e9bb0699504a66f0e2b7aefcf0512a5Joe Perches value[n] = min < 0 ? 9134291ee305e9bb0699504a66f0e2b7aefcf0512a5Joe Perches snto32(extract(hid, data, offset + n * size, size), 9144291ee305e9bb0699504a66f0e2b7aefcf0512a5Joe Perches size) : 9154291ee305e9bb0699504a66f0e2b7aefcf0512a5Joe Perches extract(hid, data, offset + n * size, size); 916dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 9174291ee305e9bb0699504a66f0e2b7aefcf0512a5Joe Perches /* Ignore report if ErrorRollOver */ 9184291ee305e9bb0699504a66f0e2b7aefcf0512a5Joe Perches if (!(field->flags & HID_MAIN_ITEM_VARIABLE) && 9194291ee305e9bb0699504a66f0e2b7aefcf0512a5Joe Perches value[n] >= min && value[n] <= max && 9204291ee305e9bb0699504a66f0e2b7aefcf0512a5Joe Perches field->usage[value[n] - min].hid == HID_UP_KEYBOARD + 1) 9214291ee305e9bb0699504a66f0e2b7aefcf0512a5Joe Perches goto exit; 922dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina } 923dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 924dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina for (n = 0; n < count; n++) { 925dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 926dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina if (HID_MAIN_ITEM_VARIABLE & field->flags) { 927dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina hid_process_event(hid, field, &field->usage[n], value[n], interrupt); 928dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina continue; 929dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina } 930dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 931dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina if (field->value[n] >= min && field->value[n] <= max 932dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina && field->usage[field->value[n] - min].hid 933dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina && search(value, field->value[n], count)) 934dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina hid_process_event(hid, field, &field->usage[field->value[n] - min], 0, interrupt); 935dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 936dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina if (value[n] >= min && value[n] <= max 937dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina && field->usage[value[n] - min].hid 938dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina && search(field->value, value[n], count)) 939dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina hid_process_event(hid, field, &field->usage[value[n] - min], 1, interrupt); 940dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina } 941dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 942dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina memcpy(field->value, value, count * sizeof(__s32)); 943dde5845a529ff753364a6d1aea61180946270bfaJiri Kosinaexit: 944dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina kfree(value); 945dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina} 946dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 947dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina/* 948dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina * Output the field into the report. 949dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina */ 950dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 9514291ee305e9bb0699504a66f0e2b7aefcf0512a5Joe Perchesstatic void hid_output_field(const struct hid_device *hid, 9524291ee305e9bb0699504a66f0e2b7aefcf0512a5Joe Perches struct hid_field *field, __u8 *data) 953dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina{ 954dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina unsigned count = field->report_count; 955dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina unsigned offset = field->report_offset; 956dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina unsigned size = field->report_size; 957dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina unsigned n; 958dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 959dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina for (n = 0; n < count; n++) { 960dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina if (field->logical_minimum < 0) /* signed values */ 9614291ee305e9bb0699504a66f0e2b7aefcf0512a5Joe Perches implement(hid, data, offset + n * size, size, 9624291ee305e9bb0699504a66f0e2b7aefcf0512a5Joe Perches s32ton(field->value[n], size)); 963dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina else /* unsigned values */ 9644291ee305e9bb0699504a66f0e2b7aefcf0512a5Joe Perches implement(hid, data, offset + n * size, size, 9654291ee305e9bb0699504a66f0e2b7aefcf0512a5Joe Perches field->value[n]); 966dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina } 967dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina} 968dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 969dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina/* 970dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina * Create a report. 971dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina */ 972dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 973229695e51efc4ed5e04ab471c82591d0f432909dJiri Kosinavoid hid_output_report(struct hid_report *report, __u8 *data) 974dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina{ 975dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina unsigned n; 976dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 977dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina if (report->id > 0) 978dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina *data++ = report->id; 979dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 98075c28df87eb6d8e1389af67f26fbe2394e28385ePete Zaitcev memset(data, 0, ((report->size - 1) >> 3) + 1); 981dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina for (n = 0; n < report->maxfield; n++) 9824291ee305e9bb0699504a66f0e2b7aefcf0512a5Joe Perches hid_output_field(report->device, report->field[n], data); 983dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina} 984229695e51efc4ed5e04ab471c82591d0f432909dJiri KosinaEXPORT_SYMBOL_GPL(hid_output_report); 985dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 986dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina/* 987dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina * Set a field value. The report this field belongs to has to be 988dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina * created and transferred to the device, to set this value in the 989dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina * device. 990dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina */ 991dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 992dde5845a529ff753364a6d1aea61180946270bfaJiri Kosinaint hid_set_field(struct hid_field *field, unsigned offset, __s32 value) 993dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina{ 994dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina unsigned size = field->report_size; 995dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 996cd667ce24796700e1a0e6e7528efc61c96ff832eJiri Kosina hid_dump_input(field->report->device, field->usage + offset, value); 997dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 998dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina if (offset >= field->report_count) { 9998c3d52fc393b5be8b14dad67053ed83195f0d002Jiri Kosina hid_err(field->report->device, "offset (%d) exceeds report_count (%d)\n", 10008c3d52fc393b5be8b14dad67053ed83195f0d002Jiri Kosina offset, field->report_count); 1001dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina return -1; 1002dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina } 1003dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina if (field->logical_minimum < 0) { 1004dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina if (value != snto32(s32ton(value, size), size)) { 10058c3d52fc393b5be8b14dad67053ed83195f0d002Jiri Kosina hid_err(field->report->device, "value %d is out of range\n", value); 1006dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina return -1; 1007dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina } 1008dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina } 1009dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina field->value[offset] = value; 1010dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina return 0; 1011dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina} 1012229695e51efc4ed5e04ab471c82591d0f432909dJiri KosinaEXPORT_SYMBOL_GPL(hid_set_field); 1013dde5845a529ff753364a6d1aea61180946270bfaJiri Kosina 101485cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slabystatic struct hid_report *hid_get_report(struct hid_report_enum *report_enum, 101585cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby const u8 *data) 1016aa8de2f038baec993f07ef66fb3e94481d1ec22bJiri Kosina{ 1017aa8de2f038baec993f07ef66fb3e94481d1ec22bJiri Kosina struct hid_report *report; 101885cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby unsigned int n = 0; /* Normally report number is 0 */ 1019aa8de2f038baec993f07ef66fb3e94481d1ec22bJiri Kosina 102085cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby /* Device uses numbered reports, data[0] is report number */ 102185cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby if (report_enum->numbered) 102285cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby n = *data; 1023aa8de2f038baec993f07ef66fb3e94481d1ec22bJiri Kosina 102485cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby report = report_enum->report_id_hash[n]; 102585cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby if (report == NULL) 102685cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby dbg_hid("undefined report_id %u received\n", n); 1027aa8de2f038baec993f07ef66fb3e94481d1ec22bJiri Kosina 102885cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby return report; 102985cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby} 1030aa8de2f038baec993f07ef66fb3e94481d1ec22bJiri Kosina 103185cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slabyvoid hid_report_raw_event(struct hid_device *hid, int type, u8 *data, int size, 103285cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby int interrupt) 103385cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby{ 103485cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby struct hid_report_enum *report_enum = hid->report_enum + type; 103585cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby struct hid_report *report; 103685cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby unsigned int a; 103785cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby int rsize, csize = size; 103885cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby u8 *cdata = data; 1039aa8de2f038baec993f07ef66fb3e94481d1ec22bJiri Kosina 104085cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby report = hid_get_report(report_enum, data); 104185cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby if (!report) 104285cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby return; 1043aa8de2f038baec993f07ef66fb3e94481d1ec22bJiri Kosina 104485cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby if (report_enum->numbered) { 104585cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby cdata++; 104685cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby csize--; 1047aa8de2f038baec993f07ef66fb3e94481d1ec22bJiri Kosina } 1048aa8de2f038baec993f07ef66fb3e94481d1ec22bJiri Kosina 1049aa8de2f038baec993f07ef66fb3e94481d1ec22bJiri Kosina rsize = ((report->size - 1) >> 3) + 1; 1050aa8de2f038baec993f07ef66fb3e94481d1ec22bJiri Kosina 1051966922f26c7fb5eddbe3c506b66bb5659f57b76fArmando Visconti if (rsize > HID_MAX_BUFFER_SIZE) 1052966922f26c7fb5eddbe3c506b66bb5659f57b76fArmando Visconti rsize = HID_MAX_BUFFER_SIZE; 1053966922f26c7fb5eddbe3c506b66bb5659f57b76fArmando Visconti 105485cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby if (csize < rsize) { 105585cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby dbg_hid("report %d is too short, (%d < %d)\n", report->id, 105685cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby csize, rsize); 105785cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby memset(cdata + csize, 0, rsize - csize); 1058aa8de2f038baec993f07ef66fb3e94481d1ec22bJiri Kosina } 1059aa8de2f038baec993f07ef66fb3e94481d1ec22bJiri Kosina 1060aa8de2f038baec993f07ef66fb3e94481d1ec22bJiri Kosina if ((hid->claimed & HID_CLAIMED_HIDDEV) && hid->hiddev_report_event) 1061aa8de2f038baec993f07ef66fb3e94481d1ec22bJiri Kosina hid->hiddev_report_event(hid, report); 10625a38f2c7c4dd53d5be097930902c108e362584a3Alan Ott if (hid->claimed & HID_CLAIMED_HIDRAW) 10635a38f2c7c4dd53d5be097930902c108e362584a3Alan Ott hidraw_report_event(hid, data, size); 1064aa8de2f038baec993f07ef66fb3e94481d1ec22bJiri Kosina 106585cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby for (a = 0; a < report->maxfield; a++) 106685cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby hid_input_field(hid, report->field[a], cdata, interrupt); 1067aa8de2f038baec993f07ef66fb3e94481d1ec22bJiri Kosina 1068aa8de2f038baec993f07ef66fb3e94481d1ec22bJiri Kosina if (hid->claimed & HID_CLAIMED_INPUT) 1069aa8de2f038baec993f07ef66fb3e94481d1ec22bJiri Kosina hidinput_report_event(hid, report); 107085cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby} 107185cdaf524b7ddab627e7d15405693f2511ef7505Jiri SlabyEXPORT_SYMBOL_GPL(hid_report_raw_event); 107285cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby 107385cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby/** 107485cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby * hid_input_report - report data from lower layer (usb, bt...) 107585cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby * 107685cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby * @hid: hid device 107785cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby * @type: HID report type (HID_*_REPORT) 107885cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby * @data: report contents 107985cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby * @size: size of data parameter 1080ff9b00a226ccea66e6ce70e9083c42f5b6001f73Jiri Kosina * @interrupt: distinguish between interrupt and control transfers 108185cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby * 108285cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby * This is data entry for lower layers. 108385cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby */ 108485cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slabyint hid_input_report(struct hid_device *hid, int type, u8 *data, int size, int interrupt) 108585cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby{ 108676c317d6e5cb7f58541879006d39774596962715Julia Lawall struct hid_report_enum *report_enum; 108776c317d6e5cb7f58541879006d39774596962715Julia Lawall struct hid_driver *hdrv; 108885cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby struct hid_report *report; 1089cd667ce24796700e1a0e6e7528efc61c96ff832eJiri Kosina char *buf; 109085cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby unsigned int i; 109145dc1ac73d28b3adb5819818785e758b1f369b74Jiri Kosina int ret = 0; 109285cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby 10934ea5454203d991ec85264f64f89ca8855fce69b0David Herrmann if (!hid) 109485cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby return -ENODEV; 10954ea5454203d991ec85264f64f89ca8855fce69b0David Herrmann 10964ea5454203d991ec85264f64f89ca8855fce69b0David Herrmann if (down_trylock(&hid->driver_lock)) 10974ea5454203d991ec85264f64f89ca8855fce69b0David Herrmann return -EBUSY; 10984ea5454203d991ec85264f64f89ca8855fce69b0David Herrmann 10994ea5454203d991ec85264f64f89ca8855fce69b0David Herrmann if (!hid->driver) { 11004ea5454203d991ec85264f64f89ca8855fce69b0David Herrmann ret = -ENODEV; 11014ea5454203d991ec85264f64f89ca8855fce69b0David Herrmann goto unlock; 11024ea5454203d991ec85264f64f89ca8855fce69b0David Herrmann } 110376c317d6e5cb7f58541879006d39774596962715Julia Lawall report_enum = hid->report_enum + type; 110476c317d6e5cb7f58541879006d39774596962715Julia Lawall hdrv = hid->driver; 110585cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby 110685cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby if (!size) { 110785cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby dbg_hid("empty report\n"); 11084ea5454203d991ec85264f64f89ca8855fce69b0David Herrmann ret = -1; 11094ea5454203d991ec85264f64f89ca8855fce69b0David Herrmann goto unlock; 111085cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby } 111185cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby 1112d1ff65226c5afe55f9af38a439058f41b71e114fJiri Kosina buf = kmalloc(sizeof(char) * HID_DEBUG_BUFSIZE, GFP_ATOMIC); 1113cd667ce24796700e1a0e6e7528efc61c96ff832eJiri Kosina 1114f77e347bd44e3640bdc56003b7402c63ddb1241dJiri Kosina if (!buf) 1115cd667ce24796700e1a0e6e7528efc61c96ff832eJiri Kosina goto nomem; 111685cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby 111785cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby /* dump the report */ 1118cd667ce24796700e1a0e6e7528efc61c96ff832eJiri Kosina snprintf(buf, HID_DEBUG_BUFSIZE - 1, 11191caea61eda5c4d446147aa0e712ba395bb6b81c3Jiri Kosina "\nreport (size %u) (%snumbered) = ", size, report_enum->numbered ? "" : "un"); 1120cd667ce24796700e1a0e6e7528efc61c96ff832eJiri Kosina hid_debug_event(hid, buf); 11211caea61eda5c4d446147aa0e712ba395bb6b81c3Jiri Kosina 1122cd667ce24796700e1a0e6e7528efc61c96ff832eJiri Kosina for (i = 0; i < size; i++) { 1123cd667ce24796700e1a0e6e7528efc61c96ff832eJiri Kosina snprintf(buf, HID_DEBUG_BUFSIZE - 1, 1124cd667ce24796700e1a0e6e7528efc61c96ff832eJiri Kosina " %02x", data[i]); 1125cd667ce24796700e1a0e6e7528efc61c96ff832eJiri Kosina hid_debug_event(hid, buf); 1126cd667ce24796700e1a0e6e7528efc61c96ff832eJiri Kosina } 1127cd667ce24796700e1a0e6e7528efc61c96ff832eJiri Kosina hid_debug_event(hid, "\n"); 1128cd667ce24796700e1a0e6e7528efc61c96ff832eJiri Kosina kfree(buf); 112985cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby 1130cd667ce24796700e1a0e6e7528efc61c96ff832eJiri Kosinanomem: 11311caea61eda5c4d446147aa0e712ba395bb6b81c3Jiri Kosina report = hid_get_report(report_enum, data); 11321caea61eda5c4d446147aa0e712ba395bb6b81c3Jiri Kosina 11334ea5454203d991ec85264f64f89ca8855fce69b0David Herrmann if (!report) { 11344ea5454203d991ec85264f64f89ca8855fce69b0David Herrmann ret = -1; 11354ea5454203d991ec85264f64f89ca8855fce69b0David Herrmann goto unlock; 11364ea5454203d991ec85264f64f89ca8855fce69b0David Herrmann } 113785cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby 113885cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby if (hdrv && hdrv->raw_event && hid_match_report(hid, report)) { 113985cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby ret = hdrv->raw_event(hid, report, data, size); 11404ea5454203d991ec85264f64f89ca8855fce69b0David Herrmann if (ret != 0) { 11414ea5454203d991ec85264f64f89ca8855fce69b0David Herrmann ret = ret < 0 ? ret : 0; 11424ea5454203d991ec85264f64f89ca8855fce69b0David Herrmann goto unlock; 11434ea5454203d991ec85264f64f89ca8855fce69b0David Herrmann } 114485cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby } 114585cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby 114685cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby hid_report_raw_event(hid, type, data, size, interrupt); 1147aa8de2f038baec993f07ef66fb3e94481d1ec22bJiri Kosina 11484ea5454203d991ec85264f64f89ca8855fce69b0David Herrmannunlock: 11494ea5454203d991ec85264f64f89ca8855fce69b0David Herrmann up(&hid->driver_lock); 115045dc1ac73d28b3adb5819818785e758b1f369b74Jiri Kosina return ret; 1151aa8de2f038baec993f07ef66fb3e94481d1ec22bJiri Kosina} 1152aa8de2f038baec993f07ef66fb3e94481d1ec22bJiri KosinaEXPORT_SYMBOL_GPL(hid_input_report); 1153aa8de2f038baec993f07ef66fb3e94481d1ec22bJiri Kosina 11540f37cd0306463ad35f958d8f74a2b00e5b190b4bJiri Kosinastatic bool hid_match_one_id(struct hid_device *hdev, 11550f37cd0306463ad35f958d8f74a2b00e5b190b4bJiri Kosina const struct hid_device_id *id) 11560f37cd0306463ad35f958d8f74a2b00e5b190b4bJiri Kosina{ 11570f37cd0306463ad35f958d8f74a2b00e5b190b4bJiri Kosina return id->bus == hdev->bus && 11580f37cd0306463ad35f958d8f74a2b00e5b190b4bJiri Kosina (id->vendor == HID_ANY_ID || id->vendor == hdev->vendor) && 11590f37cd0306463ad35f958d8f74a2b00e5b190b4bJiri Kosina (id->product == HID_ANY_ID || id->product == hdev->product); 11600f37cd0306463ad35f958d8f74a2b00e5b190b4bJiri Kosina} 11610f37cd0306463ad35f958d8f74a2b00e5b190b4bJiri Kosina 1162bbc21cfd55858d7c3e55bfaa91fa934b0b13ad4dJeremy Fitzhardingeconst struct hid_device_id *hid_match_id(struct hid_device *hdev, 11630f37cd0306463ad35f958d8f74a2b00e5b190b4bJiri Kosina const struct hid_device_id *id) 11640f37cd0306463ad35f958d8f74a2b00e5b190b4bJiri Kosina{ 11650f37cd0306463ad35f958d8f74a2b00e5b190b4bJiri Kosina for (; id->bus; id++) 11660f37cd0306463ad35f958d8f74a2b00e5b190b4bJiri Kosina if (hid_match_one_id(hdev, id)) 11670f37cd0306463ad35f958d8f74a2b00e5b190b4bJiri Kosina return id; 11680f37cd0306463ad35f958d8f74a2b00e5b190b4bJiri Kosina 11690f37cd0306463ad35f958d8f74a2b00e5b190b4bJiri Kosina return NULL; 11700f37cd0306463ad35f958d8f74a2b00e5b190b4bJiri Kosina} 11710f37cd0306463ad35f958d8f74a2b00e5b190b4bJiri Kosina 11720f37cd0306463ad35f958d8f74a2b00e5b190b4bJiri Kosinastatic const struct hid_device_id hid_hiddev_list[] = { 1173c0bd6a429819f794f626f9e73be4564e18e132dbRichard Hughes { HID_USB_DEVICE(USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS) }, 1174c0bd6a429819f794f626f9e73be4564e18e132dbRichard Hughes { HID_USB_DEVICE(USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS1) }, 11750f37cd0306463ad35f958d8f74a2b00e5b190b4bJiri Kosina { } 11760f37cd0306463ad35f958d8f74a2b00e5b190b4bJiri Kosina}; 11770f37cd0306463ad35f958d8f74a2b00e5b190b4bJiri Kosina 11780f37cd0306463ad35f958d8f74a2b00e5b190b4bJiri Kosinastatic bool hid_hiddev(struct hid_device *hdev) 11790f37cd0306463ad35f958d8f74a2b00e5b190b4bJiri Kosina{ 11800f37cd0306463ad35f958d8f74a2b00e5b190b4bJiri Kosina return !!hid_match_id(hdev, hid_hiddev_list); 11810f37cd0306463ad35f958d8f74a2b00e5b190b4bJiri Kosina} 11820f37cd0306463ad35f958d8f74a2b00e5b190b4bJiri Kosina 11836d3bfb74341c2c1454fcf5ec9c4dd707011f78e5Alan Ott 11846d3bfb74341c2c1454fcf5ec9c4dd707011f78e5Alan Ottstatic ssize_t 11856d3bfb74341c2c1454fcf5ec9c4dd707011f78e5Alan Ottread_report_descriptor(struct file *filp, struct kobject *kobj, 11866d3bfb74341c2c1454fcf5ec9c4dd707011f78e5Alan Ott struct bin_attribute *attr, 11876d3bfb74341c2c1454fcf5ec9c4dd707011f78e5Alan Ott char *buf, loff_t off, size_t count) 11886d3bfb74341c2c1454fcf5ec9c4dd707011f78e5Alan Ott{ 11896d3bfb74341c2c1454fcf5ec9c4dd707011f78e5Alan Ott struct device *dev = container_of(kobj, struct device, kobj); 11906d3bfb74341c2c1454fcf5ec9c4dd707011f78e5Alan Ott struct hid_device *hdev = container_of(dev, struct hid_device, dev); 11916d3bfb74341c2c1454fcf5ec9c4dd707011f78e5Alan Ott 11926d3bfb74341c2c1454fcf5ec9c4dd707011f78e5Alan Ott if (off >= hdev->rsize) 11936d3bfb74341c2c1454fcf5ec9c4dd707011f78e5Alan Ott return 0; 11946d3bfb74341c2c1454fcf5ec9c4dd707011f78e5Alan Ott 11956d3bfb74341c2c1454fcf5ec9c4dd707011f78e5Alan Ott if (off + count > hdev->rsize) 11966d3bfb74341c2c1454fcf5ec9c4dd707011f78e5Alan Ott count = hdev->rsize - off; 11976d3bfb74341c2c1454fcf5ec9c4dd707011f78e5Alan Ott 11986d3bfb74341c2c1454fcf5ec9c4dd707011f78e5Alan Ott memcpy(buf, hdev->rdesc + off, count); 11996d3bfb74341c2c1454fcf5ec9c4dd707011f78e5Alan Ott 12006d3bfb74341c2c1454fcf5ec9c4dd707011f78e5Alan Ott return count; 12016d3bfb74341c2c1454fcf5ec9c4dd707011f78e5Alan Ott} 12026d3bfb74341c2c1454fcf5ec9c4dd707011f78e5Alan Ott 12036d3bfb74341c2c1454fcf5ec9c4dd707011f78e5Alan Ottstatic struct bin_attribute dev_bin_attr_report_desc = { 12046d3bfb74341c2c1454fcf5ec9c4dd707011f78e5Alan Ott .attr = { .name = "report_descriptor", .mode = 0444 }, 12056d3bfb74341c2c1454fcf5ec9c4dd707011f78e5Alan Ott .read = read_report_descriptor, 12066d3bfb74341c2c1454fcf5ec9c4dd707011f78e5Alan Ott .size = HID_MAX_DESCRIPTOR_SIZE, 12076d3bfb74341c2c1454fcf5ec9c4dd707011f78e5Alan Ott}; 12086d3bfb74341c2c1454fcf5ec9c4dd707011f78e5Alan Ott 120993c10132a7ac160df3175b53f7ee857625412165Jiri Slabyint hid_connect(struct hid_device *hdev, unsigned int connect_mask) 121093c10132a7ac160df3175b53f7ee857625412165Jiri Slaby{ 121193c10132a7ac160df3175b53f7ee857625412165Jiri Slaby static const char *types[] = { "Device", "Pointer", "Mouse", "Device", 121293c10132a7ac160df3175b53f7ee857625412165Jiri Slaby "Joystick", "Gamepad", "Keyboard", "Keypad", 121393c10132a7ac160df3175b53f7ee857625412165Jiri Slaby "Multi-Axis Controller" 121493c10132a7ac160df3175b53f7ee857625412165Jiri Slaby }; 121593c10132a7ac160df3175b53f7ee857625412165Jiri Slaby const char *type, *bus; 121693c10132a7ac160df3175b53f7ee857625412165Jiri Slaby char buf[64]; 121793c10132a7ac160df3175b53f7ee857625412165Jiri Slaby unsigned int i; 121893c10132a7ac160df3175b53f7ee857625412165Jiri Slaby int len; 12196d3bfb74341c2c1454fcf5ec9c4dd707011f78e5Alan Ott int ret; 122093c10132a7ac160df3175b53f7ee857625412165Jiri Slaby 1221b5e5a37e36cd4d355b875665312d7aaae4e5833cBastien Nocera if (hdev->quirks & HID_QUIRK_HIDDEV_FORCE) 1222b5e5a37e36cd4d355b875665312d7aaae4e5833cBastien Nocera connect_mask |= (HID_CONNECT_HIDDEV_FORCE | HID_CONNECT_HIDDEV); 12233a343ee4509c982552b35fbc99d3213f3bb1acdeDaniel Mack if (hdev->quirks & HID_QUIRK_HIDINPUT_FORCE) 12243a343ee4509c982552b35fbc99d3213f3bb1acdeDaniel Mack connect_mask |= HID_CONNECT_HIDINPUT_FORCE; 122593c10132a7ac160df3175b53f7ee857625412165Jiri Slaby if (hdev->bus != BUS_USB) 122693c10132a7ac160df3175b53f7ee857625412165Jiri Slaby connect_mask &= ~HID_CONNECT_HIDDEV; 12270f37cd0306463ad35f958d8f74a2b00e5b190b4bJiri Kosina if (hid_hiddev(hdev)) 12280f37cd0306463ad35f958d8f74a2b00e5b190b4bJiri Kosina connect_mask |= HID_CONNECT_HIDDEV_FORCE; 122993c10132a7ac160df3175b53f7ee857625412165Jiri Slaby 123093c10132a7ac160df3175b53f7ee857625412165Jiri Slaby if ((connect_mask & HID_CONNECT_HIDINPUT) && !hidinput_connect(hdev, 123193c10132a7ac160df3175b53f7ee857625412165Jiri Slaby connect_mask & HID_CONNECT_HIDINPUT_FORCE)) 123293c10132a7ac160df3175b53f7ee857625412165Jiri Slaby hdev->claimed |= HID_CLAIMED_INPUT; 1233b77c3920e90e96103e4f41442999402925fe5f73Benjamin Tissoires if (hdev->quirks & HID_QUIRK_MULTITOUCH) { 1234b77c3920e90e96103e4f41442999402925fe5f73Benjamin Tissoires /* this device should be handled by hid-multitouch, skip it */ 1235b77c3920e90e96103e4f41442999402925fe5f73Benjamin Tissoires hdev->quirks &= ~HID_QUIRK_MULTITOUCH; 1236b77c3920e90e96103e4f41442999402925fe5f73Benjamin Tissoires return -ENODEV; 1237b77c3920e90e96103e4f41442999402925fe5f73Benjamin Tissoires } 1238b77c3920e90e96103e4f41442999402925fe5f73Benjamin Tissoires 123993c10132a7ac160df3175b53f7ee857625412165Jiri Slaby if ((connect_mask & HID_CONNECT_HIDDEV) && hdev->hiddev_connect && 124093c10132a7ac160df3175b53f7ee857625412165Jiri Slaby !hdev->hiddev_connect(hdev, 124193c10132a7ac160df3175b53f7ee857625412165Jiri Slaby connect_mask & HID_CONNECT_HIDDEV_FORCE)) 124293c10132a7ac160df3175b53f7ee857625412165Jiri Slaby hdev->claimed |= HID_CLAIMED_HIDDEV; 124393c10132a7ac160df3175b53f7ee857625412165Jiri Slaby if ((connect_mask & HID_CONNECT_HIDRAW) && !hidraw_connect(hdev)) 124493c10132a7ac160df3175b53f7ee857625412165Jiri Slaby hdev->claimed |= HID_CLAIMED_HIDRAW; 124593c10132a7ac160df3175b53f7ee857625412165Jiri Slaby 124693c10132a7ac160df3175b53f7ee857625412165Jiri Slaby if (!hdev->claimed) { 12474291ee305e9bb0699504a66f0e2b7aefcf0512a5Joe Perches hid_err(hdev, "claimed by neither input, hiddev nor hidraw\n"); 124893c10132a7ac160df3175b53f7ee857625412165Jiri Slaby return -ENODEV; 124993c10132a7ac160df3175b53f7ee857625412165Jiri Slaby } 125093c10132a7ac160df3175b53f7ee857625412165Jiri Slaby 125193c10132a7ac160df3175b53f7ee857625412165Jiri Slaby if ((hdev->claimed & HID_CLAIMED_INPUT) && 125293c10132a7ac160df3175b53f7ee857625412165Jiri Slaby (connect_mask & HID_CONNECT_FF) && hdev->ff_init) 125393c10132a7ac160df3175b53f7ee857625412165Jiri Slaby hdev->ff_init(hdev); 125493c10132a7ac160df3175b53f7ee857625412165Jiri Slaby 125593c10132a7ac160df3175b53f7ee857625412165Jiri Slaby len = 0; 125693c10132a7ac160df3175b53f7ee857625412165Jiri Slaby if (hdev->claimed & HID_CLAIMED_INPUT) 125793c10132a7ac160df3175b53f7ee857625412165Jiri Slaby len += sprintf(buf + len, "input"); 125893c10132a7ac160df3175b53f7ee857625412165Jiri Slaby if (hdev->claimed & HID_CLAIMED_HIDDEV) 125993c10132a7ac160df3175b53f7ee857625412165Jiri Slaby len += sprintf(buf + len, "%shiddev%d", len ? "," : "", 126093c10132a7ac160df3175b53f7ee857625412165Jiri Slaby hdev->minor); 126193c10132a7ac160df3175b53f7ee857625412165Jiri Slaby if (hdev->claimed & HID_CLAIMED_HIDRAW) 126293c10132a7ac160df3175b53f7ee857625412165Jiri Slaby len += sprintf(buf + len, "%shidraw%d", len ? "," : "", 126393c10132a7ac160df3175b53f7ee857625412165Jiri Slaby ((struct hidraw *)hdev->hidraw)->minor); 126493c10132a7ac160df3175b53f7ee857625412165Jiri Slaby 126593c10132a7ac160df3175b53f7ee857625412165Jiri Slaby type = "Device"; 126693c10132a7ac160df3175b53f7ee857625412165Jiri Slaby for (i = 0; i < hdev->maxcollection; i++) { 126793c10132a7ac160df3175b53f7ee857625412165Jiri Slaby struct hid_collection *col = &hdev->collection[i]; 126893c10132a7ac160df3175b53f7ee857625412165Jiri Slaby if (col->type == HID_COLLECTION_APPLICATION && 126993c10132a7ac160df3175b53f7ee857625412165Jiri Slaby (col->usage & HID_USAGE_PAGE) == HID_UP_GENDESK && 127093c10132a7ac160df3175b53f7ee857625412165Jiri Slaby (col->usage & 0xffff) < ARRAY_SIZE(types)) { 127193c10132a7ac160df3175b53f7ee857625412165Jiri Slaby type = types[col->usage & 0xffff]; 127293c10132a7ac160df3175b53f7ee857625412165Jiri Slaby break; 127393c10132a7ac160df3175b53f7ee857625412165Jiri Slaby } 127493c10132a7ac160df3175b53f7ee857625412165Jiri Slaby } 127593c10132a7ac160df3175b53f7ee857625412165Jiri Slaby 127693c10132a7ac160df3175b53f7ee857625412165Jiri Slaby switch (hdev->bus) { 127793c10132a7ac160df3175b53f7ee857625412165Jiri Slaby case BUS_USB: 127893c10132a7ac160df3175b53f7ee857625412165Jiri Slaby bus = "USB"; 127993c10132a7ac160df3175b53f7ee857625412165Jiri Slaby break; 128093c10132a7ac160df3175b53f7ee857625412165Jiri Slaby case BUS_BLUETOOTH: 128193c10132a7ac160df3175b53f7ee857625412165Jiri Slaby bus = "BLUETOOTH"; 128293c10132a7ac160df3175b53f7ee857625412165Jiri Slaby break; 128393c10132a7ac160df3175b53f7ee857625412165Jiri Slaby default: 128493c10132a7ac160df3175b53f7ee857625412165Jiri Slaby bus = "<UNKNOWN>"; 128593c10132a7ac160df3175b53f7ee857625412165Jiri Slaby } 128693c10132a7ac160df3175b53f7ee857625412165Jiri Slaby 12876d3bfb74341c2c1454fcf5ec9c4dd707011f78e5Alan Ott ret = device_create_bin_file(&hdev->dev, &dev_bin_attr_report_desc); 12886d3bfb74341c2c1454fcf5ec9c4dd707011f78e5Alan Ott if (ret) 12896d3bfb74341c2c1454fcf5ec9c4dd707011f78e5Alan Ott hid_warn(hdev, 12906d3bfb74341c2c1454fcf5ec9c4dd707011f78e5Alan Ott "can't create sysfs report descriptor attribute err: %d\n", ret); 12916d3bfb74341c2c1454fcf5ec9c4dd707011f78e5Alan Ott 12924291ee305e9bb0699504a66f0e2b7aefcf0512a5Joe Perches hid_info(hdev, "%s: %s HID v%x.%02x %s [%s] on %s\n", 12934291ee305e9bb0699504a66f0e2b7aefcf0512a5Joe Perches buf, bus, hdev->version >> 8, hdev->version & 0xff, 12944291ee305e9bb0699504a66f0e2b7aefcf0512a5Joe Perches type, hdev->name, hdev->phys); 129593c10132a7ac160df3175b53f7ee857625412165Jiri Slaby 129693c10132a7ac160df3175b53f7ee857625412165Jiri Slaby return 0; 129793c10132a7ac160df3175b53f7ee857625412165Jiri Slaby} 129893c10132a7ac160df3175b53f7ee857625412165Jiri SlabyEXPORT_SYMBOL_GPL(hid_connect); 129993c10132a7ac160df3175b53f7ee857625412165Jiri Slaby 1300c4c259bcc27c4242b012106afdba183622b1735fJiri Kosinavoid hid_disconnect(struct hid_device *hdev) 1301c4c259bcc27c4242b012106afdba183622b1735fJiri Kosina{ 13026d3bfb74341c2c1454fcf5ec9c4dd707011f78e5Alan Ott device_remove_bin_file(&hdev->dev, &dev_bin_attr_report_desc); 1303c4c259bcc27c4242b012106afdba183622b1735fJiri Kosina if (hdev->claimed & HID_CLAIMED_INPUT) 1304c4c259bcc27c4242b012106afdba183622b1735fJiri Kosina hidinput_disconnect(hdev); 1305c4c259bcc27c4242b012106afdba183622b1735fJiri Kosina if (hdev->claimed & HID_CLAIMED_HIDDEV) 1306c4c259bcc27c4242b012106afdba183622b1735fJiri Kosina hdev->hiddev_disconnect(hdev); 1307c4c259bcc27c4242b012106afdba183622b1735fJiri Kosina if (hdev->claimed & HID_CLAIMED_HIDRAW) 1308c4c259bcc27c4242b012106afdba183622b1735fJiri Kosina hidraw_disconnect(hdev); 1309c4c259bcc27c4242b012106afdba183622b1735fJiri Kosina} 1310c4c259bcc27c4242b012106afdba183622b1735fJiri KosinaEXPORT_SYMBOL_GPL(hid_disconnect); 1311c4c259bcc27c4242b012106afdba183622b1735fJiri Kosina 1312bae7eb33b25387fdc7ccae08768bef1f9484a5b0Jiri Kosina/* a list of devices for which there is a specialized driver on HID bus */ 1313ce06b9d6d33fd2ed799b6e825d68fe95077da354Dmitry Torokhovstatic const struct hid_device_id hid_have_special_driver[] = { 1314b6353f4f36f03a12edaf3fa5365b475a28106035Stephane Chatty { HID_USB_DEVICE(USB_VENDOR_ID_3M, USB_DEVICE_ID_3M1968) }, 13156dec143a50c01ca0cc0afcbf5ea4bb8e87981edfStephane Chatty { HID_USB_DEVICE(USB_VENDOR_ID_3M, USB_DEVICE_ID_3M2256) }, 131614a21cd459f97e3b3cc4fcde48fc5bcdb81d097eJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_WCP32PU) }, 131714a21cd459f97e3b3cc4fcde48fc5bcdb81d097eJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_X5_005D) }, 1318b7e1b2039de3a028fba46fbaca58a45c23a417ecLech Perczak { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_RP_649) }, 1319c0dbcc33c652a0646542560de29a1c3f1ab7169fSergei Kolzun { HID_USB_DEVICE(USB_VENDOR_ID_ACRUX, 0x0802) }, 1320e6aac3427ef03f61e7478514d0648b58359d05d1Benjamin Tissoires { HID_USB_DEVICE(USB_VENDOR_ID_ACTIONSTAR, USB_DEVICE_ID_ACTIONSTAR_1011) }, 1321df9bcace7b1c29e9be1c13b034ff04f4f4c90edeJiri Kosina { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ATV_IRCONTROL) }, 13228c19a51591d06f5226499972567f528cf6066bb7Jiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL4) }, 13238c19a51591d06f5226499972567f528cf6066bb7Jiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MIGHTYMOUSE) }, 1324128537cea464d919febeaea2000e256749f317ebMichael Poole { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGICMOUSE) }, 1325a462230e16acc8664145216da3c928d03556691aChase Douglas { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGICTRACKPAD) }, 13268c19a51591d06f5226499972567f528cf6066bb7Jiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ANSI) }, 13278c19a51591d06f5226499972567f528cf6066bb7Jiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ISO) }, 13288c19a51591d06f5226499972567f528cf6066bb7Jiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ANSI) }, 13298c19a51591d06f5226499972567f528cf6066bb7Jiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ISO) }, 13308c19a51591d06f5226499972567f528cf6066bb7Jiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_JIS) }, 13318c19a51591d06f5226499972567f528cf6066bb7Jiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ANSI) }, 13328c19a51591d06f5226499972567f528cf6066bb7Jiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ISO) }, 13338c19a51591d06f5226499972567f528cf6066bb7Jiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_JIS) }, 13348c19a51591d06f5226499972567f528cf6066bb7Jiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ANSI) }, 13358c19a51591d06f5226499972567f528cf6066bb7Jiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ISO) }, 13368c19a51591d06f5226499972567f528cf6066bb7Jiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_JIS) }, 1337fef3f571ecc2a82395c531d97b3f71a59e04e946Ryan Finnie { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_MINI_ANSI) }, 1338fef3f571ecc2a82395c531d97b3f71a59e04e946Ryan Finnie { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_MINI_ISO) }, 1339fef3f571ecc2a82395c531d97b3f71a59e04e946Ryan Finnie { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_MINI_JIS) }, 13408c19a51591d06f5226499972567f528cf6066bb7Jiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ANSI) }, 13418c19a51591d06f5226499972567f528cf6066bb7Jiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ISO) }, 13428c19a51591d06f5226499972567f528cf6066bb7Jiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_JIS) }, 13438c19a51591d06f5226499972567f528cf6066bb7Jiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ANSI) }, 13448c19a51591d06f5226499972567f528cf6066bb7Jiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ISO) }, 13458c19a51591d06f5226499972567f528cf6066bb7Jiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_JIS) }, 1346ee8a1a0a1a5817accd03ced7e7ffde3a4430f485Jan Scholz { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI) }, 1347ee8a1a0a1a5817accd03ced7e7ffde3a4430f485Jan Scholz { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ISO) }, 1348ee8a1a0a1a5817accd03ced7e7ffde3a4430f485Jan Scholz { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_JIS) }, 13498c19a51591d06f5226499972567f528cf6066bb7Jiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ANSI) }, 13508c19a51591d06f5226499972567f528cf6066bb7Jiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ISO) }, 13518c19a51591d06f5226499972567f528cf6066bb7Jiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_JIS) }, 13528c19a51591d06f5226499972567f528cf6066bb7Jiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_ANSI) }, 13538c19a51591d06f5226499972567f528cf6066bb7Jiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_ISO) }, 13548c19a51591d06f5226499972567f528cf6066bb7Jiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_JIS) }, 1355a96d6ef34751093797c3a6c6080733dd7af23d35Henrik Rydberg { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI) }, 1356a96d6ef34751093797c3a6c6080733dd7af23d35Henrik Rydberg { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ISO) }, 1357a96d6ef34751093797c3a6c6080733dd7af23d35Henrik Rydberg { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_JIS) }, 135899b9f758bbc904f22faffcf4d83205f4a5e7bc0cEdgar (gimli) Hucek { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI) }, 135999b9f758bbc904f22faffcf4d83205f4a5e7bc0cEdgar (gimli) Hucek { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_ISO) }, 136099b9f758bbc904f22faffcf4d83205f4a5e7bc0cEdgar (gimli) Hucek { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_JIS) }, 136199b9f758bbc904f22faffcf4d83205f4a5e7bc0cEdgar (gimli) Hucek { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_ANSI) }, 136299b9f758bbc904f22faffcf4d83205f4a5e7bc0cEdgar (gimli) Hucek { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_ISO) }, 136399b9f758bbc904f22faffcf4d83205f4a5e7bc0cEdgar (gimli) Hucek { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS) }, 136447340bd9fefb571888836da942b5aee0e85e959cAndy Botting { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_ANSI) }, 136547340bd9fefb571888836da942b5aee0e85e959cAndy Botting { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_ISO) }, 136647340bd9fefb571888836da942b5aee0e85e959cAndy Botting { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_JIS) }, 1367213f9da80533940560bef8fa43b10c590895459cGökçen Eraslan { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_ANSI) }, 1368213f9da80533940560bef8fa43b10c590895459cGökçen Eraslan { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_ISO) }, 1369213f9da80533940560bef8fa43b10c590895459cGökçen Eraslan { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_JIS) }, 13704a4c879904aa0cc64629e14a49b64fb3d149bf1aDan Bastone { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_REVB_ANSI) }, 13714a4c879904aa0cc64629e14a49b64fb3d149bf1aDan Bastone { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_REVB_ISO) }, 13724a4c879904aa0cc64629e14a49b64fb3d149bf1aDan Bastone { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_REVB_JIS) }, 1373f6f554f09c5b831efdaf67c449e18ca06ee648feJiri Kosina { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6_ANSI) }, 1374f6f554f09c5b831efdaf67c449e18ca06ee648feJiri Kosina { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6_ISO) }, 1375f6f554f09c5b831efdaf67c449e18ca06ee648feJiri Kosina { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6_JIS) }, 1376b3aec7b686329e6bb65aa08c7f9458f7fd512f06Jiri Kosina { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_ANSI) }, 1377b3aec7b686329e6bb65aa08c7f9458f7fd512f06Jiri Kosina { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_ISO) }, 1378b3aec7b686329e6bb65aa08c7f9458f7fd512f06Jiri Kosina { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_JIS) }, 137923aeb61e7e1f02fb0f3b8f9e798e75537ca1731dChristian Schuerer-Waldheim { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI) }, 138023aeb61e7e1f02fb0f3b8f9e798e75537ca1731dChristian Schuerer-Waldheim { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO) }, 138123aeb61e7e1f02fb0f3b8f9e798e75537ca1731dChristian Schuerer-Waldheim { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS) }, 1382ad734bc1565364f9e4b70888d3ce5743b3c1030aAndreas Krist { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ISO) }, 13838c19a51591d06f5226499972567f528cf6066bb7Jiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) }, 13848c19a51591d06f5226499972567f528cf6066bb7Jiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) }, 1385eaca1386207a9e0314647d3a88967acb17cc30e3Jiri Kosina { HID_USB_DEVICE(USB_VENDOR_ID_ASUS, USB_DEVICE_ID_ASUS_T91MT) }, 1386cec15a0ece19116b6c2c53fedf9696c20124d491Roland Baum { HID_USB_DEVICE(USB_VENDOR_ID_ASUS, USB_DEVICE_ID_ASUSTEK_MULTITOUCH_YFO) }, 1387b5635b129b3ca3a9c879a36f58f5b8c4903d267aJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_BELKIN, USB_DEVICE_ID_FLIP_KVM) }, 1388bf280628fca93c4c341587ec914863dcc395af72Wayne Thomas { HID_USB_DEVICE(USB_VENDOR_ID_BTC, USB_DEVICE_ID_BTC_EMPREX_REMOTE) }, 1389c3dc66de59531c921c4638b1285075ea1c831186Jiri Kosina { HID_USB_DEVICE(USB_VENDOR_ID_BTC, USB_DEVICE_ID_BTC_EMPREX_REMOTE_2) }, 13905519cab477b61326963c8d523520db0342862b63Benjamin Tissoires { HID_USB_DEVICE(USB_VENDOR_ID_CANDO, USB_DEVICE_ID_CANDO_PIXCIR_MULTI_TOUCH) }, 139136213e1e40fb863e2e8ef607b2958504b48f6b8eStephane Chatty { HID_USB_DEVICE(USB_VENDOR_ID_CANDO, USB_DEVICE_ID_CANDO_MULTI_TOUCH) }, 1392bc5ab083a68bfec212780281f8e57d871d8882a0Benjamin Tissoires { HID_USB_DEVICE(USB_VENDOR_ID_CANDO, USB_DEVICE_ID_CANDO_MULTI_TOUCH_10_1) }, 1393ba4d8abb31def963f49b7c239a8acce57fe1d1ccStephane Chatty { HID_USB_DEVICE(USB_VENDOR_ID_CANDO, USB_DEVICE_ID_CANDO_MULTI_TOUCH_11_6) }, 1394272036edb77e5967c175ac48b8c88e9b3358285fFrançois Jaouen { HID_USB_DEVICE(USB_VENDOR_ID_CANDO, USB_DEVICE_ID_CANDO_MULTI_TOUCH_15_6) }, 13953b239cd739a9499da08326356add3d9d992c7911Jiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION) }, 13961ce31b255cf8b06470dfbd469055b6fd8d2274bcRaphaël Doursenaud { HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION_SOLAR) }, 1397fcfacfd3594d5d2fa99fb5e7d33dee3904b1a156Jiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_TACTICAL_PAD) }, 1398b9e4b1e0cd401e915e3ba97afc152946f78f9f0bDennis Kügler { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_WIRELESS) }, 1399942fd4225f72826b31d893582b6ae7e172bb3202Austin Zhang { HID_USB_DEVICE(USB_VENDOR_ID_CHUNGHWAT, USB_DEVICE_ID_CHUNGHWAT_MULTITOUCH) }, 14003a370ca1dcf8c80aff7a0a21d6b0f50ca2a151e9Don Prince { HID_USB_DEVICE(USB_VENDOR_ID_CREATIVELABS, USB_DEVICE_ID_PRODIKEYS_PCMIDI) }, 140179603dc9a8223856cf3194dcabad32b9828c7be9Benjamin Tissoires { HID_USB_DEVICE(USB_VENDOR_ID_CVTOUCH, USB_DEVICE_ID_CVTOUCH_SCREEN) }, 14020f2213208f8da51bcb665309e3468f000489c04fJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_1) }, 14030f2213208f8da51bcb665309e3468f000489c04fJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_2) }, 1404e8d0eab4d9eda9f5e97852f780f020bfb134f9f0Jiri Kosina { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_3) }, 14050f2213208f8da51bcb665309e3468f000489c04fJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_MOUSE) }, 1406a3b5e577d96bfccbc41ebf4df784e3a153072273Benjamin Tissoires { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_TRUETOUCH) }, 14073f866fbd52d1863db5c07700e560aef22c4fdc01Richard Walmsley { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, 0x0006) }, 1408e05eefb9be109e6cbbfd362b49ee83397130a7e4Nikolai Kondrashov { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, 0x0011) }, 1409e36f690b37945e0a9bb1554e1546eeec93f7d1f6Benjamin Tissoires { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_480D) }, 1410e36f690b37945e0a9bb1554e1546eeec93f7d1f6Benjamin Tissoires { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_480E) }, 1411e36f690b37945e0a9bb1554e1546eeec93f7d1f6Benjamin Tissoires { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_720C) }, 1412e36f690b37945e0a9bb1554e1546eeec93f7d1f6Benjamin Tissoires { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_726B) }, 1413e36f690b37945e0a9bb1554e1546eeec93f7d1f6Benjamin Tissoires { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72A1) }, 1414bb9ff21072043634f147c05ac65dbf8185d4af6dMarek Vasut { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7302) }, 1415e36f690b37945e0a9bb1554e1546eeec93f7d1f6Benjamin Tissoires { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_A001) }, 141664b386ea16112564e0b93473e2c347125effb6b2Richard Nauber { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_BM084) }, 1417c04abeeff9d76a703cac1e6d312853b0fc8136f5Benjamin Tissoires { HID_USB_DEVICE(USB_VENDOR_ID_ELO, USB_DEVICE_ID_ELO_TS2515) }, 141804561c5aa243c98cae93cde27e05740df787e692Ignaz Forster { HID_USB_DEVICE(USB_VENDOR_ID_EMS, USB_DEVICE_ID_EMS_TRIO_LINKER_PLUS_II) }, 14191f243e302cea1561ac881eb5d27041c5342beba4Jiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_EZKEY, USB_DEVICE_ID_BTC_8193) }, 14205181e594512faeac7d7fd9620ce91105f45bf643Jiri Kosina { HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PSX_ADAPTOR) }, 1421578f3a35fecabff49bad808c5301313f785b5462Jiri Kosina { HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PCS_ADAPTOR) }, 14225572da08a784621f2ab4fdc8dc65471261871795Benjamin Tissoires { HID_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH, USB_DEVICE_ID_GENERAL_TOUCH_WIN7_TWOFINGERS) }, 1423ee0fbd149182d91e3b9df7b306eb03cd1f1dd4a1Benjamin Tissoires { HID_USB_DEVICE(USB_VENDOR_ID_GOODTOUCH, USB_DEVICE_ID_GOODTOUCH_000f) }, 14245181e594512faeac7d7fd9620ce91105f45bf643Jiri Kosina { HID_USB_DEVICE(USB_VENDOR_ID_GREENASIA, 0x0003) }, 142542859e0bd21daba9974757fcfe4a4dde265fe28dLukasz Lubojanski { HID_USB_DEVICE(USB_VENDOR_ID_GREENASIA, 0x0012) }, 1426949f8fef77186c7361d22e1ea6f42c76ceda42b0Jiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE) }, 14271e093206734568e780c2717da1c89b97e9471954Jiri Kosina { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE_2) }, 1428c2fd1a4ebf9127c280d227acb635eb1df213439cCory Maccarrone { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE_3) }, 14295519cab477b61326963c8d523520db0342862b63Benjamin Tissoires { HID_USB_DEVICE(USB_VENDOR_ID_HANVON, USB_DEVICE_ID_HANVON_MULTITOUCH) }, 1430545803651da8dde248eeb8ce3ed1e547e9e4ac0aBenjamin Tissoires { HID_USB_DEVICE(USB_VENDOR_ID_HANVON_ALT, USB_DEVICE_ID_HANVON_ALT_MULTITOUCH) }, 1431a062cc5a76fa1d12f0821e56e3746cad2dc2fc65Stephane Chatty { HID_USB_DEVICE(USB_VENDOR_ID_IDEACOM, USB_DEVICE_ID_IDEACOM_IDC6650) }, 1432d946e65e2ab885c05b8cacf292be65fa292d08f6Anssi Hannula { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK, USB_DEVICE_ID_HOLTEK_ON_LINE_GRIP) }, 14334e61f0d75aa86c9e59451f6bcffcdceb355b4fc4Austin Zhang { HID_USB_DEVICE(USB_VENDOR_ID_ILITEK, USB_DEVICE_ID_ILITEK_MULTITOUCH) }, 1434b2e7617e09a8e774d7819c629a0989cbddb5d1abBenjamin Tissoires { HID_USB_DEVICE(USB_VENDOR_ID_IRTOUCHSYSTEMS, USB_DEVICE_ID_IRTOUCH_INFRARED_USB) }, 1435fdf93aa33268889e126aa677f2072238bd76adb0Jiri Kosina { HID_USB_DEVICE(USB_VENDOR_ID_KENSINGTON, USB_DEVICE_ID_KS_SLIMBLADE) }, 1436177900e8c9ab28cdf097314fe7dd3877774df97dJiri Kosina { HID_USB_DEVICE(USB_VENDOR_ID_KEYTOUCH, USB_DEVICE_ID_KEYTOUCH_IEC) }, 1437794227415f8f5f395a9ed4269a4ee7a3c34f66a5Jiri Kosina { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_ERGO_525V) }, 1438b5635b129b3ca3a9c879a36f58f5b8c4903d267aJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_LABTEC, USB_DEVICE_ID_LABTEC_WIRELESS_KEYBOARD) }, 143975b07022462fc33d6be15669ad604118653210a9Chris Schlund { HID_USB_DEVICE(USB_VENDOR_ID_LCPOWER, USB_DEVICE_ID_LCPOWER_LC1000 ) }, 1440c50bb1a4005630f47b5da26336f74a485033a515Jeff Brown { HID_USB_DEVICE(USB_VENDOR_ID_LG, USB_DEVICE_ID_LG_MULTITOUCH) }, 14415f22a7992349c5ca3842190be52d5e9a1dd7adf4Jiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_MX3000_RECEIVER) }, 14425f22a7992349c5ca3842190be52d5e9a1dd7adf4Jiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_S510_RECEIVER) }, 14435f22a7992349c5ca3842190be52d5e9a1dd7adf4Jiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_S510_RECEIVER_2) }, 14445f22a7992349c5ca3842190be52d5e9a1dd7adf4Jiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RECEIVER) }, 14455f22a7992349c5ca3842190be52d5e9a1dd7adf4Jiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_DINOVO_DESKTOP) }, 14465f22a7992349c5ca3842190be52d5e9a1dd7adf4Jiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_DINOVO_EDGE) }, 14475f22a7992349c5ca3842190be52d5e9a1dd7adf4Jiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_DINOVO_MINI) }, 14485f22a7992349c5ca3842190be52d5e9a1dd7adf4Jiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_ELITE_KBD) }, 14495f22a7992349c5ca3842190be52d5e9a1dd7adf4Jiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_CORDLESS_DESKTOP_LX500) }, 14505f22a7992349c5ca3842190be52d5e9a1dd7adf4Jiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_EXTREME_3D) }, 14515f22a7992349c5ca3842190be52d5e9a1dd7adf4Jiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WHEEL) }, 14522c6118e43040034d80894daeba41960bf0035b31Hendrik Iben { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD_CORD) }, 1453606bd0a8616a0e59021cb2997e942513f24f641dJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD) }, 1454606bd0a8616a0e59021cb2997e942513f24f641dJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD2_2) }, 1455606bd0a8616a0e59021cb2997e942513f24f641dJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WINGMAN_F3D) }, 1456fd30ea8c871552ddd6a5e1c0886de8fef4df53bcJiri Kosina { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WINGMAN_FFG ) }, 1457606bd0a8616a0e59021cb2997e942513f24f641dJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_FORCE3D_PRO) }, 145874f292ca8c7a2b9370f80d97a49e48174f4c7635Gary Stein { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_FLIGHT_SYSTEM_G940) }, 1459606bd0a8616a0e59021cb2997e942513f24f641dJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MOMO_WHEEL) }, 1460606bd0a8616a0e59021cb2997e942513f24f641dJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MOMO_WHEEL2) }, 14615623a24a80814fe471e777f12b9dbbb0f77e002eJiri Kosina { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_DFP_WHEEL) }, 1462e00ddc9b8f978ffbc6c212f780a2bb83aafe2fbdMichal Malý { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_DFGT_WHEEL) }, 1463243b706d8a71364ad6080328d45b73516c8af5f3Christophe Borivant { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G25_WHEEL) }, 1464fdc6807fcd09416c5537f479e1dcd624118e234cPeter Gundermann { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G27_WHEEL) }, 1465534a7b8e10ec55d9f521e68c20dbb3634c25b98aNestor Lopez Casado { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_UNIFYING_RECEIVER) }, 1466534a7b8e10ec55d9f521e68c20dbb3634c25b98aNestor Lopez Casado { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_UNIFYING_RECEIVER_2) }, 146732c88cbc3080f43c429f6456aa9cd845e37f3778Simon Wood { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WII_WHEEL) }, 1468606bd0a8616a0e59021cb2997e942513f24f641dJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD2) }, 146924985cf68612a5617d396b0b188cec807641cde1Jiri Kosina { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_SPACETRAVELLER) }, 147024985cf68612a5617d396b0b188cec807641cde1Jiri Kosina { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_SPACENAVIGATOR) }, 1471df167c4a0d68a9dbde044a39a77f255ac666f93eBenjamin Tissoires { HID_USB_DEVICE(USB_VENDOR_ID_LUMIO, USB_DEVICE_ID_CRYSTALTOUCH) }, 1472c3ead6de4f6bd1c08a81f84e629e3dbf4a9078f0Benjamin Tissoires { HID_USB_DEVICE(USB_VENDOR_ID_LUMIO, USB_DEVICE_ID_CRYSTALTOUCH_DUAL) }, 1473236db47c2b3b69464d50c695ab2ddd516cf64520Bruno Prémont { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICOLCD) }, 1474236db47c2b3b69464d50c695ab2ddd516cf64520Bruno Prémont { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICOLCD_BOOTLOADER) }, 1475b580169affd7ccc9347cbf4d5f4db1480ee7ee06Jiri Kosina { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_COMFORT_MOUSE_4500) }, 147678a849a682a1d5ee7b7187b08abdc48656326a4eJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_SIDEWINDER_GV) }, 147778a849a682a1d5ee7b7187b08abdc48656326a4eJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_NE4K) }, 147878a849a682a1d5ee7b7187b08abdc48656326a4eJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_LK6K) }, 147978a849a682a1d5ee7b7187b08abdc48656326a4eJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_USB) }, 1480f3b83d71a1b1a1569dba774c3a4f6e2a3b9fef99Jiri Kosina { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_DIGITAL_MEDIA_3K) }, 148178a849a682a1d5ee7b7187b08abdc48656326a4eJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_WIRELESS_OPTICAL_DESKTOP_3_0) }, 14823b8006e51038ef263a0404756d9e190c9a9f74d5Jiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_MONTEREY, USB_DEVICE_ID_GENIUS_KB29E) }, 148394011f93f2cd7410401e22390cf7a14fe5495a22Rafi Rubin { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN) }, 14846e32819e12ffbd507eced11a1871700a387d5407micki { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_1) }, 14856e32819e12ffbd507eced11a1871700a387d5407micki { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_2) }, 14866e32819e12ffbd507eced11a1871700a387d5407micki { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_3) }, 14876e32819e12ffbd507eced11a1871700a387d5407micki { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_4) }, 14886e32819e12ffbd507eced11a1871700a387d5407micki { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_5) }, 14896e32819e12ffbd507eced11a1871700a387d5407micki { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_6) }, 14906e32819e12ffbd507eced11a1871700a387d5407micki { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_7) }, 14916e32819e12ffbd507eced11a1871700a387d5407micki { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_8) }, 14926e32819e12ffbd507eced11a1871700a387d5407micki { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_9) }, 14936e32819e12ffbd507eced11a1871700a387d5407micki { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_10) }, 14946e32819e12ffbd507eced11a1871700a387d5407micki { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_11) }, 14956e32819e12ffbd507eced11a1871700a387d5407micki { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_12) }, 14966e32819e12ffbd507eced11a1871700a387d5407micki { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_13) }, 14976e32819e12ffbd507eced11a1871700a387d5407micki { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_14) }, 14986e32819e12ffbd507eced11a1871700a387d5407micki { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_15) }, 14996e32819e12ffbd507eced11a1871700a387d5407micki { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_16) }, 15006e32819e12ffbd507eced11a1871700a387d5407micki { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_17) }, 15016e32819e12ffbd507eced11a1871700a387d5407micki { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_18) }, 1502270fdc0748bd3f7b625caff985f2fcf8e2185ec7Herton Ronaldo Krzesinski { HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_PKB1700) }, 1503cd9ec30da58bcd8ab154eba9eb54d16c67e7ef3bJohnathon Harris { HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_WKB2000) }, 15046ab3a9a63fc16b04f7de48eb0190d516dd7574dfJohn Sung { HID_USB_DEVICE(USB_VENDOR_ID_PENMOUNT, USB_DEVICE_ID_PENMOUNT_PCI) }, 15051e76253220dbe66e048e55680266dd1f4af0be85Jiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_PETALYNX, USB_DEVICE_ID_PETALYNX_MAXTER_REMOTE) }, 1506b7ea95ff9baab144dacdc30d752307938c5ab6bfAaron Tian { HID_USB_DEVICE(USB_VENDOR_ID_PIXART, USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN) }, 1507b7ea95ff9baab144dacdc30d752307938c5ab6bfAaron Tian { HID_USB_DEVICE(USB_VENDOR_ID_PIXART, USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN1) }, 1508b7ea95ff9baab144dacdc30d752307938c5ab6bfAaron Tian { HID_USB_DEVICE(USB_VENDOR_ID_PIXART, USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN2) }, 1509f6a04605f303852963f3f357d19b967aa83c172fTerry Lambert { HID_USB_DEVICE(USB_VENDOR_ID_PRIMAX, USB_DEVICE_ID_PRIMAX_KEYBOARD) }, 151049e4739a0cf681cbfe08c72232c1dcc130b66ddeStephane Chatty { HID_USB_DEVICE(USB_VENDOR_ID_QUANTA, USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH) }, 1511f54405db66fbec11679241daefd16fd8291a5762Alex Neblett { HID_USB_DEVICE(USB_VENDOR_ID_QUANTA, USB_DEVICE_ID_PIXART_IMAGING_INC_OPTICAL_TOUCH_SCREEN) }, 151214bf62cde79423a02a590e02664ed29a36facec1Stefan Achatz { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_KONE) }, 1513e68cc603b063416c85f3e408184219fb71d4a9ffStefan Achatz { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_ARVO) }, 1514d41c2a7011dffc60571eab8dc4e2a297ef106f44Stefan Achatz { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_ISKU) }, 151547dbdbffe15b9582a41727766d43f1d4208e977eStefan Achatz { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_KONEPLUS) }, 15160e70f97f257edcef4daa92ab9371a9aac0c851edStefan Achatz { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_KOVAPLUS) }, 1517cb7cf3da0daa9830e00640da8f7d2380f4b4de42Stefan Achatz { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_PYRA_WIRED) }, 15183fce224608f38eac6d6b032b0619c1655acaf61dStefan Achatz { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_PYRA_WIRELESS) }, 1519980a3da6acdd577ee3ae192e868dc52fe4b7f2e5Jiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_IR_REMOTE) }, 1520b355850ba383232d4e0e357c1cda8cb7bfcc60bcDon Prince { HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_WIRELESS_KBD_MOUSE) }, 1521d586dca06adddc6cee7177b013ee93eaffc9fe0eJiri Kosina { HID_USB_DEVICE(USB_VENDOR_ID_SKYCABLE, USB_DEVICE_ID_SKYCABLE_WIRELESS_PRESENTER) }, 1522bd28ce008bdc68ef5902f68d2d62cbb7fa78c415Jiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) }, 152335dca5b4a67a93bbb75c2753d6dc432dc8f82e5dJiri Kosina { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_NAVIGATION_CONTROLLER) }, 1524f9ce7c283c16538955d5d094101889792bcde109Bastien Nocera { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) }, 1525cc6e0bbb47f02fd36cd55b3189c0c79079096ab8Jiri Kosina { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE) }, 1526d3fb5454a8474d5d22c8f8fe4d043b05732d91d5Stephane Chatty { HID_USB_DEVICE(USB_VENDOR_ID_STANTUM, USB_DEVICE_ID_MTP) }, 1527b6dc79929fa18a97bbc08400db72405ad835622fPascal Auriel - Stantum { HID_USB_DEVICE(USB_VENDOR_ID_STANTUM_STM, USB_DEVICE_ID_MTP_STM) }, 1528b6dc79929fa18a97bbc08400db72405ad835622fPascal Auriel - Stantum { HID_USB_DEVICE(USB_VENDOR_ID_STANTUM_SITRONIX, USB_DEVICE_ID_MTP_SITRONIX) }, 152990231e7eaf752856a2c13f786f36ec7f641bad28Jiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_SUNPLUS, USB_DEVICE_ID_SUNPLUS_WDESKTOP) }, 1530daedb3d6a91f9626ab4c921378ac52e44de833d5Anssi Hannula { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb300) }, 1531daedb3d6a91f9626ab4c921378ac52e44de833d5Anssi Hannula { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb304) }, 15327a84b1336a145d683fb8cdfd6c2c67545a58b126Ruben Aos Garralda { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb323) }, 15337a84b1336a145d683fb8cdfd6c2c67545a58b126Ruben Aos Garralda { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb324) }, 1534daedb3d6a91f9626ab4c921378ac52e44de833d5Anssi Hannula { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb651) }, 15353ee8f0a2b1c81f0472b25d40aa5c1c7c6a0edc2aMarkus Rathgeb { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb653) }, 1536daedb3d6a91f9626ab4c921378ac52e44de833d5Anssi Hannula { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb654) }, 1537d65c3768afb47fb93c43fbfcafef53502edaaa85Simon Wood { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb65a) }, 1538f14f526d02b14fd0b8c1ac4ec413e4577ad5f62eLev Babiev { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED, USB_DEVICE_ID_TOPSEED_CYBERLINK) }, 1539540010812179a16d3d00fb8363bb06ee83af25b8Kees Bakker { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED2, USB_DEVICE_ID_TOPSEED2_RF_COMBO) }, 15405e74e56da03f581482c104628951eeb1455848eaBenjamin Tissoires { HID_USB_DEVICE(USB_VENDOR_ID_TOUCH_INTL, USB_DEVICE_ID_TOUCH_INTL_MULTI_TOUCH) }, 1541711a680e35059bc5c7c28d3c4bd0bebd3b7bb6eeBruno Premont { HID_USB_DEVICE(USB_VENDOR_ID_TWINHAN, USB_DEVICE_ID_TWINHAN_IR_REMOTE) }, 1542c64f6f934c7490faff76faf96217066a1b3570a0Benjamin Tissoires { HID_USB_DEVICE(USB_VENDOR_ID_TURBOX, USB_DEVICE_ID_TURBOX_TOUCHSCREEN_MOSART) }, 154341fa92302be7fa37c5c38e17e2097d3e5e9da13aNikolai Kondrashov { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_PF1209) }, 1544f8a489cc5f7adafa9f1420279be793de0fba481cNikolai Kondrashov { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP4030U) }, 1545f8a489cc5f7adafa9f1420279be793de0fba481cNikolai Kondrashov { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP5540U) }, 1546f8a489cc5f7adafa9f1420279be793de0fba481cNikolai Kondrashov { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP8060U) }, 15476be914f11db8e88d11b08d6c496624dbbd642d80Nikolai Kondrashov { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP1062) }, 1548617b64f97708be26a061e6c8178ad46b4c49d031Benjamin Tissoires { HID_USB_DEVICE(USB_VENDOR_ID_UNITEC, USB_DEVICE_ID_UNITEC_USB_TOUCH_0709) }, 1549617b64f97708be26a061e6c8178ad46b4c49d031Benjamin Tissoires { HID_USB_DEVICE(USB_VENDOR_ID_UNITEC, USB_DEVICE_ID_UNITEC_USB_TOUCH_0A19) }, 1550fac733f029251a393c42a8313432f2d9fe43bb83Jussi Kivilinna { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_SMARTJOY_PLUS) }, 1551ad395ccadb6b2f0a4f9e004c9e6f2a8c22091ed0Sean Young { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_DUAL_USB_JOYPAD) }, 15521bcc20675a1ac1ba47eaa201e02a89b0508e17b2Sean Young { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP_LTD, USB_DEVICE_ID_SUPER_JOY_BOX_3_PRO) }, 15531bcc20675a1ac1ba47eaa201e02a89b0508e17b2Sean Young { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP_LTD, USB_DEVICE_ID_SUPER_DUAL_BOX_PRO) }, 15541bcc20675a1ac1ba47eaa201e02a89b0508e17b2Sean Young { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP_LTD, USB_DEVICE_ID_SUPER_JOY_BOX_5_PRO) }, 1555ca2dcd40f54c8928b3994712a6cadd2078a087faBastien Nocera { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_GRAPHIRE_BLUETOOTH) }, 155678761ff9bc4e944e0b4e5df1e7eedcfdbb1a9a1aPrzemo Firszt { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS4_BLUETOOTH) }, 155772a46344867111c3e019b169ddfa9e1a1f55c759Nikolai Kondrashov { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_SLIM_TABLET_5_8_INCH) }, 155800e7f9649b3061281fe4b463263da26155dc9be4Nikolai Kondrashov { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_SLIM_TABLET_12_1_INCH) }, 155972a46344867111c3e019b169ddfa9e1a1f55c759Nikolai Kondrashov { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_MEDIA_TABLET_10_6_INCH) }, 15608f1acc32bbdb1784bcb0be98fb02f4b20e6f328fNikolai Kondrashov { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_MEDIA_TABLET_14_1_INCH) }, 1561bc8a2a9b4e5c418bebaa6bb812982b7ecd298821ice chien { HID_USB_DEVICE(USB_VENDOR_ID_XAT, USB_DEVICE_ID_XAT_CSR) }, 156211576c6114c3b6505aea2e0c988bedb856a0e20cMasatoshi Hoshikawa { HID_USB_DEVICE(USB_VENDOR_ID_XIROKU, USB_DEVICE_ID_XIROKU_SPX) }, 156311576c6114c3b6505aea2e0c988bedb856a0e20cMasatoshi Hoshikawa { HID_USB_DEVICE(USB_VENDOR_ID_XIROKU, USB_DEVICE_ID_XIROKU_MPX) }, 156411576c6114c3b6505aea2e0c988bedb856a0e20cMasatoshi Hoshikawa { HID_USB_DEVICE(USB_VENDOR_ID_XIROKU, USB_DEVICE_ID_XIROKU_CSR) }, 156511576c6114c3b6505aea2e0c988bedb856a0e20cMasatoshi Hoshikawa { HID_USB_DEVICE(USB_VENDOR_ID_XIROKU, USB_DEVICE_ID_XIROKU_SPX1) }, 156611576c6114c3b6505aea2e0c988bedb856a0e20cMasatoshi Hoshikawa { HID_USB_DEVICE(USB_VENDOR_ID_XIROKU, USB_DEVICE_ID_XIROKU_MPX1) }, 156711576c6114c3b6505aea2e0c988bedb856a0e20cMasatoshi Hoshikawa { HID_USB_DEVICE(USB_VENDOR_ID_XIROKU, USB_DEVICE_ID_XIROKU_CSR1) }, 156811576c6114c3b6505aea2e0c988bedb856a0e20cMasatoshi Hoshikawa { HID_USB_DEVICE(USB_VENDOR_ID_XIROKU, USB_DEVICE_ID_XIROKU_SPX2) }, 156911576c6114c3b6505aea2e0c988bedb856a0e20cMasatoshi Hoshikawa { HID_USB_DEVICE(USB_VENDOR_ID_XIROKU, USB_DEVICE_ID_XIROKU_MPX2) }, 157011576c6114c3b6505aea2e0c988bedb856a0e20cMasatoshi Hoshikawa { HID_USB_DEVICE(USB_VENDOR_ID_XIROKU, USB_DEVICE_ID_XIROKU_CSR2) }, 157174bc6953135ae1478acc18046321bfca05b0e823Stefan Kriwanek { HID_USB_DEVICE(USB_VENDOR_ID_X_TENSIONS, USB_DEVICE_ID_SPEEDLINK_VAD_CEZANNE) }, 1572daedb3d6a91f9626ab4c921378ac52e44de833d5Anssi Hannula { HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS, 0x0005) }, 1573daedb3d6a91f9626ab4c921378ac52e44de833d5Anssi Hannula { HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS, 0x0030) }, 1574a9885c8f7bf62e251fc178f838b9f0ee897c158aDon Prince { HID_USB_DEVICE(USB_VENDOR_ID_ZYDACRON, USB_DEVICE_ID_ZYDACRON_REMOTE_CONTROL) }, 15758c19a51591d06f5226499972567f528cf6066bb7Jiri Slaby 157678a849a682a1d5ee7b7187b08abdc48656326a4eJiri Slaby { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_BT) }, 157702fb72a06ae1ed55b4373a4c678f25d70fd65902David Herrmann { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_NINTENDO, USB_DEVICE_ID_NINTENDO_WIIMOTE) }, 157885cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby { } 157985cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby}; 158085cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby 15813a6f82f7a22cf19687f556997c6978b31c109360Jiri Slabystruct hid_dynid { 15823a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby struct list_head list; 15833a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby struct hid_device_id id; 15843a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby}; 15853a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby 15863a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby/** 15873a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby * store_new_id - add a new HID device ID to this driver and re-probe devices 15883a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby * @driver: target device driver 15893a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby * @buf: buffer for scanning device ID data 15903a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby * @count: input size 15913a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby * 15923a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby * Adds a new dynamic hid device ID to this driver, 15933a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby * and causes the driver to probe for all devices again. 15943a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby */ 15953a6f82f7a22cf19687f556997c6978b31c109360Jiri Slabystatic ssize_t store_new_id(struct device_driver *drv, const char *buf, 15963a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby size_t count) 15973a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby{ 15983a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby struct hid_driver *hdrv = container_of(drv, struct hid_driver, driver); 15993a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby struct hid_dynid *dynid; 16003a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby __u32 bus, vendor, product; 16013a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby unsigned long driver_data = 0; 16023a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby int ret; 16033a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby 16043a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby ret = sscanf(buf, "%x %x %x %lx", 16053a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby &bus, &vendor, &product, &driver_data); 16063a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby if (ret < 3) 16073a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby return -EINVAL; 16083a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby 16093a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby dynid = kzalloc(sizeof(*dynid), GFP_KERNEL); 16103a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby if (!dynid) 16113a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby return -ENOMEM; 16123a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby 16133a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby dynid->id.bus = bus; 16143a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby dynid->id.vendor = vendor; 16153a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby dynid->id.product = product; 16163a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby dynid->id.driver_data = driver_data; 16173a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby 16183a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby spin_lock(&hdrv->dyn_lock); 16193a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby list_add_tail(&dynid->list, &hdrv->dyn_list); 16203a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby spin_unlock(&hdrv->dyn_lock); 16213a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby 16223a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby ret = 0; 16233a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby if (get_driver(&hdrv->driver)) { 16243a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby ret = driver_attach(&hdrv->driver); 16253a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby put_driver(&hdrv->driver); 16263a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby } 16273a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby 16283a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby return ret ? : count; 16293a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby} 16303a6f82f7a22cf19687f556997c6978b31c109360Jiri Slabystatic DRIVER_ATTR(new_id, S_IWUSR, NULL, store_new_id); 16313a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby 16323a6f82f7a22cf19687f556997c6978b31c109360Jiri Slabystatic void hid_free_dynids(struct hid_driver *hdrv) 16333a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby{ 16343a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby struct hid_dynid *dynid, *n; 16353a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby 16363a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby spin_lock(&hdrv->dyn_lock); 16373a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby list_for_each_entry_safe(dynid, n, &hdrv->dyn_list, list) { 16383a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby list_del(&dynid->list); 16393a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby kfree(dynid); 16403a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby } 16413a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby spin_unlock(&hdrv->dyn_lock); 16423a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby} 16433a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby 16443a6f82f7a22cf19687f556997c6978b31c109360Jiri Slabystatic const struct hid_device_id *hid_match_device(struct hid_device *hdev, 16453a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby struct hid_driver *hdrv) 16463a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby{ 16473a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby struct hid_dynid *dynid; 16483a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby 16493a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby spin_lock(&hdrv->dyn_lock); 16503a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby list_for_each_entry(dynid, &hdrv->dyn_list, list) { 16513a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby if (hid_match_one_id(hdev, &dynid->id)) { 16523a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby spin_unlock(&hdrv->dyn_lock); 16533a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby return &dynid->id; 16543a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby } 16553a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby } 16563a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby spin_unlock(&hdrv->dyn_lock); 16573a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby 16583a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby return hid_match_id(hdev, hdrv->id_table); 16593a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby} 16603a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby 166185cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slabystatic int hid_bus_match(struct device *dev, struct device_driver *drv) 166285cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby{ 166385cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby struct hid_driver *hdrv = container_of(drv, struct hid_driver, driver); 166485cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby struct hid_device *hdev = container_of(dev, struct hid_device, dev); 166585cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby 16663a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby if (!hid_match_device(hdev, hdrv)) 166785cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby return 0; 166885cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby 1669ce06b9d6d33fd2ed799b6e825d68fe95077da354Dmitry Torokhov /* generic wants all that don't have specialized driver */ 167085cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby if (!strncmp(hdrv->name, "generic-", 8)) 1671ce06b9d6d33fd2ed799b6e825d68fe95077da354Dmitry Torokhov return !hid_match_id(hdev, hid_have_special_driver); 167285cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby 167385cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby return 1; 167485cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby} 167585cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby 167685cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slabystatic int hid_device_probe(struct device *dev) 167785cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby{ 167885cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby struct hid_driver *hdrv = container_of(dev->driver, 167985cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby struct hid_driver, driver); 168085cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby struct hid_device *hdev = container_of(dev, struct hid_device, dev); 168185cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby const struct hid_device_id *id; 168285cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby int ret = 0; 168385cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby 16844ea5454203d991ec85264f64f89ca8855fce69b0David Herrmann if (down_interruptible(&hdev->driver_lock)) 16854ea5454203d991ec85264f64f89ca8855fce69b0David Herrmann return -EINTR; 16864ea5454203d991ec85264f64f89ca8855fce69b0David Herrmann 168785cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby if (!hdev->driver) { 16883a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby id = hid_match_device(hdev, hdrv); 1689ba623a774f5b529f89b3d63e0837df52e16ffb3bDan Carpenter if (id == NULL) { 1690ba623a774f5b529f89b3d63e0837df52e16ffb3bDan Carpenter ret = -ENODEV; 1691ba623a774f5b529f89b3d63e0837df52e16ffb3bDan Carpenter goto unlock; 1692ba623a774f5b529f89b3d63e0837df52e16ffb3bDan Carpenter } 169385cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby 1694c500c9714011edab021591340042787722db9cf0Jiri Slaby hdev->driver = hdrv; 1695c500c9714011edab021591340042787722db9cf0Jiri Slaby if (hdrv->probe) { 1696c500c9714011edab021591340042787722db9cf0Jiri Slaby ret = hdrv->probe(hdev, id); 1697c500c9714011edab021591340042787722db9cf0Jiri Slaby } else { /* default probe */ 1698c500c9714011edab021591340042787722db9cf0Jiri Slaby ret = hid_parse(hdev); 1699c500c9714011edab021591340042787722db9cf0Jiri Slaby if (!ret) 170093c10132a7ac160df3175b53f7ee857625412165Jiri Slaby ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); 170185cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby } 1702c500c9714011edab021591340042787722db9cf0Jiri Slaby if (ret) 1703c500c9714011edab021591340042787722db9cf0Jiri Slaby hdev->driver = NULL; 170485cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby } 1705ba623a774f5b529f89b3d63e0837df52e16ffb3bDan Carpenterunlock: 17064ea5454203d991ec85264f64f89ca8855fce69b0David Herrmann up(&hdev->driver_lock); 170785cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby return ret; 170885cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby} 170985cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby 171085cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slabystatic int hid_device_remove(struct device *dev) 171185cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby{ 171285cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby struct hid_device *hdev = container_of(dev, struct hid_device, dev); 17134ea5454203d991ec85264f64f89ca8855fce69b0David Herrmann struct hid_driver *hdrv; 17144ea5454203d991ec85264f64f89ca8855fce69b0David Herrmann 17154ea5454203d991ec85264f64f89ca8855fce69b0David Herrmann if (down_interruptible(&hdev->driver_lock)) 17164ea5454203d991ec85264f64f89ca8855fce69b0David Herrmann return -EINTR; 171785cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby 17184ea5454203d991ec85264f64f89ca8855fce69b0David Herrmann hdrv = hdev->driver; 171985cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby if (hdrv) { 172085cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby if (hdrv->remove) 172185cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby hdrv->remove(hdev); 1722c500c9714011edab021591340042787722db9cf0Jiri Slaby else /* default remove */ 1723c500c9714011edab021591340042787722db9cf0Jiri Slaby hid_hw_stop(hdev); 172485cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby hdev->driver = NULL; 172585cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby } 172685cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby 17274ea5454203d991ec85264f64f89ca8855fce69b0David Herrmann up(&hdev->driver_lock); 172885cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby return 0; 172985cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby} 173085cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby 173185cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slabystatic int hid_uevent(struct device *dev, struct kobj_uevent_env *env) 173285cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby{ 173385cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby struct hid_device *hdev = container_of(dev, struct hid_device, dev); 173485cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby 173585cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby if (add_uevent_var(env, "HID_ID=%04X:%08X:%08X", 173685cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby hdev->bus, hdev->vendor, hdev->product)) 173785cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby return -ENOMEM; 173885cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby 173985cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby if (add_uevent_var(env, "HID_NAME=%s", hdev->name)) 174085cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby return -ENOMEM; 174185cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby 174285cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby if (add_uevent_var(env, "HID_PHYS=%s", hdev->phys)) 174385cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby return -ENOMEM; 174485cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby 174585cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby if (add_uevent_var(env, "HID_UNIQ=%s", hdev->uniq)) 174685cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby return -ENOMEM; 174785cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby 174885cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby if (add_uevent_var(env, "MODALIAS=hid:b%04Xv%08Xp%08X", 174985cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby hdev->bus, hdev->vendor, hdev->product)) 175085cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby return -ENOMEM; 175185cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby 175285cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby return 0; 175385cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby} 175485cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby 175585cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slabystatic struct bus_type hid_bus_type = { 175685cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby .name = "hid", 175785cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby .match = hid_bus_match, 175885cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby .probe = hid_device_probe, 175985cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby .remove = hid_device_remove, 176085cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby .uevent = hid_uevent, 176185cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby}; 176285cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby 1763bae7eb33b25387fdc7ccae08768bef1f9484a5b0Jiri Kosina/* a list of devices that shouldn't be handled by HID core at all */ 1764d458a9dfc4de24870b8c747484b1988726534beeJiri Slabystatic const struct hid_device_id hid_ignore_list[] = { 1765d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_ACECAD, USB_DEVICE_ID_ACECAD_FLAIR) }, 1766d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_ACECAD, USB_DEVICE_ID_ACECAD_302) }, 1767d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_ADS_TECH, USB_DEVICE_ID_ADS_TECH_RADIO_SI470X) }, 1768d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_01) }, 1769d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_10) }, 1770d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_20) }, 1771d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_21) }, 1772d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_22) }, 1773d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_23) }, 1774d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_24) }, 1775d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_AIRCABLE, USB_DEVICE_ID_AIRCABLE1) }, 1776d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_ALCOR, USB_DEVICE_ID_ALCOR_USBRS232) }, 177777f720b71d88a3cbf574c113566a31c93099f97dStephane Chatty { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_LCM)}, 177877f720b71d88a3cbf574c113566a31c93099f97dStephane Chatty { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_LCM2)}, 177962a56582e01b1c5139b235004548e233201df9aaAlexey Klimov { HID_USB_DEVICE(USB_VENDOR_ID_AVERMEDIA, USB_DEVICE_ID_AVER_FM_MR800) }, 1780d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_BERKSHIRE, USB_DEVICE_ID_BERKSHIRE_PCWD) }, 1781d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_CIDC, 0x0103) }, 1782d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_CYGNAL, USB_DEVICE_ID_CYGNAL_RADIO_SI470X) }, 1783d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_CMEDIA, USB_DEVICE_ID_CM109) }, 1784d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_HIDCOM) }, 1785d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_ULTRAMOUSE) }, 17865f6108cf9be4a77d6bee96750aa4fe18b6b97deeAlexey Klimov { HID_USB_DEVICE(USB_VENDOR_ID_DEALEXTREAME, USB_DEVICE_ID_DEALEXTREAME_RADIO_SI4701) }, 1787d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_DELORME, USB_DEVICE_ID_DELORME_EARTHMATE) }, 1788d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_DELORME, USB_DEVICE_ID_DELORME_EM_LT20) }, 178973bc7d315f56e260071bdb5f15e25b53bddc1402Melchior FRANZ { HID_USB_DEVICE(USB_VENDOR_ID_DREAM_CHEEKY, 0x0004) }, 1790789aaa2ee0af1a0fba4c73f1874ad524d7be0771Dan Delaney { HID_USB_DEVICE(USB_VENDOR_ID_DREAM_CHEEKY, 0x000a) }, 1791d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_ESSENTIAL_REALITY, USB_DEVICE_ID_ESSENTIAL_REALITY_P5) }, 179270c66567d1e41d8b2186a2d198997a1c8d79c0c4Petr Štetiar { HID_USB_DEVICE(USB_VENDOR_ID_ETT, USB_DEVICE_ID_TC5UH) }, 1793df506f2c0023380ffa67a946fa36eee4150773a3Petr Štetiar { HID_USB_DEVICE(USB_VENDOR_ID_ETT, USB_DEVICE_ID_TC4UM) }, 1794b1807719f6acdf18cc4bde3b5400d05d77801494Benjamin Tissoires { HID_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH, 0x0001) }, 1795d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH, 0x0002) }, 1796d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH, 0x0004) }, 1797d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GLAB, USB_DEVICE_ID_4_PHIDGETSERVO_30) }, 1798d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GLAB, USB_DEVICE_ID_1_PHIDGETSERVO_30) }, 1799d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GLAB, USB_DEVICE_ID_0_0_4_IF_KIT) }, 1800d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GLAB, USB_DEVICE_ID_0_16_16_IF_KIT) }, 1801d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GLAB, USB_DEVICE_ID_8_8_8_IF_KIT) }, 1802d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GLAB, USB_DEVICE_ID_0_8_7_IF_KIT) }, 1803d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GLAB, USB_DEVICE_ID_0_8_8_IF_KIT) }, 1804d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GLAB, USB_DEVICE_ID_PHIDGET_MOTORCONTROL) }, 1805d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GOTOP, USB_DEVICE_ID_SUPER_Q2) }, 1806d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GOTOP, USB_DEVICE_ID_GOGOPEN) }, 1807d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GOTOP, USB_DEVICE_ID_PENPOWER) }, 1808d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GRETAGMACBETH, USB_DEVICE_ID_GRETAGMACBETH_HUEY) }, 1809d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GRIFFIN, USB_DEVICE_ID_POWERMATE) }, 1810d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GRIFFIN, USB_DEVICE_ID_SOUNDKNOB) }, 1811d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_90) }, 1812d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_100) }, 1813d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_101) }, 1814d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_103) }, 1815d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_104) }, 1816d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_105) }, 1817d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_106) }, 1818d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_107) }, 1819d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_108) }, 1820d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_200) }, 1821d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_201) }, 1822d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_202) }, 1823d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_203) }, 1824d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_204) }, 1825d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_205) }, 1826d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_206) }, 1827d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_207) }, 1828d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_300) }, 1829d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_301) }, 1830d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_302) }, 1831d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_303) }, 1832d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_304) }, 1833d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_305) }, 1834d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_306) }, 1835d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_307) }, 1836d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_308) }, 1837d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_309) }, 1838d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_400) }, 1839d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_401) }, 1840d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_402) }, 1841d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_403) }, 1842d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_404) }, 1843d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_405) }, 1844d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_500) }, 1845d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_501) }, 1846d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_502) }, 1847d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_503) }, 1848d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_504) }, 1849d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1000) }, 1850d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1001) }, 1851d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1002) }, 1852d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1003) }, 1853d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1004) }, 1854d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1005) }, 1855d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1006) }, 1856d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1007) }, 1857d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_IMATION, USB_DEVICE_ID_DISC_STAKKA) }, 1858d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_KBGEAR, USB_DEVICE_ID_KBGEAR_JAMSTUDIO) }, 1859c91c21c5a6facddce936d82e5bc0c655d04288aaAlexey Klimov { HID_USB_DEVICE(USB_VENDOR_ID_KWORLD, USB_DEVICE_ID_KWORLD_RADIO_FM700) }, 1860d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_GPEN_560) }, 1861eb8141ccd32d422fa11c6e2108cae4c40456d811Lamarque Vieira Souza { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_KYE, 0x0058) }, 1862d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_CASSY) }, 1863ce97cac813340eb8ecb1c5410041c9eade58f870Michael Hund { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_CASSY2) }, 1864d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_POCKETCASSY) }, 1865ce97cac813340eb8ecb1c5410041c9eade58f870Michael Hund { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_POCKETCASSY2) }, 1866d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MOBILECASSY) }, 1867ce97cac813340eb8ecb1c5410041c9eade58f870Michael Hund { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MOBILECASSY2) }, 1868ce97cac813340eb8ecb1c5410041c9eade58f870Michael Hund { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MICROCASSYVOLTAGE) }, 1869ce97cac813340eb8ecb1c5410041c9eade58f870Michael Hund { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MICROCASSYCURRENT) }, 1870ce97cac813340eb8ecb1c5410041c9eade58f870Michael Hund { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MICROCASSYTIME) }, 1871ce97cac813340eb8ecb1c5410041c9eade58f870Michael Hund { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MICROCASSYTEMPERATURE) }, 1872ce97cac813340eb8ecb1c5410041c9eade58f870Michael Hund { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MICROCASSYPH) }, 1873d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_JWM) }, 1874d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_DMMP) }, 1875d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_UMIP) }, 1876ce97cac813340eb8ecb1c5410041c9eade58f870Michael Hund { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_UMIC) }, 1877ce97cac813340eb8ecb1c5410041c9eade58f870Michael Hund { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_UMIB) }, 1878ce97cac813340eb8ecb1c5410041c9eade58f870Michael Hund { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_XRAY) }, 1879d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_XRAY2) }, 1880d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_VIDEOCOM) }, 1881ce97cac813340eb8ecb1c5410041c9eade58f870Michael Hund { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MOTOR) }, 1882d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_COM3LAB) }, 1883d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_TELEPORT) }, 1884d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_NETWORKANALYSER) }, 1885d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_POWERCONTROL) }, 1886d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MACHINETEST) }, 1887ce97cac813340eb8ecb1c5410041c9eade58f870Michael Hund { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MOSTANALYSER) }, 1888ce97cac813340eb8ecb1c5410041c9eade58f870Michael Hund { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MOSTANALYSER2) }, 1889ce97cac813340eb8ecb1c5410041c9eade58f870Michael Hund { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_ABSESP) }, 1890ce97cac813340eb8ecb1c5410041c9eade58f870Michael Hund { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_AUTODATABUS) }, 1891ce97cac813340eb8ecb1c5410041c9eade58f870Michael Hund { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MCT) }, 1892ce97cac813340eb8ecb1c5410041c9eade58f870Michael Hund { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_HYBRID) }, 1893ce97cac813340eb8ecb1c5410041c9eade58f870Michael Hund { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_HEATCONTROL) }, 1894d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_MCC, USB_DEVICE_ID_MCC_PMD1024LS) }, 1895d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_MCC, USB_DEVICE_ID_MCC_PMD1208LS) }, 1896d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICKIT1) }, 1897d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICKIT2) }, 1898d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_NATIONAL_SEMICONDUCTOR, USB_DEVICE_ID_N_S_HARMONY) }, 1899d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100) }, 1900d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 20) }, 1901d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 30) }, 1902d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 100) }, 1903d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 108) }, 1904d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 118) }, 1905d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 200) }, 1906d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 300) }, 1907d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 400) }, 1908d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 500) }, 1909d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_PANJIT, 0x0001) }, 1910d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_PANJIT, 0x0002) }, 1911d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_PANJIT, 0x0003) }, 1912d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_PANJIT, 0x0004) }, 19134cfae3e80431fd113f0f4a8e1d4fff84aafe045cHenning Glawe { HID_USB_DEVICE(USB_VENDOR_ID_PHILIPS, USB_DEVICE_ID_PHILIPS_IEEE802154_DONGLE) }, 191435cfd1d964f3c2420862f2167a0eb85ff1208999Michael Tokarev { HID_USB_DEVICE(USB_VENDOR_ID_POWERCOM, USB_DEVICE_ID_POWERCOM_UPS) }, 1915d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_LABPRO) }, 1916d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_GOTEMP) }, 1917d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_SKIP) }, 1918d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_CYCLOPS) }, 1919d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_LCSPEC) }, 1920d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_WACOM, HID_ANY_ID) }, 1921d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_4_PHIDGETSERVO_20) }, 1922d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_1_PHIDGETSERVO_20) }, 1923d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_8_8_4_IF_KIT) }, 1924d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_YEALINK, USB_DEVICE_ID_YEALINK_P1K_P4K_B2K) }, 1925d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby { } 1926d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby}; 1927d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby 1928b4d8e4736c94e78fd846dca0c95a3a0710582584Jiri Slaby/** 1929b4d8e4736c94e78fd846dca0c95a3a0710582584Jiri Slaby * hid_mouse_ignore_list - mouse devices which should not be handled by the hid layer 1930b4d8e4736c94e78fd846dca0c95a3a0710582584Jiri Slaby * 1931b4d8e4736c94e78fd846dca0c95a3a0710582584Jiri Slaby * There are composite devices for which we want to ignore only a certain 1932b4d8e4736c94e78fd846dca0c95a3a0710582584Jiri Slaby * interface. This is a list of devices for which only the mouse interface will 1933b4d8e4736c94e78fd846dca0c95a3a0710582584Jiri Slaby * be ignored. This allows a dedicated driver to take care of the interface. 1934b4d8e4736c94e78fd846dca0c95a3a0710582584Jiri Slaby */ 1935b4d8e4736c94e78fd846dca0c95a3a0710582584Jiri Slabystatic const struct hid_device_id hid_mouse_ignore_list[] = { 1936b4d8e4736c94e78fd846dca0c95a3a0710582584Jiri Slaby /* appletouch driver */ 1937b4d8e4736c94e78fd846dca0c95a3a0710582584Jiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ANSI) }, 1938b4d8e4736c94e78fd846dca0c95a3a0710582584Jiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ISO) }, 1939b4d8e4736c94e78fd846dca0c95a3a0710582584Jiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ANSI) }, 1940b4d8e4736c94e78fd846dca0c95a3a0710582584Jiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ISO) }, 1941b4d8e4736c94e78fd846dca0c95a3a0710582584Jiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_JIS) }, 1942b4d8e4736c94e78fd846dca0c95a3a0710582584Jiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ANSI) }, 1943b4d8e4736c94e78fd846dca0c95a3a0710582584Jiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ISO) }, 1944b4d8e4736c94e78fd846dca0c95a3a0710582584Jiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_JIS) }, 1945b4d8e4736c94e78fd846dca0c95a3a0710582584Jiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ANSI) }, 1946b4d8e4736c94e78fd846dca0c95a3a0710582584Jiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ISO) }, 1947b4d8e4736c94e78fd846dca0c95a3a0710582584Jiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_JIS) }, 1948b4d8e4736c94e78fd846dca0c95a3a0710582584Jiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ANSI) }, 1949b4d8e4736c94e78fd846dca0c95a3a0710582584Jiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ISO) }, 1950b4d8e4736c94e78fd846dca0c95a3a0710582584Jiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_JIS) }, 1951b4d8e4736c94e78fd846dca0c95a3a0710582584Jiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ANSI) }, 1952b4d8e4736c94e78fd846dca0c95a3a0710582584Jiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ISO) }, 1953b4d8e4736c94e78fd846dca0c95a3a0710582584Jiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_JIS) }, 1954b4d8e4736c94e78fd846dca0c95a3a0710582584Jiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_ANSI) }, 1955b4d8e4736c94e78fd846dca0c95a3a0710582584Jiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_ISO) }, 1956b4d8e4736c94e78fd846dca0c95a3a0710582584Jiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_JIS) }, 1957ac26fca3e14c8882e382daa7e96ab73e0186cf03Jiri Kosina { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI) }, 1958ac26fca3e14c8882e382daa7e96ab73e0186cf03Jiri Kosina { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ISO) }, 1959ac26fca3e14c8882e382daa7e96ab73e0186cf03Jiri Kosina { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_JIS) }, 196099b9f758bbc904f22faffcf4d83205f4a5e7bc0cEdgar (gimli) Hucek { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI) }, 196199b9f758bbc904f22faffcf4d83205f4a5e7bc0cEdgar (gimli) Hucek { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_ISO) }, 196299b9f758bbc904f22faffcf4d83205f4a5e7bc0cEdgar (gimli) Hucek { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_JIS) }, 196399b9f758bbc904f22faffcf4d83205f4a5e7bc0cEdgar (gimli) Hucek { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_ANSI) }, 196499b9f758bbc904f22faffcf4d83205f4a5e7bc0cEdgar (gimli) Hucek { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_ISO) }, 196599b9f758bbc904f22faffcf4d83205f4a5e7bc0cEdgar (gimli) Hucek { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS) }, 196647340bd9fefb571888836da942b5aee0e85e959cAndy Botting { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_ANSI) }, 196747340bd9fefb571888836da942b5aee0e85e959cAndy Botting { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_ISO) }, 196847340bd9fefb571888836da942b5aee0e85e959cAndy Botting { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_JIS) }, 1969213f9da80533940560bef8fa43b10c590895459cGökçen Eraslan { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_ANSI) }, 1970213f9da80533940560bef8fa43b10c590895459cGökçen Eraslan { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_ISO) }, 1971213f9da80533940560bef8fa43b10c590895459cGökçen Eraslan { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_JIS) }, 19724b086910ad1b889ddf3ef5598caec03178cf2bb4Jiri Kosina { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6_ANSI) }, 19734b086910ad1b889ddf3ef5598caec03178cf2bb4Jiri Kosina { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6_ISO) }, 19744b086910ad1b889ddf3ef5598caec03178cf2bb4Jiri Kosina { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6_JIS) }, 19754b086910ad1b889ddf3ef5598caec03178cf2bb4Jiri Kosina { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_ANSI) }, 19764b086910ad1b889ddf3ef5598caec03178cf2bb4Jiri Kosina { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_ISO) }, 19774b086910ad1b889ddf3ef5598caec03178cf2bb4Jiri Kosina { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_JIS) }, 1978b4d8e4736c94e78fd846dca0c95a3a0710582584Jiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) }, 1979b4d8e4736c94e78fd846dca0c95a3a0710582584Jiri Slaby { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) }, 1980b4d8e4736c94e78fd846dca0c95a3a0710582584Jiri Slaby { } 1981b4d8e4736c94e78fd846dca0c95a3a0710582584Jiri Slaby}; 1982b4d8e4736c94e78fd846dca0c95a3a0710582584Jiri Slaby 1983d458a9dfc4de24870b8c747484b1988726534beeJiri Slabystatic bool hid_ignore(struct hid_device *hdev) 1984d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby{ 1985d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby switch (hdev->vendor) { 1986d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby case USB_VENDOR_ID_CODEMERCS: 1987d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby /* ignore all Code Mercenaries IOWarrior devices */ 1988d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby if (hdev->product >= USB_DEVICE_ID_CODEMERCS_IOW_FIRST && 1989d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby hdev->product <= USB_DEVICE_ID_CODEMERCS_IOW_LAST) 1990d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby return true; 1991d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby break; 1992d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby case USB_VENDOR_ID_LOGITECH: 1993d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby if (hdev->product >= USB_DEVICE_ID_LOGITECH_HARMONY_FIRST && 1994d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby hdev->product <= USB_DEVICE_ID_LOGITECH_HARMONY_LAST) 1995d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby return true; 1996d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby break; 199731f7fd795d17b264c3c05e4a976f963012c17c68Jarod Wilson case USB_VENDOR_ID_SOUNDGRAPH: 199831f7fd795d17b264c3c05e4a976f963012c17c68Jarod Wilson if (hdev->product >= USB_DEVICE_ID_SOUNDGRAPH_IMON_FIRST && 199931f7fd795d17b264c3c05e4a976f963012c17c68Jarod Wilson hdev->product <= USB_DEVICE_ID_SOUNDGRAPH_IMON_LAST) 200031f7fd795d17b264c3c05e4a976f963012c17c68Jarod Wilson return true; 200131f7fd795d17b264c3c05e4a976f963012c17c68Jarod Wilson break; 2002bba5394ad3bd23fff6987fc8bc3aaf9d12433c63Xing Wei case USB_VENDOR_ID_HANWANG: 2003bba5394ad3bd23fff6987fc8bc3aaf9d12433c63Xing Wei if (hdev->product >= USB_DEVICE_ID_HANWANG_TABLET_FIRST && 2004bba5394ad3bd23fff6987fc8bc3aaf9d12433c63Xing Wei hdev->product <= USB_DEVICE_ID_HANWANG_TABLET_LAST) 2005bba5394ad3bd23fff6987fc8bc3aaf9d12433c63Xing Wei return true; 2006bba5394ad3bd23fff6987fc8bc3aaf9d12433c63Xing Wei break; 20076dc1418e13144162e8bc4858789010d8f0e1e65cTomoki Sekiyama case USB_VENDOR_ID_JESS: 20086dc1418e13144162e8bc4858789010d8f0e1e65cTomoki Sekiyama if (hdev->product == USB_DEVICE_ID_JESS_YUREX && 20096dc1418e13144162e8bc4858789010d8f0e1e65cTomoki Sekiyama hdev->type == HID_TYPE_USBNONE) 20106dc1418e13144162e8bc4858789010d8f0e1e65cTomoki Sekiyama return true; 20116dc1418e13144162e8bc4858789010d8f0e1e65cTomoki Sekiyama break; 2012d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby } 2013d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby 2014b4d8e4736c94e78fd846dca0c95a3a0710582584Jiri Slaby if (hdev->type == HID_TYPE_USBMOUSE && 2015b4d8e4736c94e78fd846dca0c95a3a0710582584Jiri Slaby hid_match_id(hdev, hid_mouse_ignore_list)) 2016b4d8e4736c94e78fd846dca0c95a3a0710582584Jiri Slaby return true; 2017b4d8e4736c94e78fd846dca0c95a3a0710582584Jiri Slaby 2018d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby return !!hid_match_id(hdev, hid_ignore_list); 2019d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby} 2020d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby 202185cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slabyint hid_add_device(struct hid_device *hdev) 202285cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby{ 202385cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby static atomic_t id = ATOMIC_INIT(0); 202485cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby int ret; 202585cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby 202685cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby if (WARN_ON(hdev->status & HID_STAT_ADDED)) 202785cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby return -EBUSY; 202885cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby 2029d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby /* we need to kill them here, otherwise they will stay allocated to 2030d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby * wait for coming driver */ 2031e5a2a04c264e693eafcc78fec5add34c9e15e471Jindrich Makovicka if (!(hdev->quirks & HID_QUIRK_NO_IGNORE) 2032e5a2a04c264e693eafcc78fec5add34c9e15e471Jindrich Makovicka && (hid_ignore(hdev) || (hdev->quirks & HID_QUIRK_IGNORE))) 2033d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby return -ENODEV; 2034d458a9dfc4de24870b8c747484b1988726534beeJiri Slaby 20356bbe586fd4d94439f3960e200056ff057f7db5c6Kay Sievers /* XXX hack, any other cleaner solution after the driver core 20366bbe586fd4d94439f3960e200056ff057f7db5c6Kay Sievers * is converted to allow more than 20 bytes as the device name? */ 20376bbe586fd4d94439f3960e200056ff057f7db5c6Kay Sievers dev_set_name(&hdev->dev, "%04X:%04X:%04X.%04X", hdev->bus, 20386bbe586fd4d94439f3960e200056ff057f7db5c6Kay Sievers hdev->vendor, hdev->product, atomic_inc_return(&id)); 203985cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby 20404da361b69102cdffe73006771eae7504d2cb8736Bruno Prémont hid_debug_register(hdev, dev_name(&hdev->dev)); 204185cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby ret = device_add(&hdev->dev); 204285cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby if (!ret) 204385cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby hdev->status |= HID_STAT_ADDED; 20444da361b69102cdffe73006771eae7504d2cb8736Bruno Prémont else 20454da361b69102cdffe73006771eae7504d2cb8736Bruno Prémont hid_debug_unregister(hdev); 2046a635f9dd83f3382577f4544a96df12356e951a40Jiri Kosina 204785cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby return ret; 204885cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby} 204985cdaf524b7ddab627e7d15405693f2511ef7505Jiri SlabyEXPORT_SYMBOL_GPL(hid_add_device); 205085cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby 205185cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby/** 205285cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby * hid_allocate_device - allocate new hid device descriptor 205385cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby * 205485cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby * Allocate and initialize hid device, so that hid_destroy_device might be 205585cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby * used to free it. 205685cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby * 205785cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby * New hid_device pointer is returned on success, otherwise ERR_PTR encoded 205885cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby * error value. 205985cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby */ 206085cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slabystruct hid_device *hid_allocate_device(void) 206185cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby{ 206285cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby struct hid_device *hdev; 206385cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby unsigned int i; 206485cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby int ret = -ENOMEM; 206585cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby 206685cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby hdev = kzalloc(sizeof(*hdev), GFP_KERNEL); 206785cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby if (hdev == NULL) 206885cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby return ERR_PTR(ret); 206985cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby 207085cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby device_initialize(&hdev->dev); 207185cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby hdev->dev.release = hid_device_release; 207285cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby hdev->dev.bus = &hid_bus_type; 207385cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby 207485cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby hdev->collection = kcalloc(HID_DEFAULT_NUM_COLLECTIONS, 207585cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby sizeof(struct hid_collection), GFP_KERNEL); 207685cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby if (hdev->collection == NULL) 207785cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby goto err; 207885cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby hdev->collection_size = HID_DEFAULT_NUM_COLLECTIONS; 207985cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby 208085cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby for (i = 0; i < HID_REPORT_TYPES; i++) 208185cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby INIT_LIST_HEAD(&hdev->report_enum[i].report_list); 208285cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby 2083cd667ce24796700e1a0e6e7528efc61c96ff832eJiri Kosina init_waitqueue_head(&hdev->debug_wait); 2084cd667ce24796700e1a0e6e7528efc61c96ff832eJiri Kosina INIT_LIST_HEAD(&hdev->debug_list); 20854ea5454203d991ec85264f64f89ca8855fce69b0David Herrmann sema_init(&hdev->driver_lock, 1); 2086cd667ce24796700e1a0e6e7528efc61c96ff832eJiri Kosina 208785cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby return hdev; 208885cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slabyerr: 208985cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby put_device(&hdev->dev); 209085cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby return ERR_PTR(ret); 209185cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby} 209285cdaf524b7ddab627e7d15405693f2511ef7505Jiri SlabyEXPORT_SYMBOL_GPL(hid_allocate_device); 209385cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby 209485cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slabystatic void hid_remove_device(struct hid_device *hdev) 209585cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby{ 209685cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby if (hdev->status & HID_STAT_ADDED) { 209785cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby device_del(&hdev->dev); 2098a635f9dd83f3382577f4544a96df12356e951a40Jiri Kosina hid_debug_unregister(hdev); 209985cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby hdev->status &= ~HID_STAT_ADDED; 210085cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby } 210185cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby} 210285cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby 210385cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby/** 210485cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby * hid_destroy_device - free previously allocated device 210585cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby * 210685cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby * @hdev: hid device 210785cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby * 210885cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby * If you allocate hid_device through hid_allocate_device, you should ever 210985cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby * free by this function. 211085cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby */ 211185cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slabyvoid hid_destroy_device(struct hid_device *hdev) 211285cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby{ 211385cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby hid_remove_device(hdev); 211485cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby put_device(&hdev->dev); 211585cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby} 211685cdaf524b7ddab627e7d15405693f2511ef7505Jiri SlabyEXPORT_SYMBOL_GPL(hid_destroy_device); 211785cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby 211885cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slabyint __hid_register_driver(struct hid_driver *hdrv, struct module *owner, 211985cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby const char *mod_name) 212085cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby{ 21213a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby int ret; 21223a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby 212385cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby hdrv->driver.name = hdrv->name; 212485cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby hdrv->driver.bus = &hid_bus_type; 212585cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby hdrv->driver.owner = owner; 212685cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby hdrv->driver.mod_name = mod_name; 212785cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby 21283a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby INIT_LIST_HEAD(&hdrv->dyn_list); 21293a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby spin_lock_init(&hdrv->dyn_lock); 21303a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby 21313a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby ret = driver_register(&hdrv->driver); 21323a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby if (ret) 21333a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby return ret; 21343a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby 21353a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby ret = driver_create_file(&hdrv->driver, &driver_attr_new_id); 21363a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby if (ret) 21373a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby driver_unregister(&hdrv->driver); 21383a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby 21393a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby return ret; 214085cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby} 214185cdaf524b7ddab627e7d15405693f2511ef7505Jiri SlabyEXPORT_SYMBOL_GPL(__hid_register_driver); 214285cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby 214385cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slabyvoid hid_unregister_driver(struct hid_driver *hdrv) 214485cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby{ 21453a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby driver_remove_file(&hdrv->driver, &driver_attr_new_id); 214685cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby driver_unregister(&hdrv->driver); 21473a6f82f7a22cf19687f556997c6978b31c109360Jiri Slaby hid_free_dynids(hdrv); 214885cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby} 214985cdaf524b7ddab627e7d15405693f2511ef7505Jiri SlabyEXPORT_SYMBOL_GPL(hid_unregister_driver); 215085cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby 21510361a28d3f9a4315a100c7b37ba0b55cfe15fe07Oliver Neukumint hid_check_keys_pressed(struct hid_device *hid) 21520361a28d3f9a4315a100c7b37ba0b55cfe15fe07Oliver Neukum{ 21530361a28d3f9a4315a100c7b37ba0b55cfe15fe07Oliver Neukum struct hid_input *hidinput; 21540361a28d3f9a4315a100c7b37ba0b55cfe15fe07Oliver Neukum int i; 21550361a28d3f9a4315a100c7b37ba0b55cfe15fe07Oliver Neukum 2156e5288eb5ea89bd82d897cb687348bc608278f920Jiri Kosina if (!(hid->claimed & HID_CLAIMED_INPUT)) 2157e5288eb5ea89bd82d897cb687348bc608278f920Jiri Kosina return 0; 2158e5288eb5ea89bd82d897cb687348bc608278f920Jiri Kosina 21590361a28d3f9a4315a100c7b37ba0b55cfe15fe07Oliver Neukum list_for_each_entry(hidinput, &hid->inputs, list) { 21600361a28d3f9a4315a100c7b37ba0b55cfe15fe07Oliver Neukum for (i = 0; i < BITS_TO_LONGS(KEY_MAX); i++) 21610361a28d3f9a4315a100c7b37ba0b55cfe15fe07Oliver Neukum if (hidinput->input->key[i]) 21620361a28d3f9a4315a100c7b37ba0b55cfe15fe07Oliver Neukum return 1; 21630361a28d3f9a4315a100c7b37ba0b55cfe15fe07Oliver Neukum } 21640361a28d3f9a4315a100c7b37ba0b55cfe15fe07Oliver Neukum 21650361a28d3f9a4315a100c7b37ba0b55cfe15fe07Oliver Neukum return 0; 21660361a28d3f9a4315a100c7b37ba0b55cfe15fe07Oliver Neukum} 21670361a28d3f9a4315a100c7b37ba0b55cfe15fe07Oliver Neukum 21680361a28d3f9a4315a100c7b37ba0b55cfe15fe07Oliver NeukumEXPORT_SYMBOL_GPL(hid_check_keys_pressed); 21690361a28d3f9a4315a100c7b37ba0b55cfe15fe07Oliver Neukum 217086166b7bcda0bcb53525114fa1c87ac432be478eJiri Kosinastatic int __init hid_init(void) 217186166b7bcda0bcb53525114fa1c87ac432be478eJiri Kosina{ 217285cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby int ret; 217385cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby 2174a635f9dd83f3382577f4544a96df12356e951a40Jiri Kosina if (hid_debug) 21754291ee305e9bb0699504a66f0e2b7aefcf0512a5Joe Perches pr_warn("hid_debug is now used solely for parser and driver debugging.\n" 21764291ee305e9bb0699504a66f0e2b7aefcf0512a5Joe Perches "debugfs is now used for inspecting the device (report descriptor, reports)\n"); 2177a635f9dd83f3382577f4544a96df12356e951a40Jiri Kosina 217885cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby ret = bus_register(&hid_bus_type); 217985cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby if (ret) { 21804291ee305e9bb0699504a66f0e2b7aefcf0512a5Joe Perches pr_err("can't register hid bus\n"); 218185cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby goto err; 218285cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby } 218385cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby 218485cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby ret = hidraw_init(); 218585cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby if (ret) 218685cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby goto err_bus; 218785cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby 2188a635f9dd83f3382577f4544a96df12356e951a40Jiri Kosina hid_debug_init(); 2189a635f9dd83f3382577f4544a96df12356e951a40Jiri Kosina 219085cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby return 0; 219185cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slabyerr_bus: 219285cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby bus_unregister(&hid_bus_type); 219385cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slabyerr: 219485cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby return ret; 219586166b7bcda0bcb53525114fa1c87ac432be478eJiri Kosina} 219686166b7bcda0bcb53525114fa1c87ac432be478eJiri Kosina 219786166b7bcda0bcb53525114fa1c87ac432be478eJiri Kosinastatic void __exit hid_exit(void) 219886166b7bcda0bcb53525114fa1c87ac432be478eJiri Kosina{ 2199a635f9dd83f3382577f4544a96df12356e951a40Jiri Kosina hid_debug_exit(); 220086166b7bcda0bcb53525114fa1c87ac432be478eJiri Kosina hidraw_exit(); 220185cdaf524b7ddab627e7d15405693f2511ef7505Jiri Slaby bus_unregister(&hid_bus_type); 220286166b7bcda0bcb53525114fa1c87ac432be478eJiri Kosina} 220386166b7bcda0bcb53525114fa1c87ac432be478eJiri Kosina 220486166b7bcda0bcb53525114fa1c87ac432be478eJiri Kosinamodule_init(hid_init); 220586166b7bcda0bcb53525114fa1c87ac432be478eJiri Kosinamodule_exit(hid_exit); 220686166b7bcda0bcb53525114fa1c87ac432be478eJiri Kosina 220788adb72bcf3b1cc6b440fda9fa97bc2151245fc5Jiri KosinaMODULE_AUTHOR("Andreas Gal"); 220888adb72bcf3b1cc6b440fda9fa97bc2151245fc5Jiri KosinaMODULE_AUTHOR("Vojtech Pavlik"); 220988adb72bcf3b1cc6b440fda9fa97bc2151245fc5Jiri KosinaMODULE_AUTHOR("Jiri Kosina"); 2210aa938f7974b82cfd9ee955031987344f332b7c77Jiri KosinaMODULE_LICENSE(DRIVER_LICENSE); 2211aa938f7974b82cfd9ee955031987344f332b7c77Jiri Kosina 2212