Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(313)

Side by Side Diff: ui/events/ozone/evdev/event_device_test_util.cc

Issue 2805793002: ozone: evdev: Add gamepad support (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 // Caputered from xbox 360 gamepad.
83 const DeviceAbsoluteAxis kLinkGamepadAbsAxes[] = {
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 const DeviceCapabilities kLinkGamepad = {
spang 2017/04/13 00:52:19 "Link" here is the board name for the Chromebook P
jkwang 2017/04/19 19:42:23 Done.
93 /* path */
94 "/devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2.2/1-2.2:1.0/"
95 "input/input38/event11",
96 /* name */ "Microsoft X-Box 360 pad",
97 /* phys */ "usb-0000:00:14.0-2.2/input0",
98 /* uniq */ "",
99 /* bustype */ "0011",
100 /* vendor */ "045e",
101 /* product */ "028e",
102 /* version */ "0114",
103 /* prop */ "0",
104 /* ev */ "20000b",
105 /* key */ "7cdb000000000000 0 0 0 0",
106 /* rel */ "0",
107 /* abs */ "3003f",
108 /* msc */ "0",
109 /* sw */ "0",
110 /* led */ "0",
111 /* ff */ "0",
112 kLinkGamepadAbsAxes,
113 arraysize(kLinkGamepadAbsAxes),
114 };
115
82 // Captured from Chromebook Pixel. 116 // Captured from Chromebook Pixel.
83 const DeviceCapabilities kLinkKeyboard = { 117 const DeviceCapabilities kLinkKeyboard = {
84 /* path */ "/sys/devices/platform/i8042/serio0/input/input6/event6", 118 /* path */ "/sys/devices/platform/i8042/serio0/input/input6/event6",
85 /* name */ "AT Translated Set 2 keyboard", 119 /* name */ "AT Translated Set 2 keyboard",
86 /* phys */ "isa0060/serio0/input0", 120 /* phys */ "isa0060/serio0/input0",
87 /* uniq */ "", 121 /* uniq */ "",
88 /* bustype */ "0011", 122 /* bustype */ "0011",
89 /* vendor */ "0001", 123 /* vendor */ "0001",
90 /* product */ "0001", 124 /* product */ "0001",
91 /* version */ "ab83", 125 /* version */ "ab83",
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 } 529 }
496 530
497 int bustype = 0; 531 int bustype = 0;
498 sscanf(capabilities.bustype, "%x", &bustype); 532 sscanf(capabilities.bustype, "%x", &bustype);
499 devinfo->SetDeviceType(InputDeviceTypeFromBusType(bustype)); 533 devinfo->SetDeviceType(InputDeviceTypeFromBusType(bustype));
500 534
501 return true; 535 return true;
502 } 536 }
503 537
504 } // namespace ui 538 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698