btdrv-mitm: check controller name against recognised switch controller names before using vid/pid to match controllers

This commit is contained in:
ndeadly 2020-09-08 10:54:57 +02:00
parent 41861b9d29
commit 1348385a98

View file

@ -40,11 +40,8 @@ namespace ams::controller {
ControllerType Identify(const BluetoothDevicesSettings *device) { ControllerType Identify(const BluetoothDevicesSettings *device) {
for (auto hwId : SwitchController::hardware_ids) { if (IsOfficialSwitchControllerName(device->name))
if ( (device->vid == hwId.vid) && (device->pid == hwId.pid) ) { return ControllerType_Switch;
return ControllerType_Switch;
}
}
for (auto hwId : WiiController::hardware_ids) { for (auto hwId : WiiController::hardware_ids) {
if ( (device->vid == hwId.vid) && (device->pid == hwId.pid) ) { if ( (device->vid == hwId.vid) && (device->pid == hwId.pid) ) {
@ -94,10 +91,6 @@ namespace ams::controller {
} }
} }
// Check for third party switch controllers or official switch controllers that have been assigned garbage IDs
if (IsOfficialSwitchControllerName(device->name))
return ControllerType_Switch;
return ControllerType_Unknown; return ControllerType_Unknown;
} }