# SDL: Use the new controller type for the Luna and Stadia controllers

**URL:** <https://discourse.libsdl.org/t/sdl-use-the-new-controller-type-for-the-luna-and-stadia-controllers/32212>\
**Category:** SDL Commits\
**Created:** [July 24, 2021, 7:14pm UTC](https://discourse.libsdl.org/t/sdl-use-the-new-controller-type-for-the-luna-and-stadia-controllers/32212 "2021-07-24T19:14:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![SDLPushPostBot](https://discourse.libsdl.org/user_avatar/discourse.libsdl.org/sdlpushpostbot/32/4370_2.png) [@SDLPushPostBot](https://discourse.libsdl.org/u/SDLPushPostBot)\
**Post date:** [July 24, 2021, 7:14pm UTC](https://discourse.libsdl.org/t/sdl-use-the-new-controller-type-for-the-luna-and-stadia-controllers/32212/1 "2021-07-24T19:14:07Z")

</div>

> <https://github.com/libsdl-org/SDL/commit/09d1cea733b84c8315212fdc4b4413b9b71fc180>

```diff
From 09d1cea733b84c8315212fdc4b4413b9b71fc180 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Sat, 24 Jul 2021 11:15:09 -0700
Subject: [PATCH] Use the new controller type for the Luna and Stadia
 controllers

---
 src/joystick/SDL_gamecontroller.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/joystick/SDL_gamecontroller.c b/src/joystick/SDL_gamecontroller.c
index 90d11dc4a..f4e7a6f53 100644
--- a/src/joystick/SDL_gamecontroller.c
+++ b/src/joystick/SDL_gamecontroller.c
@@ -593,10 +593,6 @@ static ControllerMapping_t *SDL_CreateMappingForHIDAPIController(SDL_JoystickGUI
         if (SDL_IsJoystickXboxSeriesX(vendor, product)) {
             /* XBox Series X Controllers have a share button under the guide button */
             SDL_strlcat(mapping_string, "misc1:b15,", sizeof(mapping_string));
- } else if ((vendor == USB_VENDOR_AMAZON && product == USB_PRODUCT_AMAZON_LUNA_CONTROLLER) ||
- (vendor == BLUETOOTH_VENDOR_AMAZON && product == BLUETOOTH_PRODUCT_LUNA_CONTROLLER)) {
- /* Amazon Luna Controller has a mic button under the guide button */
- SDL_strlcat(mapping_string, "misc1:b15,", sizeof(mapping_string));
         } else if (SDL_IsJoystickXboxOneElite(vendor, product)) {
             /* XBox One Elite Controllers have 4 back paddle buttons */
             SDL_strlcat(mapping_string, "paddle1:b15,paddle2:b17,paddle3:b16,paddle4:b18,", sizeof(mapping_string));
@@ -624,13 +620,18 @@ static ControllerMapping_t *SDL_CreateMappingForHIDAPIController(SDL_JoystickGUI
                     SDL_strlcat(mapping_string, "paddle1:b16,paddle3:b18,", sizeof(mapping_string));
                 }
                 break;
+ case SDL_CONTROLLER_TYPE_AMAZON_LUNA:
+ /* Amazon Luna Controller has a mic button under the guide button */
+ SDL_strlcat(mapping_string, "misc1:b15,", sizeof(mapping_string));
+ break;
+ case SDL_CONTROLLER_TYPE_GOOGLE_STADIA:
+ /* The Google Stadia controller has a share button and a Google Assistant button */
+ SDL_strlcat(mapping_string, "misc1:b15,", sizeof(mapping_string));
+ break;
             default:
                 if (vendor == 0 && product == 0) {
                     /* This is a Bluetooth Nintendo Switch Pro controller */
                     SDL_strlcat(mapping_string, "misc1:b15,", sizeof(mapping_string));
- } else if (vendor == USB_VENDOR_GOOGLE && product == USB_PRODUCT_GOOGLE_STADIA_CONTROLLER) {
- /* The Google Stadia controller has a share button and a Google Assistant button */
- SDL_strlcat(mapping_string, "misc1:b15,", sizeof(mapping_string));
                 }
                 break;
             }

```
