Gamepad Returning Incorrect Device Name

I got an 8BitDo Pro 2 gamepad, and for some reason, the device name is returning as “Xbox 360 Controller”

To figure out why this is happening, I got the SDL source and stepped through the debugger, and here is what I found:

First, I see that it gets the product string using HidD_GetProductString in hid.dll, and it returns "Controller (8BitDo Pro 2)" which is correct.

Then, it populates a Raw Input Device struct via GetRawInputDeviceInfoA(hDevice, RIDI_DEVICEINFO, &rdi, &size)

This is populating the device rdi.hid.dwVendorId with 0x045E and rdi.hid.dwProductId with 0x028E

In the controllers array, static const ControllerDescription_t arrControllers[], these values map to “Xbox 360 Controller”

{ MAKE_CONTROLLER_ID( 0x045e, 0x028e ), k_eControllerType_XBox360Controller, "Xbox 360 Controller" }, // Microsoft X-Box 360 pad

So what I’m wondering is why is it returning the Microsoft Xbox 360 Controller info? Is this maybe a Windows bug? (I do have an Xbox 360 wireless controller PC adapter, but I don’t think I’ve actually plugged it into this particular PC). Also, is there a reason why it’s pulling a hard coded name from a static array rather than using the product string value?

I discovered some new information. There’s a switch on the back of the 8BitDo Pro 2, with 4 options labeled “S”, “A”, “D”, “X”. When I change that switch it changes the name.

S → Nintendo Switch Pro Controller
A → PS4 Controller
D → 8BitDo Pro 2
X → Xbox 360 Controller

When D is selected, it finds nothing mapped to the vendor id and product id in the static array and uses the product string value.