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

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

Issue 2899893003: Add generic mapping for gamepad (Closed)
Patch Set: Add generic mapping for gamepad Created 3 years, 6 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 // Captured from HJC Game ZD - V gamepad.
83 const DeviceAbsoluteAxis kHJCGamepadAbsAxes[] = {
84 {ABS_X, {128, 0, 255, 15, 0}}, {ABS_Y, {128, 0, 255, 15, 0}},
85 {ABS_Z, {128, 0, 255, 15, 0}}, {ABS_RZ, {128, 0, 255, 15, 0}},
86 {ABS_HAT0X, {0, -1, 1, 0, 0}}, {ABS_HAT0Y, {0, 1, 1, 0, 0}}};
87
88 const DeviceCapabilities kHJCGamepad = {
89 /* path */
90 "/devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2.2/1-2.2:1.0/"
91 "input/input38/event11",
92 /* name */ "HJC Game ZD - V",
93 /* phys */ "usb-0000:00:14.0-2.2/input0",
94 /* uniq */ "",
95 /* bustype */ "0011",
96 /* vendor */ "11c5",
97 /* product */ "5506",
98 /* version */ "0111",
99 /* prop */ "0",
100 /* ev */ "1b",
101 /* key */ "fff000000000000 0 0 0 0",
102 /* rel */ "0",
103 /* abs */ "30027",
104 /* msc */ "10",
105 /* sw */ "0",
106 /* led */ "0",
107 /* ff */ "0",
108 kHJCGamepadAbsAxes,
109 arraysize(kHJCGamepadAbsAxes),
110 };
111
82 // Captured from Xbox 360 gamepad. 112 // Captured from Xbox 360 gamepad.
83 const DeviceAbsoluteAxis kXboxGamepadAbsAxes[] = { 113 const DeviceAbsoluteAxis kXboxGamepadAbsAxes[] = {
84 {ABS_X, {0, -32768, 32767, 16, 128}}, 114 {ABS_X, {0, -32768, 32767, 16, 128}},
85 {ABS_Y, {0, -32768, 32767, 16, 128}}, 115 {ABS_Y, {0, -32768, 32767, 16, 128}},
86 {ABS_Z, {0, 0, 255, 0, 0}}, 116 {ABS_Z, {0, 0, 255, 0, 0}},
87 {ABS_RX, {0, -32768, 32767, 16, 128}}, 117 {ABS_RX, {0, -32768, 32767, 16, 128}},
88 {ABS_RY, {0, -32768, 32767, 16, 128}}, 118 {ABS_RY, {0, -32768, 32767, 16, 128}},
89 {ABS_RZ, {0, 0, 255, 0, 0}}, 119 {ABS_RZ, {0, 0, 255, 0, 0}},
90 {ABS_HAT0X, {0, -1, 1, 0, 0}}, 120 {ABS_HAT0X, {0, -1, 1, 0, 0}},
91 {ABS_HAT0Y, {0, -1, 1, 0, 0}}}; 121 {ABS_HAT0Y, {0, -1, 1, 0, 0}}};
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 int product_id = 0; 596 int product_id = 0;
567 597
568 sscanf(capabilities.vendor, "%x", &vendor_id); 598 sscanf(capabilities.vendor, "%x", &vendor_id);
569 sscanf(capabilities.product, "%x", &product_id); 599 sscanf(capabilities.product, "%x", &product_id);
570 devinfo->SetId(static_cast<uint16_t>(vendor_id), 600 devinfo->SetId(static_cast<uint16_t>(vendor_id),
571 static_cast<uint16_t>(product_id)); 601 static_cast<uint16_t>(product_id));
572 return true; 602 return true;
573 } 603 }
574 604
575 } // namespace ui 605 } // namespace ui
OLDNEW
« no previous file with comments | « ui/events/ozone/evdev/event_device_test_util.h ('k') | ui/events/ozone/evdev/gamepad_event_converter_evdev.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698