OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/events/ozone/evdev/event_device_test_util.h" | 5 #include "ui/events/ozone/evdev/event_device_test_util.h" |
6 | 6 |
7 #include "base/format_macros.h" | 7 #include "base/format_macros.h" |
8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
9 #include "base/strings/string_split.h" | 9 #include "base/strings/string_split.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 | 69 |
70 // Require canonically formatted input. | 70 // Require canonically formatted input. |
71 if (bitfield != SerializeBitfield(out->data(), max_bits)) | 71 if (bitfield != SerializeBitfield(out->data(), max_bits)) |
72 return false; | 72 return false; |
73 | 73 |
74 return true; | 74 return true; |
75 } | 75 } |
76 | 76 |
77 } // namespace | 77 } // namespace |
78 | 78 |
79 // # Script to generate DeviceCapabilities literal. | |
80 // cd /sys/class/input/input? | |
81 // | |
82 // test "$(uname -m)" = x86_64 && cat <<EOF | |
83 // const DeviceCapabilities device = { | |
84 // /* path */ "$(readlink -f .)", | |
85 // /* name */ "$(cat device/name)", | |
86 // /* phys */ "$(cat device/phys)", | |
87 // /* uniq */ "$(cat device/uniq)", | |
88 // /* bustype */ "$(cat device/id/bustype)", | |
89 // /* vendor */ "$(cat device/id/vendor)", | |
90 // /* product */ "$(cat device/id/product)", | |
91 // /* version */ "$(cat device/id/version)", | |
92 // /* prop */ "$(cat device/properties)", | |
93 // /* ev */ "$(cat device/capabilities/ev)", | |
94 // /* key */ "$(cat device/capabilities/key)", | |
95 // /* rel */ "$(cat device/capabilities/rel)", | |
96 // /* abs */ "$(cat device/capabilities/abs)", | |
97 // /* msc */ "$(cat device/capabilities/msc)", | |
98 // /* led */ "$(cat device/capabilities/led)", | |
99 // /* ff */ "$(cat device/capabilities/ff)", | |
100 // }; | |
101 // EOF | |
102 | |
103 // Captured from Chromebook Pixel. | 79 // Captured from Chromebook Pixel. |
104 const DeviceCapabilities kLinkKeyboard = { | 80 const DeviceCapabilities kLinkKeyboard = { |
105 /* path */ "/sys/devices/platform/i8042/serio0/input/input6/event6", | 81 /* path */ "/sys/devices/platform/i8042/serio0/input/input6/event6", |
106 /* name */ "AT Translated Set 2 keyboard", | 82 /* name */ "AT Translated Set 2 keyboard", |
107 /* phys */ "isa0060/serio0/input0", | 83 /* phys */ "isa0060/serio0/input0", |
108 /* uniq */ "", | 84 /* uniq */ "", |
109 /* bustype */ "0011", | 85 /* bustype */ "0011", |
110 /* vendor */ "0001", | 86 /* vendor */ "0001", |
111 /* product */ "0001", | 87 /* product */ "0001", |
112 /* version */ "ab83", | 88 /* version */ "ab83", |
113 /* prop */ "0", | 89 /* prop */ "0", |
114 /* ev */ "120013", | 90 /* ev */ "120013", |
115 /* key */ "400402000000 3803078f800d001 feffffdfffefffff fffffffffffffffe", | 91 /* key */ "400402000000 3803078f800d001 feffffdfffefffff fffffffffffffffe", |
116 /* rel */ "0", | 92 /* rel */ "0", |
117 /* abs */ "0", | 93 /* abs */ "0", |
118 /* msc */ "10", | 94 /* msc */ "10", |
| 95 /* sw */ "0", |
119 /* led */ "7", | 96 /* led */ "7", |
120 /* ff */ "0", | 97 /* ff */ "0", |
121 }; | 98 }; |
122 | 99 |
123 // Captured from Chromebook Pixel. | 100 // Captured from Chromebook Pixel. |
| 101 const DeviceAbsoluteAxis kLinkTouchscreenAbsAxes[] = { |
| 102 {ABS_X, {0, 0, 2559, 0, 0, 20}}, |
| 103 {ABS_Y, {0, 0, 1699, 0, 0, 20}}, |
| 104 {ABS_PRESSURE, {0, 0, 255, 0, 0, 0}}, |
| 105 {ABS_MT_SLOT, {0, 0, 15, 0, 0, 0}}, |
| 106 {ABS_MT_TOUCH_MAJOR, {0, 0, 938, 0, 0, 0}}, |
| 107 {ABS_MT_ORIENTATION, {0, -3, 4, 0, 0, 0}}, |
| 108 {ABS_MT_POSITION_X, {0, 0, 2559, 0, 0, 20}}, |
| 109 {ABS_MT_POSITION_Y, {0, 0, 1699, 0, 0, 20}}, |
| 110 {ABS_MT_TRACKING_ID, {0, 0, 65535, 0, 0, 0}}, |
| 111 {ABS_MT_PRESSURE, {0, 0, 255, 0, 0, 0}}, |
| 112 }; |
124 const DeviceCapabilities kLinkTouchscreen = { | 113 const DeviceCapabilities kLinkTouchscreen = { |
125 /* path */ "/sys/devices/pci0000:00/0000:00:02.0/i2c-2/2-004a/" | 114 /* path */ "/sys/devices/pci0000:00/0000:00:02.0/i2c-2/2-004a/" |
126 "input/input7/event7", | 115 "input/input7/event7", |
127 /* name */ "Atmel maXTouch Touchscreen", | 116 /* name */ "Atmel maXTouch Touchscreen", |
128 /* phys */ "i2c-2-004a/input0", | 117 /* phys */ "i2c-2-004a/input0", |
129 /* uniq */ "", | 118 /* uniq */ "", |
130 /* bustype */ "0018", | 119 /* bustype */ "0018", |
131 /* vendor */ "0000", | 120 /* vendor */ "0000", |
132 /* product */ "0000", | 121 /* product */ "0000", |
133 /* version */ "0000", | 122 /* version */ "0000", |
134 /* prop */ "0", | 123 /* prop */ "0", |
135 /* ev */ "b", | 124 /* ev */ "b", |
136 /* key */ "400 0 0 0 0 0", | 125 /* key */ "400 0 0 0 0 0", |
137 /* rel */ "0", | 126 /* rel */ "0", |
138 /* abs */ "671800001000003", | 127 /* abs */ "671800001000003", |
139 /* msc */ "0", | 128 /* msc */ "0", |
| 129 /* sw */ "0", |
140 /* led */ "0", | 130 /* led */ "0", |
141 /* ff */ "0", | 131 /* ff */ "0", |
| 132 kLinkTouchscreenAbsAxes, |
| 133 arraysize(kLinkTouchscreenAbsAxes), |
142 }; | 134 }; |
143 | 135 |
144 // Captured from Chromebook Pixel. | 136 // Captured from Chromebook Pixel. |
| 137 const DeviceAbsoluteAxis kLinkTouchpadAbsAxes[] = { |
| 138 {ABS_X, {0, 0, 2040, 0, 0, 20}}, |
| 139 {ABS_Y, {0, 0, 1360, 0, 0, 20}}, |
| 140 {ABS_PRESSURE, {0, 0, 255, 0, 0, 0}}, |
| 141 {ABS_MT_SLOT, {0, 0, 9, 0, 0, 0}}, |
| 142 {ABS_MT_TOUCH_MAJOR, {0, 0, 1878, 0, 0, 0}}, |
| 143 {ABS_MT_ORIENTATION, {0, -3, 4, 0, 0, 0}}, |
| 144 {ABS_MT_POSITION_X, {0, 0, 2040, 0, 0, 20}}, |
| 145 {ABS_MT_POSITION_Y, {0, 0, 1360, 0, 0, 20}}, |
| 146 {ABS_MT_TRACKING_ID, {0, 0, 65535, 0, 0, 0}}, |
| 147 {ABS_MT_PRESSURE, {0, 0, 255, 0, 0, 0}}, |
| 148 }; |
145 const DeviceCapabilities kLinkTouchpad = { | 149 const DeviceCapabilities kLinkTouchpad = { |
146 /* path */ "/sys/devices/pci0000:00/0000:00:02.0/i2c-1/1-004b/" | 150 /* path */ "/sys/devices/pci0000:00/0000:00:02.0/i2c-1/1-004b/" |
147 "input/input8/event8", | 151 "input/input8/event8", |
148 /* name */ "Atmel maXTouch Touchpad", | 152 /* name */ "Atmel maXTouch Touchpad", |
149 /* phys */ "i2c-1-004b/input0", | 153 /* phys */ "i2c-1-004b/input0", |
150 /* uniq */ "", | 154 /* uniq */ "", |
151 /* bustype */ "0018", | 155 /* bustype */ "0018", |
152 /* vendor */ "0000", | 156 /* vendor */ "0000", |
153 /* product */ "0000", | 157 /* product */ "0000", |
154 /* version */ "0000", | 158 /* version */ "0000", |
155 /* prop */ "5", | 159 /* prop */ "5", |
156 /* ev */ "b", | 160 /* ev */ "b", |
157 /* key */ "e520 10000 0 0 0 0", | 161 /* key */ "e520 10000 0 0 0 0", |
158 /* rel */ "0", | 162 /* rel */ "0", |
159 /* abs */ "671800001000003", | 163 /* abs */ "671800001000003", |
160 /* msc */ "0", | 164 /* msc */ "0", |
| 165 /* sw */ "0", |
161 /* led */ "0", | 166 /* led */ "0", |
162 /* ff */ "0", | 167 /* ff */ "0", |
| 168 kLinkTouchpadAbsAxes, |
| 169 arraysize(kLinkTouchpadAbsAxes), |
163 }; | 170 }; |
164 | 171 |
165 // Captured from generic HP KU-1156 USB keyboard. | 172 // Captured from generic HP KU-1156 USB keyboard. |
166 const DeviceCapabilities kHpUsbKeyboard = { | 173 const DeviceCapabilities kHpUsbKeyboard = { |
167 /* path */ "/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.3/2-1.3:1.0/" | 174 /* path */ "/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.3/2-1.3:1.0/" |
168 "input/input17/event10", | 175 "input/input17/event10", |
169 /* name */ "Chicony HP Elite USB Keyboard", | 176 /* name */ "Chicony HP Elite USB Keyboard", |
170 /* phys */ "usb-0000:00:1d.0-1.3/input0", | 177 /* phys */ "usb-0000:00:1d.0-1.3/input0", |
171 /* uniq */ "", | 178 /* uniq */ "", |
172 /* bustype */ "0003", | 179 /* bustype */ "0003", |
173 /* vendor */ "03f0", | 180 /* vendor */ "03f0", |
174 /* product */ "034a", | 181 /* product */ "034a", |
175 /* version */ "0110", | 182 /* version */ "0110", |
176 /* prop */ "0", | 183 /* prop */ "0", |
177 /* ev */ "120013", | 184 /* ev */ "120013", |
178 /* key */ "1000000000007 ff9f207ac14057ff febeffdfffefffff " | 185 /* key */ "1000000000007 ff9f207ac14057ff febeffdfffefffff " |
179 "fffffffffffffffe", | 186 "fffffffffffffffe", |
180 /* rel */ "0", | 187 /* rel */ "0", |
181 /* abs */ "0", | 188 /* abs */ "0", |
182 /* msc */ "10", | 189 /* msc */ "10", |
| 190 /* sw */ "0", |
183 /* led */ "7", | 191 /* led */ "7", |
184 /* ff */ "0", | 192 /* ff */ "0", |
185 }; | 193 }; |
186 | 194 |
187 // Captured from generic HP KU-1156 USB keyboard (2nd device with media keys). | 195 // Captured from generic HP KU-1156 USB keyboard (2nd device with media keys). |
| 196 const DeviceAbsoluteAxis kHpUsbKeyboard_ExtraAbsAxes[] = { |
| 197 {ABS_VOLUME, {0, 0, 767, 0, 0, 0}}, |
| 198 }; |
188 const DeviceCapabilities kHpUsbKeyboard_Extra = { | 199 const DeviceCapabilities kHpUsbKeyboard_Extra = { |
189 /* path */ "/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.3/2-1.3:1.1/" | 200 /* path */ "/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.3/2-1.3:1.1/" |
190 "input/input18/event16", | 201 "input/input18/event16", |
191 /* name */ "Chicony HP Elite USB Keyboard", | 202 /* name */ "Chicony HP Elite USB Keyboard", |
192 /* phys */ "usb-0000:00:1d.0-1.3/input1", | 203 /* phys */ "usb-0000:00:1d.0-1.3/input1", |
193 /* uniq */ "", | 204 /* uniq */ "", |
194 /* bustype */ "0003", | 205 /* bustype */ "0003", |
195 /* vendor */ "03f0", | 206 /* vendor */ "03f0", |
196 /* product */ "034a", | 207 /* product */ "034a", |
197 /* version */ "0110", | 208 /* version */ "0110", |
198 /* prop */ "0", | 209 /* prop */ "0", |
199 /* ev */ "1f", | 210 /* ev */ "1f", |
200 /* key */ "3007f 0 0 483ffff17aff32d bf54444600000000 1 120f938b17c000 " | 211 /* key */ "3007f 0 0 483ffff17aff32d bf54444600000000 1 120f938b17c000 " |
201 "677bfad941dfed 9ed68000004400 10000002", | 212 "677bfad941dfed 9ed68000004400 10000002", |
202 /* rel */ "40", | 213 /* rel */ "40", |
203 /* abs */ "100000000", | 214 /* abs */ "100000000", |
204 /* msc */ "10", | 215 /* msc */ "10", |
| 216 /* sw */ "0", |
205 /* led */ "0", | 217 /* led */ "0", |
206 /* ff */ "0", | 218 /* ff */ "0", |
| 219 kHpUsbKeyboard_ExtraAbsAxes, |
| 220 arraysize(kHpUsbKeyboard_ExtraAbsAxes), |
207 }; | 221 }; |
208 | 222 |
209 // Captured from Dell MS111-L 3-Button Optical USB Mouse. | 223 // Captured from Dell MS111-L 3-Button Optical USB Mouse. |
210 const DeviceCapabilities kLogitechUsbMouse = { | 224 const DeviceCapabilities kLogitechUsbMouse = { |
211 /* path */ "/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2.4/" | 225 /* path */ "/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2.4/" |
212 "2-1.2.4:1.0/input/input16/event9", | 226 "2-1.2.4:1.0/input/input16/event9", |
213 /* name */ "Logitech USB Optical Mouse", | 227 /* name */ "Logitech USB Optical Mouse", |
214 /* phys */ "usb-0000:00:1d.0-1.2.4/input0", | 228 /* phys */ "usb-0000:00:1d.0-1.2.4/input0", |
215 /* uniq */ "", | 229 /* uniq */ "", |
216 /* bustype */ "0003", | 230 /* bustype */ "0003", |
217 /* vendor */ "046d", | 231 /* vendor */ "046d", |
218 /* product */ "c05a", | 232 /* product */ "c05a", |
219 /* version */ "0111", | 233 /* version */ "0111", |
220 /* prop */ "0", | 234 /* prop */ "0", |
221 /* ev */ "17", | 235 /* ev */ "17", |
222 /* key */ "ff0000 0 0 0 0", | 236 /* key */ "ff0000 0 0 0 0", |
223 /* rel */ "143", | 237 /* rel */ "143", |
224 /* abs */ "0", | 238 /* abs */ "0", |
225 /* msc */ "10", | 239 /* msc */ "10", |
| 240 /* sw */ "0", |
226 /* led */ "0", | 241 /* led */ "0", |
227 /* ff */ "0", | 242 /* ff */ "0", |
228 }; | 243 }; |
229 | 244 |
230 // Captured from "Mimo Touch 2" Universal DisplayLink monitor. | 245 // Captured from "Mimo Touch 2" Universal DisplayLink monitor. |
| 246 const DeviceAbsoluteAxis kMimoTouch2TouchscreenAbsAxes[] = { |
| 247 {ABS_X, {0, 0, 2047, 0, 0, 0}}, |
| 248 {ABS_Y, {0, 0, 2047, 0, 0, 0}}, |
| 249 }; |
231 const DeviceCapabilities kMimoTouch2Touchscreen = { | 250 const DeviceCapabilities kMimoTouch2Touchscreen = { |
232 /* path */ "/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.3/2-1.3.2/" | 251 /* path */ "/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.3/2-1.3.2/" |
233 "2-1.3.2:1.0/input/input15/event14", | 252 "2-1.3.2:1.0/input/input15/event14", |
234 /* name */ "eGalax Inc. USB TouchController", | 253 /* name */ "eGalax Inc. USB TouchController", |
235 /* phys */ "usb-0000:00:1d.0-1.3.2/input0", | 254 /* phys */ "usb-0000:00:1d.0-1.3.2/input0", |
236 /* uniq */ "", | 255 /* uniq */ "", |
237 /* bustype */ "0003", | 256 /* bustype */ "0003", |
238 /* vendor */ "0eef", | 257 /* vendor */ "0eef", |
239 /* product */ "0001", | 258 /* product */ "0001", |
240 /* version */ "0100", | 259 /* version */ "0100", |
241 /* prop */ "0", | 260 /* prop */ "0", |
242 /* ev */ "b", | 261 /* ev */ "b", |
243 /* key */ "400 0 0 0 0 0", | 262 /* key */ "400 0 0 0 0 0", |
244 /* rel */ "0", | 263 /* rel */ "0", |
245 /* abs */ "3", | 264 /* abs */ "3", |
246 /* msc */ "0", | 265 /* msc */ "0", |
| 266 /* sw */ "0", |
247 /* led */ "0", | 267 /* led */ "0", |
248 /* ff */ "0", | 268 /* ff */ "0", |
| 269 kMimoTouch2TouchscreenAbsAxes, |
| 270 arraysize(kMimoTouch2TouchscreenAbsAxes), |
249 }; | 271 }; |
250 | 272 |
251 // Captured from Wacom Intuos Pen and Touch Small Tablet. | 273 // Captured from Wacom Intuos Pen and Touch Small Tablet. |
| 274 const DeviceAbsoluteAxis kWacomIntuosPtS_PenAbsAxes[] = { |
| 275 {ABS_X, {0, 0, 15200, 4, 0, 100}}, |
| 276 {ABS_Y, {0, 0, 9500, 4, 0, 100}}, |
| 277 {ABS_PRESSURE, {0, 0, 1023, 0, 0, 0}}, |
| 278 {ABS_DISTANCE, {0, 0, 31, 0, 0, 0}}, |
| 279 }; |
252 const DeviceCapabilities kWacomIntuosPtS_Pen = { | 280 const DeviceCapabilities kWacomIntuosPtS_Pen = { |
253 /* path */ "/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2.3/" | 281 /* path */ "/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2.3/" |
254 "2-1.2.3:1.0/input/input9/event9", | 282 "2-1.2.3:1.0/input/input9/event9", |
255 /* name */ "Wacom Intuos PT S Pen", | 283 /* name */ "Wacom Intuos PT S Pen", |
256 /* phys */ "", | 284 /* phys */ "", |
257 /* uniq */ "", | 285 /* uniq */ "", |
258 /* bustype */ "0003", | 286 /* bustype */ "0003", |
259 /* vendor */ "056a", | 287 /* vendor */ "056a", |
260 /* product */ "0302", | 288 /* product */ "0302", |
261 /* version */ "0100", | 289 /* version */ "0100", |
262 /* prop */ "1", | 290 /* prop */ "1", |
263 /* ev */ "b", | 291 /* ev */ "b", |
264 /* key */ "1c03 0 0 0 0 0", | 292 /* key */ "1c03 0 0 0 0 0", |
265 /* rel */ "0", | 293 /* rel */ "0", |
266 /* abs */ "3000003", | 294 /* abs */ "3000003", |
267 /* msc */ "0", | 295 /* msc */ "0", |
| 296 /* sw */ "0", |
268 /* led */ "0", | 297 /* led */ "0", |
269 /* ff */ "0", | 298 /* ff */ "0", |
| 299 kWacomIntuosPtS_PenAbsAxes, |
| 300 arraysize(kWacomIntuosPtS_PenAbsAxes), |
270 }; | 301 }; |
271 | 302 |
272 // Captured from Wacom Intuos Pen and Touch Small Tablet. | 303 // Captured from Wacom Intuos Pen and Touch Small Tablet. |
| 304 const DeviceAbsoluteAxis kWacomIntuosPtS_FingerAbsAxes[] = { |
| 305 {ABS_X, {0, 0, 4096, 4, 0, 26}}, |
| 306 {ABS_Y, {0, 0, 4096, 4, 0, 43}}, |
| 307 {ABS_MT_SLOT, {0, 0, 15, 0, 0, 0}}, |
| 308 {ABS_MT_TOUCH_MAJOR, {0, 0, 4096, 0, 0, 0}}, |
| 309 {ABS_MT_TOUCH_MINOR, {0, 0, 4096, 0, 0, 0}}, |
| 310 {ABS_MT_POSITION_X, {0, 0, 4096, 4, 0, 26}}, |
| 311 {ABS_MT_POSITION_Y, {0, 0, 4096, 4, 0, 43}}, |
| 312 {ABS_MT_TRACKING_ID, {0, 0, 65535, 0, 0, 0}}, |
| 313 }; |
273 const DeviceCapabilities kWacomIntuosPtS_Finger = { | 314 const DeviceCapabilities kWacomIntuosPtS_Finger = { |
274 /* path */ "/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2.3/" | 315 /* path */ "/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2.3/" |
275 "2-1.2.3:1.1/input/input10/event10", | 316 "2-1.2.3:1.1/input/input10/event10", |
276 /* name */ "Wacom Intuos PT S Finger", | 317 /* name */ "Wacom Intuos PT S Finger", |
277 /* phys */ "", | 318 /* phys */ "", |
278 /* uniq */ "", | 319 /* uniq */ "", |
279 /* bustype */ "0003", | 320 /* bustype */ "0003", |
280 /* vendor */ "056a", | 321 /* vendor */ "056a", |
281 /* product */ "0302", | 322 /* product */ "0302", |
282 /* version */ "0100", | 323 /* version */ "0100", |
283 /* prop */ "1", | 324 /* prop */ "1", |
284 /* ev */ "2b", | 325 /* ev */ "2b", |
285 /* key */ "e520 630000 0 0 0 0", | 326 /* key */ "e520 630000 0 0 0 0", |
286 /* rel */ "0", | 327 /* rel */ "0", |
287 /* abs */ "263800000000003", | 328 /* abs */ "263800000000003", |
288 /* msc */ "0", | 329 /* msc */ "0", |
| 330 /* sw */ "4000", |
289 /* led */ "0", | 331 /* led */ "0", |
290 /* ff */ "0", | 332 /* ff */ "0", |
| 333 kWacomIntuosPtS_FingerAbsAxes, |
| 334 arraysize(kWacomIntuosPtS_FingerAbsAxes), |
291 }; | 335 }; |
292 | 336 |
293 // Captured from Logitech Wireless Touch Keyboard K400. | 337 // Captured from Logitech Wireless Touch Keyboard K400. |
| 338 const DeviceAbsoluteAxis kLogitechTouchKeyboardK400AbsAxes[] = { |
| 339 {ABS_VOLUME, {0, 1, 652, 0, 0, 0}}, |
| 340 }; |
294 const DeviceCapabilities kLogitechTouchKeyboardK400 = { | 341 const DeviceCapabilities kLogitechTouchKeyboardK400 = { |
295 /* path */ "/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2.3/" | 342 /* path */ "/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2.3/" |
296 "2-1.2.3:1.2/0003:046D:C52B.0006/input/input19/event17", | 343 "2-1.2.3:1.2/0003:046D:C52B.0006/input/input19/event17", |
297 /* name */ "Logitech Unifying Device. Wireless PID:4024", | 344 /* name */ "Logitech Unifying Device. Wireless PID:4024", |
298 /* phys */ "usb-0000:00:1d.0-1.2.3:1", | 345 /* phys */ "usb-0000:00:1d.0-1.2.3:1", |
299 /* uniq */ "", | 346 /* uniq */ "", |
300 /* bustype */ "001d", | 347 /* bustype */ "001d", |
301 /* vendor */ "046d", | 348 /* vendor */ "046d", |
302 /* product */ "4024", | 349 /* product */ "4024", |
303 /* version */ "0111", | 350 /* version */ "0111", |
304 /* prop */ "0", | 351 /* prop */ "0", |
305 /* ev */ "12001f", | 352 /* ev */ "12001f", |
306 /* key */ "3007f 0 0 483ffff17aff32d bf54444600000000 ffff0001 " | 353 /* key */ "3007f 0 0 483ffff17aff32d bf54444600000000 ffff0001 " |
307 "130f938b17c007 ffff7bfad9415fff febeffdfffefffff " | 354 "130f938b17c007 ffff7bfad9415fff febeffdfffefffff " |
308 "fffffffffffffffe", | 355 "fffffffffffffffe", |
309 /* rel */ "1c3", | 356 /* rel */ "1c3", |
310 /* abs */ "100000000", | 357 /* abs */ "100000000", |
311 /* msc */ "10", | 358 /* msc */ "10", |
| 359 /* sw */ "0", |
312 /* led */ "1f", | 360 /* led */ "1f", |
313 /* ff */ "0", | 361 /* ff */ "0", |
| 362 kLogitechTouchKeyboardK400AbsAxes, |
| 363 arraysize(kLogitechTouchKeyboardK400AbsAxes), |
314 }; | 364 }; |
315 | 365 |
316 bool CapabilitiesToDeviceInfo(const DeviceCapabilities& capabilities, | 366 bool CapabilitiesToDeviceInfo(const DeviceCapabilities& capabilities, |
317 EventDeviceInfo* devinfo) { | 367 EventDeviceInfo* devinfo) { |
318 std::vector<unsigned long> ev_bits; | 368 std::vector<unsigned long> ev_bits; |
319 if (!ParseBitfield(capabilities.ev, EV_CNT, &ev_bits)) | 369 if (!ParseBitfield(capabilities.ev, EV_CNT, &ev_bits)) |
320 return false; | 370 return false; |
321 devinfo->SetEventTypes(&ev_bits[0], ev_bits.size()); | 371 devinfo->SetEventTypes(&ev_bits[0], ev_bits.size()); |
322 | 372 |
323 std::vector<unsigned long> key_bits; | 373 std::vector<unsigned long> key_bits; |
(...skipping 19 matching lines...) Expand all Loading... |
343 std::vector<unsigned long> led_bits; | 393 std::vector<unsigned long> led_bits; |
344 if (!ParseBitfield(capabilities.led, LED_CNT, &led_bits)) | 394 if (!ParseBitfield(capabilities.led, LED_CNT, &led_bits)) |
345 return false; | 395 return false; |
346 devinfo->SetLedEvents(&led_bits[0], led_bits.size()); | 396 devinfo->SetLedEvents(&led_bits[0], led_bits.size()); |
347 | 397 |
348 std::vector<unsigned long> prop_bits; | 398 std::vector<unsigned long> prop_bits; |
349 if (!ParseBitfield(capabilities.prop, INPUT_PROP_CNT, &prop_bits)) | 399 if (!ParseBitfield(capabilities.prop, INPUT_PROP_CNT, &prop_bits)) |
350 return false; | 400 return false; |
351 devinfo->SetProps(&prop_bits[0], prop_bits.size()); | 401 devinfo->SetProps(&prop_bits[0], prop_bits.size()); |
352 | 402 |
| 403 for (size_t i = 0; i < capabilities.abs_axis_count; ++i) { |
| 404 const DeviceAbsoluteAxis& axis = capabilities.abs_axis[i]; |
| 405 devinfo->SetAbsInfo(axis.code, axis.absinfo); |
| 406 } |
| 407 |
353 return true; | 408 return true; |
354 } | 409 } |
355 | 410 |
356 } // namespace ui | 411 } // namespace ui |
OLD | NEW |