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

Side by Side Diff: device/gamepad/gamepad_standard_mappings_linux.cc

Issue 2468143002: Add Gamepad mapping for Samsung EI-GP20 (Closed)
Patch Set: Rebase patch Created 3 years, 9 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
« no previous file with comments | « AUTHORS ('k') | 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 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 mapped->buttons[BUTTON_INDEX_DPAD_UP] = AxisNegativeAsButton(input.axes[7]); 310 mapped->buttons[BUTTON_INDEX_DPAD_UP] = AxisNegativeAsButton(input.axes[7]);
311 mapped->buttons[BUTTON_INDEX_DPAD_DOWN] = AxisPositiveAsButton(input.axes[7]); 311 mapped->buttons[BUTTON_INDEX_DPAD_DOWN] = AxisPositiveAsButton(input.axes[7]);
312 mapped->buttons[BUTTON_INDEX_DPAD_LEFT] = AxisNegativeAsButton(input.axes[6]); 312 mapped->buttons[BUTTON_INDEX_DPAD_LEFT] = AxisNegativeAsButton(input.axes[6]);
313 mapped->buttons[BUTTON_INDEX_DPAD_RIGHT] = 313 mapped->buttons[BUTTON_INDEX_DPAD_RIGHT] =
314 AxisPositiveAsButton(input.axes[6]); 314 AxisPositiveAsButton(input.axes[6]);
315 315
316 mapped->buttonsLength = BUTTON_INDEX_COUNT - 1; /* no meta */ 316 mapped->buttonsLength = BUTTON_INDEX_COUNT - 1; /* no meta */
317 mapped->axesLength = AXIS_INDEX_COUNT; 317 mapped->axesLength = AXIS_INDEX_COUNT;
318 } 318 }
319 319
320 void MapperSamsung_EI_GP20(const blink::WebGamepad& input,
321 blink::WebGamepad* mapped) {
322 *mapped = input;
323 mapped->buttons[BUTTON_INDEX_PRIMARY] = input.buttons[0];
324 mapped->buttons[BUTTON_INDEX_SECONDARY] = input.buttons[1];
325 mapped->buttons[BUTTON_INDEX_TERTIARY] = input.buttons[3];
326 mapped->buttons[BUTTON_INDEX_QUATERNARY] = input.buttons[4];
327 mapped->buttons[BUTTON_INDEX_LEFT_SHOULDER] = NullButton();
328 mapped->buttons[BUTTON_INDEX_RIGHT_SHOULDER] = NullButton();
329 mapped->buttons[BUTTON_INDEX_LEFT_TRIGGER] = input.buttons[6];
330 mapped->buttons[BUTTON_INDEX_RIGHT_TRIGGER] = input.buttons[7];
331 mapped->buttons[BUTTON_INDEX_BACK_SELECT] = input.buttons[10];
332 mapped->buttons[BUTTON_INDEX_START] = input.buttons[11];
333 mapped->buttons[BUTTON_INDEX_LEFT_THUMBSTICK] = NullButton();
334 mapped->buttons[BUTTON_INDEX_RIGHT_THUMBSTICK] = NullButton();
335
336 mapped->buttons[BUTTON_INDEX_DPAD_UP] = AxisNegativeAsButton(input.axes[5]);
337 mapped->buttons[BUTTON_INDEX_DPAD_DOWN] = AxisPositiveAsButton(input.axes[5]);
338 mapped->buttons[BUTTON_INDEX_DPAD_LEFT] = AxisNegativeAsButton(input.axes[4]);
339 mapped->buttons[BUTTON_INDEX_DPAD_RIGHT] =
340 AxisPositiveAsButton(input.axes[4]);
341 mapped->buttons[BUTTON_INDEX_META] = input.buttons[15];
342
343 mapped->axes[AXIS_INDEX_LEFT_STICK_X] = input.axes[0];
344 mapped->axes[AXIS_INDEX_LEFT_STICK_Y] = input.axes[1];
345 mapped->axes[AXIS_INDEX_RIGHT_STICK_X] = input.axes[2];
346 mapped->axes[AXIS_INDEX_RIGHT_STICK_Y] = input.axes[3];
347
348 mapped->buttonsLength = BUTTON_INDEX_COUNT;
349 mapped->axesLength = AXIS_INDEX_COUNT;
350 }
351
320 struct MappingData { 352 struct MappingData {
321 const char* const vendor_id; 353 const char* const vendor_id;
322 const char* const product_id; 354 const char* const product_id;
323 GamepadStandardMappingFunction function; 355 GamepadStandardMappingFunction function;
324 } AvailableMappings[] = { 356 } AvailableMappings[] = {
325 // http://www.linux-usb.org/usb.ids 357 // http://www.linux-usb.org/usb.ids
326 {"0079", "0006", MapperDragonRiseGeneric}, // DragonRise Generic USB 358 {"0079", "0006", MapperDragonRiseGeneric}, // DragonRise Generic USB
327 {"045e", "028e", MapperXInputStyleGamepad}, // Xbox 360 Wired 359 {"045e", "028e", MapperXInputStyleGamepad}, // Xbox 360 Wired
328 {"045e", "028f", MapperXInputStyleGamepad}, // Xbox 360 Wireless 360 {"045e", "028f", MapperXInputStyleGamepad}, // Xbox 360 Wireless
329 {"045e", "02d1", MapperXInputStyleGamepad}, // Xbox One Wired 361 {"045e", "02d1", MapperXInputStyleGamepad}, // Xbox One Wired
330 {"045e", "02dd", MapperXInputStyleGamepad}, // Xbox One Wired (2015 FW) 362 {"045e", "02dd", MapperXInputStyleGamepad}, // Xbox One Wired (2015 FW)
331 {"045e", "02e3", MapperXInputStyleGamepad}, // Xbox One Elite Wired 363 {"045e", "02e3", MapperXInputStyleGamepad}, // Xbox One Elite Wired
332 {"045e", "02ea", MapperXInputStyleGamepad}, // Xbox One S (USB) 364 {"045e", "02ea", MapperXInputStyleGamepad}, // Xbox One S (USB)
333 {"045e", "02fd", MapperXboxOneHidGamepad}, // Xbox One S (Bluetooth) 365 {"045e", "02fd", MapperXboxOneHidGamepad}, // Xbox One S (Bluetooth)
334 {"045e", "0719", MapperXInputStyleGamepad}, // Xbox 360 Wireless 366 {"045e", "0719", MapperXInputStyleGamepad}, // Xbox 360 Wireless
335 {"046d", "c21d", MapperXInputStyleGamepad}, // Logitech F310 367 {"046d", "c21d", MapperXInputStyleGamepad}, // Logitech F310
336 {"046d", "c21e", MapperXInputStyleGamepad}, // Logitech F510 368 {"046d", "c21e", MapperXInputStyleGamepad}, // Logitech F510
337 {"046d", "c21f", MapperXInputStyleGamepad}, // Logitech F710 369 {"046d", "c21f", MapperXInputStyleGamepad}, // Logitech F710
370 {"04e8", "a000", MapperSamsung_EI_GP20}, // Samsung Gamepad EI-GP20
338 {"054c", "0268", MapperPlaystationSixAxis}, // Playstation SIXAXIS 371 {"054c", "0268", MapperPlaystationSixAxis}, // Playstation SIXAXIS
339 {"054c", "05c4", MapperDualshock4}, // Playstation Dualshock 4 372 {"054c", "05c4", MapperDualshock4}, // Playstation Dualshock 4
340 {"054c", "09cc", MapperDualshock4}, // Dualshock 4 (PS4 Slim) 373 {"054c", "09cc", MapperDualshock4}, // Dualshock 4 (PS4 Slim)
341 {"0583", "2060", MapperIBuffalo}, // iBuffalo Classic 374 {"0583", "2060", MapperIBuffalo}, // iBuffalo Classic
342 {"0925", "0005", MapperLakeviewResearch}, // SmartJoy PLUS Adapter 375 {"0925", "0005", MapperLakeviewResearch}, // SmartJoy PLUS Adapter
343 {"0925", "8866", MapperLakeviewResearch}, // WiseGroup MP-8866 376 {"0925", "8866", MapperLakeviewResearch}, // WiseGroup MP-8866
344 {"0955", "7210", MapperNvShield}, // Nvidia Shield gamepad 377 {"0955", "7210", MapperNvShield}, // Nvidia Shield gamepad
345 {"0b05", "4500", MapperADT1}, // Nexus Player Controller 378 {"0b05", "4500", MapperADT1}, // Nexus Player Controller
346 {"0e8f", "0003", MapperXGEAR}, // XFXforce XGEAR PS2 Controller 379 {"0e8f", "0003", MapperXGEAR}, // XFXforce XGEAR PS2 Controller
347 {"1532", "0900", MapperRazerServal}, // Razer Serval Controller 380 {"1532", "0900", MapperRazerServal}, // Razer Serval Controller
(...skipping 11 matching lines...) Expand all
359 const base::StringPiece& product_id) { 392 const base::StringPiece& product_id) {
360 for (size_t i = 0; i < arraysize(AvailableMappings); ++i) { 393 for (size_t i = 0; i < arraysize(AvailableMappings); ++i) {
361 MappingData& item = AvailableMappings[i]; 394 MappingData& item = AvailableMappings[i];
362 if (vendor_id == item.vendor_id && product_id == item.product_id) 395 if (vendor_id == item.vendor_id && product_id == item.product_id)
363 return item.function; 396 return item.function;
364 } 397 }
365 return NULL; 398 return NULL;
366 } 399 }
367 400
368 } // namespace device 401 } // namespace device
OLDNEW
« no previous file with comments | « AUTHORS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698