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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "device/gamepad/gamepad_standard_mappings.h" 8 #include "device/gamepad/gamepad_standard_mappings.h"
9 9
10 namespace device { 10 namespace device {
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 mapped->buttons[BUTTON_INDEX_DPAD_UP] = AxisNegativeAsButton(input.axes[7]); 283 mapped->buttons[BUTTON_INDEX_DPAD_UP] = AxisNegativeAsButton(input.axes[7]);
284 mapped->buttons[BUTTON_INDEX_DPAD_DOWN] = AxisPositiveAsButton(input.axes[7]); 284 mapped->buttons[BUTTON_INDEX_DPAD_DOWN] = AxisPositiveAsButton(input.axes[7]);
285 mapped->buttons[BUTTON_INDEX_DPAD_LEFT] = AxisNegativeAsButton(input.axes[6]); 285 mapped->buttons[BUTTON_INDEX_DPAD_LEFT] = AxisNegativeAsButton(input.axes[6]);
286 mapped->buttons[BUTTON_INDEX_DPAD_RIGHT] = 286 mapped->buttons[BUTTON_INDEX_DPAD_RIGHT] =
287 AxisPositiveAsButton(input.axes[6]); 287 AxisPositiveAsButton(input.axes[6]);
288 288
289 mapped->buttonsLength = BUTTON_INDEX_COUNT - 1; /* no meta */ 289 mapped->buttonsLength = BUTTON_INDEX_COUNT - 1; /* no meta */
290 mapped->axesLength = AXIS_INDEX_COUNT; 290 mapped->axesLength = AXIS_INDEX_COUNT;
291 } 291 }
292 292
293 void MapperSamsung_EI_GP20(const blink::WebGamepad& input,
294 blink::WebGamepad* mapped) {
295 *mapped = input;
296 mapped->buttons[BUTTON_INDEX_PRIMARY] = input.buttons[0];
297 mapped->buttons[BUTTON_INDEX_SECONDARY] = input.buttons[1];
298 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
299 mapped->buttons[BUTTON_INDEX_QUATERNARY] = input.buttons[4];
300 mapped->buttons[BUTTON_INDEX_LEFT_SHOULDER] = NullButton();
301 mapped->buttons[BUTTON_INDEX_RIGHT_SHOULDER] = NullButton();
302 mapped->buttons[BUTTON_INDEX_LEFT_TRIGGER] = input.buttons[6];
303 mapped->buttons[BUTTON_INDEX_RIGHT_TRIGGER] = input.buttons[7];
304 mapped->buttons[BUTTON_INDEX_BACK_SELECT] = input.buttons[10];
305 mapped->buttons[BUTTON_INDEX_START] = input.buttons[11];
306 mapped->buttons[BUTTON_INDEX_LEFT_THUMBSTICK] = NullButton();
307 mapped->buttons[BUTTON_INDEX_RIGHT_THUMBSTICK] = NullButton();
308
309 mapped->buttons[BUTTON_INDEX_DPAD_UP] = AxisNegativeAsButton(input.axes[5]);
310 mapped->buttons[BUTTON_INDEX_DPAD_DOWN] = AxisPositiveAsButton(input.axes[5]);
311 mapped->buttons[BUTTON_INDEX_DPAD_LEFT] = AxisNegativeAsButton(input.axes[4]);
312 mapped->buttons[BUTTON_INDEX_DPAD_RIGHT] =
313 AxisPositiveAsButton(input.axes[4]);
314 mapped->buttons[BUTTON_INDEX_META] = input.buttons[15];
315 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.
316
317 mapped->axes[AXIS_INDEX_LEFT_STICK_X] = input.axes[0];
318 mapped->axes[AXIS_INDEX_LEFT_STICK_Y] = input.axes[1];
319 mapped->axes[AXIS_INDEX_RIGHT_STICK_X] = input.axes[2];
320 mapped->axes[AXIS_INDEX_RIGHT_STICK_Y] = input.axes[3];
321
322 mapped->buttonsLength = BUTTON_INDEX_COUNT;
323 mapped->axesLength = AXIS_INDEX_COUNT;
324 }
325
293 struct MappingData { 326 struct MappingData {
294 const char* const vendor_id; 327 const char* const vendor_id;
295 const char* const product_id; 328 const char* const product_id;
296 GamepadStandardMappingFunction function; 329 GamepadStandardMappingFunction function;
297 } AvailableMappings[] = { 330 } AvailableMappings[] = {
298 // http://www.linux-usb.org/usb.ids 331 // http://www.linux-usb.org/usb.ids
299 {"0079", "0006", MapperDragonRiseGeneric}, // DragonRise Generic USB 332 {"0079", "0006", MapperDragonRiseGeneric}, // DragonRise Generic USB
300 {"045e", "028e", MapperXInputStyleGamepad}, // Xbox 360 Wired 333 {"045e", "028e", MapperXInputStyleGamepad}, // Xbox 360 Wired
301 {"045e", "028f", MapperXInputStyleGamepad}, // Xbox 360 Wireless 334 {"045e", "028f", MapperXInputStyleGamepad}, // Xbox 360 Wireless
302 {"045e", "0719", MapperXInputStyleGamepad}, // Xbox 360 Wireless 335 {"045e", "0719", MapperXInputStyleGamepad}, // Xbox 360 Wireless
303 {"046d", "c21d", MapperXInputStyleGamepad}, // Logitech F310 336 {"046d", "c21d", MapperXInputStyleGamepad}, // Logitech F310
304 {"046d", "c21e", MapperXInputStyleGamepad}, // Logitech F510 337 {"046d", "c21e", MapperXInputStyleGamepad}, // Logitech F510
305 {"046d", "c21f", MapperXInputStyleGamepad}, // Logitech F710 338 {"046d", "c21f", MapperXInputStyleGamepad}, // Logitech F710
339 {"04e8", "a000", MapperSamsung_EI_GP20}, // Samsung Gamepad EI-GP20
306 {"054c", "0268", MapperPlaystationSixAxis}, // Playstation SIXAXIS 340 {"054c", "0268", MapperPlaystationSixAxis}, // Playstation SIXAXIS
307 {"054c", "05c4", MapperDualshock4}, // Playstation Dualshock 4 341 {"054c", "05c4", MapperDualshock4}, // Playstation Dualshock 4
308 {"0583", "2060", MapperIBuffalo}, // iBuffalo Classic 342 {"0583", "2060", MapperIBuffalo}, // iBuffalo Classic
309 {"0925", "0005", MapperLakeviewResearch}, // SmartJoy PLUS Adapter 343 {"0925", "0005", MapperLakeviewResearch}, // SmartJoy PLUS Adapter
310 {"0925", "8866", MapperLakeviewResearch}, // WiseGroup MP-8866 344 {"0925", "8866", MapperLakeviewResearch}, // WiseGroup MP-8866
311 {"0955", "7210", MapperNvShield}, // Nvidia Shield gamepad 345 {"0955", "7210", MapperNvShield}, // Nvidia Shield gamepad
312 {"0b05", "4500", MapperADT1}, // Nexus Player Controller 346 {"0b05", "4500", MapperADT1}, // Nexus Player Controller
313 {"0e8f", "0003", MapperXGEAR}, // XFXforce XGEAR PS2 Controller 347 {"0e8f", "0003", MapperXGEAR}, // XFXforce XGEAR PS2 Controller
314 {"1532", "0900", MapperRazerServal}, // Razer Serval Controller 348 {"1532", "0900", MapperRazerServal}, // Razer Serval Controller
315 {"18d1", "2c40", MapperADT1}, // ADT-1 Controller 349 {"18d1", "2c40", MapperADT1}, // ADT-1 Controller
(...skipping 10 matching lines...) Expand all
326 const base::StringPiece& product_id) { 360 const base::StringPiece& product_id) {
327 for (size_t i = 0; i < arraysize(AvailableMappings); ++i) { 361 for (size_t i = 0; i < arraysize(AvailableMappings); ++i) {
328 MappingData& item = AvailableMappings[i]; 362 MappingData& item = AvailableMappings[i];
329 if (vendor_id == item.vendor_id && product_id == item.product_id) 363 if (vendor_id == item.vendor_id && product_id == item.product_id)
330 return item.function; 364 return item.function;
331 } 365 }
332 return NULL; 366 return NULL;
333 } 367 }
334 368
335 } // namespace device 369 } // namespace device
OLDNEW
« 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