[62bd8d3] | 1 | /*
|
---|
| 2 | * Copyright (c) 2011 Lubos Slovak
|
---|
| 3 | * All rights reserved.
|
---|
| 4 | *
|
---|
| 5 | * Redistribution and use in source and binary forms, with or without
|
---|
| 6 | * modification, are permitted provided that the following conditions
|
---|
| 7 | * are met:
|
---|
| 8 | *
|
---|
| 9 | * - Redistributions of source code must retain the above copyright
|
---|
| 10 | * notice, this list of conditions and the following disclaimer.
|
---|
| 11 | * - Redistributions in binary form must reproduce the above copyright
|
---|
| 12 | * notice, this list of conditions and the following disclaimer in the
|
---|
| 13 | * documentation and/or other materials provided with the distribution.
|
---|
| 14 | * - The name of the author may not be used to endorse or promote products
|
---|
| 15 | * derived from this software without specific prior written permission.
|
---|
| 16 | *
|
---|
| 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
---|
| 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
---|
| 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
---|
| 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
---|
| 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
---|
| 22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
---|
| 23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
---|
| 24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
---|
| 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
---|
| 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
---|
| 27 | */
|
---|
| 28 |
|
---|
| 29 | /** @addtogroup drvusbhid
|
---|
| 30 | * @{
|
---|
| 31 | */
|
---|
| 32 | /** @file
|
---|
| 33 | * USB HID subdriver mappings.
|
---|
| 34 | */
|
---|
| 35 |
|
---|
| 36 | #ifndef USB_HID_SUBDRIVERS_H_
|
---|
| 37 | #define USB_HID_SUBDRIVERS_H_
|
---|
| 38 |
|
---|
| 39 | #include "usbhid.h"
|
---|
| 40 | #include "kbd/kbddev.h"
|
---|
| 41 |
|
---|
| 42 | typedef struct usb_hid_subdriver_usage {
|
---|
| 43 | int usage_page;
|
---|
| 44 | int usage;
|
---|
| 45 | } usb_hid_subdriver_usage_t;
|
---|
| 46 |
|
---|
[378bf85] | 47 | /** Structure representing the mapping between device requirements and the
|
---|
[083adbc] | 48 | * subdriver supposed to handle this device.
|
---|
| 49 | *
|
---|
| 50 | * By filling in this structure and adding it to the usb_hid_subdrivers array,
|
---|
| 51 | * a new subdriver mapping will be created and used by the HID driver when it
|
---|
| 52 | * searches for appropriate subdrivers for a device.
|
---|
[378bf85] | 53 | *
|
---|
[f76153ce] | 54 | */
|
---|
[62bd8d3] | 55 | typedef struct usb_hid_subdriver_mapping {
|
---|
[378bf85] | 56 | /** Usage path that the device's input reports must contain.
|
---|
[083adbc] | 57 | *
|
---|
| 58 | * It is an array of pairs <usage_page, usage>, terminated by a <0, 0>
|
---|
| 59 | * pair. If you do not wish to specify the device in this way, set this
|
---|
| 60 | * to NULL.
|
---|
| 61 | */
|
---|
[62bd8d3] | 62 | const usb_hid_subdriver_usage_t *usage_path;
|
---|
[a35b458] | 63 |
|
---|
[083adbc] | 64 | /** Report ID for which the path should apply. */
|
---|
[e3b5129] | 65 | int report_id;
|
---|
[a35b458] | 66 |
|
---|
[378bf85] | 67 | /** Compare type for the usage path. */
|
---|
[62bd8d3] | 68 | int compare;
|
---|
[a35b458] | 69 |
|
---|
[083adbc] | 70 | /** Vendor ID (set to -1 if not specified). */
|
---|
[d0a6e54] | 71 | int vendor_id;
|
---|
[a35b458] | 72 |
|
---|
[083adbc] | 73 | /** Product ID (set to -1 if not specified). */
|
---|
[d0a6e54] | 74 | int product_id;
|
---|
[a35b458] | 75 |
|
---|
[083adbc] | 76 | /** Subdriver for controlling this device. */
|
---|
[3f8f09f] | 77 | const usb_hid_subdriver_t subdriver;
|
---|
[62bd8d3] | 78 | } usb_hid_subdriver_mapping_t;
|
---|
| 79 |
|
---|
| 80 | extern const usb_hid_subdriver_mapping_t usb_hid_subdrivers[];
|
---|
[07b9cbae] | 81 | extern const size_t USB_HID_MAX_SUBDRIVERS;
|
---|
[62bd8d3] | 82 |
|
---|
| 83 | #endif /* USB_HID_SUBDRIVERS_H_ */
|
---|
| 84 |
|
---|
| 85 | /**
|
---|
| 86 | * @}
|
---|
| 87 | */
|
---|