Chromium Code Reviews| 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 <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "base/format_macros.h" | 9 #include "base/format_macros.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 72 | 72 |
| 73 // Require canonically formatted input. | 73 // Require canonically formatted input. |
| 74 if (bitfield != SerializeBitfield(out->data(), max_bits)) | 74 if (bitfield != SerializeBitfield(out->data(), max_bits)) |
| 75 return false; | 75 return false; |
| 76 | 76 |
| 77 return true; | 77 return true; |
| 78 } | 78 } |
| 79 | 79 |
| 80 } // namespace | 80 } // namespace |
| 81 | 81 |
| 82 // Captuered from xbox 360 gamepad. | |
|
scottmg
2017/05/01 18:20:52
"Captured", and "Xbox".
jkwang
2017/05/01 22:21:56
Done.
| |
| 83 const DeviceAbsoluteAxis kXboxGamepadAbsAxes[] = { | |
| 84 {ABS_X, {0, -32768, 32767, 16, 128}}, | |
| 85 {ABS_Y, {0, -32768, 32767, 16, 128}}, | |
| 86 {ABS_Z, {0, 0, 255, 0, 0}}, | |
| 87 {ABS_RX, {0, -32768, 32767, 16, 128}}, | |
| 88 {ABS_RY, {0, -32768, 32767, 16, 128}}, | |
| 89 {ABS_RZ, {0, 0, 255, 0, 0}}, | |
| 90 {ABS_HAT0X, {0, -1, 1, 0, 0}}, | |
| 91 {ABS_HAT0Y, {0, -1, 1, 0, 0}}}; | |
| 92 | |
| 93 const DeviceCapabilities kXboxGamepad = { | |
| 94 /* path */ | |
| 95 "/devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2.2/1-2.2:1.0/" | |
| 96 "input/input38/event11", | |
| 97 /* name */ "Microsoft X-Box 360 pad", | |
| 98 /* phys */ "usb-0000:00:14.0-2.2/input0", | |
| 99 /* uniq */ "", | |
| 100 /* bustype */ "0011", | |
| 101 /* vendor */ "045e", | |
| 102 /* product */ "028e", | |
| 103 /* version */ "0114", | |
| 104 /* prop */ "0", | |
| 105 /* ev */ "20000b", | |
| 106 /* key */ "7cdb000000000000 0 0 0 0", | |
| 107 /* rel */ "0", | |
| 108 /* abs */ "3003f", | |
| 109 /* msc */ "0", | |
| 110 /* sw */ "0", | |
| 111 /* led */ "0", | |
| 112 /* ff */ "0", | |
| 113 kXboxGamepadAbsAxes, | |
| 114 arraysize(kXboxGamepadAbsAxes), | |
| 115 }; | |
| 116 | |
| 117 // Captured from ibuffalo gamepad. | |
|
scottmg
2017/05/01 18:20:51
"iBuffalo"
jkwang
2017/05/01 22:21:56
Done.
| |
| 118 const DeviceAbsoluteAxis kiBuffaloGamepadAbsAxes[] = { | |
| 119 {ABS_X, {128, 0, 255, 0, 15}}, | |
| 120 {ABS_Y, {128, 0, 255, 0, 15}}}; | |
| 121 | |
| 122 const DeviceCapabilities kiBuffaloGamepad = { | |
| 123 /* path */ | |
| 124 "/devices/pci0000:00/0000:00:14.0/usb3/3-14/3-14:1.0/0003:0583:2060.0011/" | |
| 125 "input/input30/event14", | |
| 126 /* name */ "USB,2-axis 8-button gamepad", | |
| 127 /* phys */ "usb-0000:00:14.0-14/input0", | |
| 128 /* uniq */ "", | |
| 129 /* bustype */ "0011", | |
| 130 /* vendor */ "0583", | |
| 131 /* product */ "2060", | |
| 132 /* version */ "0110", | |
| 133 /* prop */ "0", | |
| 134 /* ev */ "1b", | |
| 135 /* key */ "ff00000000 0 0 0 0", | |
| 136 /* rel */ "0", | |
| 137 /* abs */ "3", | |
| 138 /* msc */ "10", | |
| 139 /* sw */ "0", | |
| 140 /* led */ "0", | |
| 141 /* ff */ "0", | |
| 142 kiBuffaloGamepadAbsAxes, | |
| 143 arraysize(kiBuffaloGamepadAbsAxes), | |
| 144 }; | |
| 145 | |
| 82 // Captured from Chromebook Pixel. | 146 // Captured from Chromebook Pixel. |
| 83 const DeviceCapabilities kLinkKeyboard = { | 147 const DeviceCapabilities kLinkKeyboard = { |
| 84 /* path */ "/sys/devices/platform/i8042/serio0/input/input6/event6", | 148 /* path */ "/sys/devices/platform/i8042/serio0/input/input6/event6", |
| 85 /* name */ "AT Translated Set 2 keyboard", | 149 /* name */ "AT Translated Set 2 keyboard", |
| 86 /* phys */ "isa0060/serio0/input0", | 150 /* phys */ "isa0060/serio0/input0", |
| 87 /* uniq */ "", | 151 /* uniq */ "", |
| 88 /* bustype */ "0011", | 152 /* bustype */ "0011", |
| 89 /* vendor */ "0001", | 153 /* vendor */ "0001", |
| 90 /* product */ "0001", | 154 /* product */ "0001", |
| 91 /* version */ "ab83", | 155 /* version */ "ab83", |
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 491 if (code == ABS_MT_TRACKING_ID) | 555 if (code == ABS_MT_TRACKING_ID) |
| 492 devinfo->SetAbsMtSlots(code, minus_one_slots); | 556 devinfo->SetAbsMtSlots(code, minus_one_slots); |
| 493 else | 557 else |
| 494 devinfo->SetAbsMtSlots(code, zero_slots); | 558 devinfo->SetAbsMtSlots(code, zero_slots); |
| 495 } | 559 } |
| 496 | 560 |
| 497 int bustype = 0; | 561 int bustype = 0; |
| 498 sscanf(capabilities.bustype, "%x", &bustype); | 562 sscanf(capabilities.bustype, "%x", &bustype); |
| 499 devinfo->SetDeviceType(InputDeviceTypeFromBusType(bustype)); | 563 devinfo->SetDeviceType(InputDeviceTypeFromBusType(bustype)); |
| 500 | 564 |
| 565 int vendor_id = 0; | |
| 566 int product_id = 0; | |
| 567 | |
| 568 sscanf(capabilities.vendor, "%x", &vendor_id); | |
| 569 sscanf(capabilities.product, "%x", &product_id); | |
| 570 devinfo->SetId(static_cast<uint16_t>(vendor_id), | |
| 571 static_cast<uint16_t>(product_id)); | |
| 501 return true; | 572 return true; |
| 502 } | 573 } |
| 503 | 574 |
| 504 } // namespace ui | 575 } // namespace ui |
| OLD | NEW |