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 | #include "subdrivers.h"
|
---|
37 | #include <usb/hid/usages/core.h>
|
---|
38 | #include <usb/hid/hidpath.h>
|
---|
39 | #include "kbd/kbddev.h"
|
---|
40 | #include "mouse/mousedev.h"
|
---|
41 | #include "multimedia/multimedia.h"
|
---|
42 | #include "blink1/blink1.h"
|
---|
43 | #include "generic/hiddev.h"
|
---|
44 |
|
---|
45 | static const usb_hid_subdriver_usage_t path_kbd[] = {
|
---|
46 | {
|
---|
47 | USB_HIDUT_PAGE_GENERIC_DESKTOP,
|
---|
48 | USB_HIDUT_USAGE_GENERIC_DESKTOP_KEYBOARD
|
---|
49 | },
|
---|
50 | {0, 0}
|
---|
51 | };
|
---|
52 |
|
---|
53 | static const usb_hid_subdriver_usage_t path_mouse[] = {
|
---|
54 | {
|
---|
55 | USB_HIDUT_PAGE_GENERIC_DESKTOP,
|
---|
56 | USB_HIDUT_USAGE_GENERIC_DESKTOP_MOUSE
|
---|
57 | },
|
---|
58 | {0, 0}
|
---|
59 | };
|
---|
60 |
|
---|
61 | static const usb_hid_subdriver_usage_t path_multim_key[] = {
|
---|
62 | {
|
---|
63 | USB_HIDUT_PAGE_CONSUMER,
|
---|
64 | USB_HIDUT_USAGE_CONSUMER_CONSUMER_CONTROL
|
---|
65 | },
|
---|
66 | {0, 0}
|
---|
67 | };
|
---|
68 |
|
---|
69 | const usb_hid_subdriver_mapping_t usb_hid_subdrivers[] = {
|
---|
70 | {
|
---|
71 | path_kbd,
|
---|
72 | 0,
|
---|
73 | USB_HID_PATH_COMPARE_BEGIN,
|
---|
74 | -1,
|
---|
75 | -1,
|
---|
76 | {
|
---|
77 | .init = usb_kbd_init,
|
---|
78 | .deinit = usb_kbd_deinit,
|
---|
79 | .poll = usb_kbd_polling_callback,
|
---|
80 | .poll_end = NULL
|
---|
81 | },
|
---|
82 | },
|
---|
83 | {
|
---|
84 | path_multim_key,
|
---|
85 | 1,
|
---|
86 | USB_HID_PATH_COMPARE_BEGIN,
|
---|
87 | -1,
|
---|
88 | -1,
|
---|
89 | {
|
---|
90 | .init = usb_multimedia_init,
|
---|
91 | .deinit = usb_multimedia_deinit,
|
---|
92 | .poll = usb_multimedia_polling_callback,
|
---|
93 | .poll_end = NULL
|
---|
94 | }
|
---|
95 | },
|
---|
96 | {
|
---|
97 | path_mouse,
|
---|
98 | 0,
|
---|
99 | USB_HID_PATH_COMPARE_BEGIN,
|
---|
100 | -1,
|
---|
101 | -1,
|
---|
102 | {
|
---|
103 | .init = usb_mouse_init,
|
---|
104 | .deinit = usb_mouse_deinit,
|
---|
105 | .poll = usb_mouse_polling_callback,
|
---|
106 | .poll_end = NULL
|
---|
107 | }
|
---|
108 | },
|
---|
109 | {
|
---|
110 | NULL,
|
---|
111 | 0,
|
---|
112 | USB_HID_PATH_COMPARE_BEGIN,
|
---|
113 | 0x27b8,
|
---|
114 | 0x01ed,
|
---|
115 | {
|
---|
116 | .init = usb_blink1_init,
|
---|
117 | .deinit = usb_blink1_deinit,
|
---|
118 | .poll = NULL,
|
---|
119 | .poll_end = NULL
|
---|
120 | }
|
---|
121 | }
|
---|
122 | };
|
---|
123 |
|
---|
124 | const size_t USB_HID_MAX_SUBDRIVERS =
|
---|
125 | sizeof(usb_hid_subdrivers) / sizeof(usb_hid_subdrivers[0]);
|
---|
126 |
|
---|
127 | /**
|
---|
128 | * @}
|
---|
129 | */
|
---|