From 1348385a986bae9e1640aae4bd936b3730cc3f63 Mon Sep 17 00:00:00 2001 From: ndeadly <24677491+ndeadly@users.noreply.github.com> Date: Tue, 8 Sep 2020 10:54:57 +0200 Subject: [PATCH] btdrv-mitm: check controller name against recognised switch controller names before using vid/pid to match controllers --- .../source/controllers/controller_management.cpp | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/btdrv-mitm/source/controllers/controller_management.cpp b/btdrv-mitm/source/controllers/controller_management.cpp index 3553838..99753e4 100644 --- a/btdrv-mitm/source/controllers/controller_management.cpp +++ b/btdrv-mitm/source/controllers/controller_management.cpp @@ -40,11 +40,8 @@ namespace ams::controller { ControllerType Identify(const BluetoothDevicesSettings *device) { - for (auto hwId : SwitchController::hardware_ids) { - if ( (device->vid == hwId.vid) && (device->pid == hwId.pid) ) { - return ControllerType_Switch; - } - } + if (IsOfficialSwitchControllerName(device->name)) + return ControllerType_Switch; for (auto hwId : WiiController::hardware_ids) { 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; }