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

Unified Diff: device/gamepad/gamepad_standard_mappings_linux.cc

Issue 2468143002: Add Gamepad mapping for Samsung EI-GP20 (Closed)
Patch Set: Add Gamepad mapping for Samsung EI-GP20 Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/gamepad/gamepad_standard_mappings_linux.cc
diff --git a/device/gamepad/gamepad_standard_mappings_linux.cc b/device/gamepad/gamepad_standard_mappings_linux.cc
index 7755e1f936debddac6d0b81ec76826c16a226175..173a6b860bbe613e5e41afdd34099e4fe3286f49 100644
--- a/device/gamepad/gamepad_standard_mappings_linux.cc
+++ b/device/gamepad/gamepad_standard_mappings_linux.cc
@@ -290,6 +290,39 @@ void MapperMogaPro(const blink::WebGamepad& input, blink::WebGamepad* mapped) {
mapped->axesLength = AXIS_INDEX_COUNT;
}
+void MapperSamsung_EI_GP20(const blink::WebGamepad& input,
+ blink::WebGamepad* mapped) {
+ *mapped = input;
+ mapped->buttons[BUTTON_INDEX_PRIMARY] = input.buttons[0];
+ mapped->buttons[BUTTON_INDEX_SECONDARY] = input.buttons[1];
+ mapped->buttons[BUTTON_INDEX_TERTIARY] = input.buttons[3];
scottmg 2016/11/07 17:39:24 What are buttons[2] and [5]? :)
j-hyun.lee 2016/11/08 06:16:20 There are no H/W buttons [2] and [5] on gamepad EI
+ mapped->buttons[BUTTON_INDEX_QUATERNARY] = input.buttons[4];
+ mapped->buttons[BUTTON_INDEX_LEFT_SHOULDER] = NullButton();
+ mapped->buttons[BUTTON_INDEX_RIGHT_SHOULDER] = NullButton();
+ mapped->buttons[BUTTON_INDEX_LEFT_TRIGGER] = input.buttons[6];
+ mapped->buttons[BUTTON_INDEX_RIGHT_TRIGGER] = input.buttons[7];
+ mapped->buttons[BUTTON_INDEX_BACK_SELECT] = input.buttons[10];
+ mapped->buttons[BUTTON_INDEX_START] = input.buttons[11];
+ mapped->buttons[BUTTON_INDEX_LEFT_THUMBSTICK] = NullButton();
+ mapped->buttons[BUTTON_INDEX_RIGHT_THUMBSTICK] = NullButton();
+
+ mapped->buttons[BUTTON_INDEX_DPAD_UP] = AxisNegativeAsButton(input.axes[5]);
+ mapped->buttons[BUTTON_INDEX_DPAD_DOWN] = AxisPositiveAsButton(input.axes[5]);
+ mapped->buttons[BUTTON_INDEX_DPAD_LEFT] = AxisNegativeAsButton(input.axes[4]);
+ mapped->buttons[BUTTON_INDEX_DPAD_RIGHT] =
+ AxisPositiveAsButton(input.axes[4]);
+ mapped->buttons[BUTTON_INDEX_META] = input.buttons[15];
+ mapped->buttons[BUTTON_INDEX_COUNT] = NullButton();
scottmg 2016/11/07 17:39:24 Don't set INDEX_COUNT, it's for a maximum value.
j-hyun.lee 2016/11/08 06:16:20 Ok, I will fix it.
+
+ mapped->axes[AXIS_INDEX_LEFT_STICK_X] = input.axes[0];
+ mapped->axes[AXIS_INDEX_LEFT_STICK_Y] = input.axes[1];
+ mapped->axes[AXIS_INDEX_RIGHT_STICK_X] = input.axes[2];
+ mapped->axes[AXIS_INDEX_RIGHT_STICK_Y] = input.axes[3];
+
+ mapped->buttonsLength = BUTTON_INDEX_COUNT;
+ mapped->axesLength = AXIS_INDEX_COUNT;
+}
+
struct MappingData {
const char* const vendor_id;
const char* const product_id;
@@ -303,6 +336,7 @@ struct MappingData {
{"046d", "c21d", MapperXInputStyleGamepad}, // Logitech F310
{"046d", "c21e", MapperXInputStyleGamepad}, // Logitech F510
{"046d", "c21f", MapperXInputStyleGamepad}, // Logitech F710
+ {"04e8", "a000", MapperSamsung_EI_GP20}, // Samsung Gamepad EI-GP20
{"054c", "0268", MapperPlaystationSixAxis}, // Playstation SIXAXIS
{"054c", "05c4", MapperDualshock4}, // Playstation Dualshock 4
{"0583", "2060", MapperIBuffalo}, // iBuffalo Classic
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698