# SDL: testcontroller: update the controller name when it's opened as a gamepad

**URL:** <https://discourse.libsdl.org/t/sdl-testcontroller-update-the-controller-name-when-its-opened-as-a-gamepad/55445>\
**Category:** SDL Commits\
**Created:** [November 5, 2024, 7:43pm UTC](https://discourse.libsdl.org/t/sdl-testcontroller-update-the-controller-name-when-its-opened-as-a-gamepad/55445 "2024-11-05T19:43:58Z")\
**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:** [November 5, 2024, 7:43pm UTC](https://discourse.libsdl.org/t/sdl-testcontroller-update-the-controller-name-when-its-opened-as-a-gamepad/55445/1 "2024-11-05T19:43:58Z")

</div>

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

```diff
From ecfd143a26967dfc5e2d1f5678b3ed9ef6970372 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Tue, 5 Nov 2024 11:36:17 -0800
Subject: [PATCH] testcontroller: update the controller name when it's opened
 as a gamepad

---
 test/testcontroller.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/test/testcontroller.c b/test/testcontroller.c
index 74c4ed10dc717..6b5874156b35d 100644
--- a/test/testcontroller.c
+++ b/test/testcontroller.c
@@ -1077,6 +1077,7 @@ static void HandleGamepadAdded(SDL_JoystickID id, bool verbose)
     }
 
     HandleGamepadRemapped(id);
+ SetController(id);
 }
 
 static void HandleGamepadRemoved(SDL_JoystickID id)

```
