Merge pull request #4385 from leoetlino/disable-bt-check
Disable descriptor check for BT passthrough in some cases
This commit is contained in:
commit
234691abf7
|
@ -36,7 +36,7 @@ static void EnqueueReply(const u32 command_address)
|
||||||
WII_IPC_HLE_Interface::EnqueueReply(command_address, 0, CoreTiming::FromThread::ANY);
|
WII_IPC_HLE_Interface::EnqueueReply(command_address, 0, CoreTiming::FromThread::ANY);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool IsWantedDevice(libusb_device_descriptor& descriptor)
|
static bool IsWantedDevice(const libusb_device_descriptor& descriptor)
|
||||||
{
|
{
|
||||||
const int vid = SConfig::GetInstance().m_bt_passthrough_vid;
|
const int vid = SConfig::GetInstance().m_bt_passthrough_vid;
|
||||||
const int pid = SConfig::GetInstance().m_bt_passthrough_pid;
|
const int pid = SConfig::GetInstance().m_bt_passthrough_pid;
|
||||||
|
@ -45,6 +45,18 @@ static bool IsWantedDevice(libusb_device_descriptor& descriptor)
|
||||||
return descriptor.idVendor == vid && descriptor.idProduct == pid;
|
return descriptor.idVendor == vid && descriptor.idProduct == pid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool IsBluetoothDevice(const libusb_interface_descriptor& descriptor)
|
||||||
|
{
|
||||||
|
constexpr u8 SUBCLASS = 0x01;
|
||||||
|
constexpr u8 PROTOCOL_BLUETOOTH = 0x01;
|
||||||
|
if (SConfig::GetInstance().m_bt_passthrough_vid != -1 &&
|
||||||
|
SConfig::GetInstance().m_bt_passthrough_pid != -1)
|
||||||
|
return true;
|
||||||
|
return descriptor.bInterfaceClass == LIBUSB_CLASS_WIRELESS &&
|
||||||
|
descriptor.bInterfaceSubClass == SUBCLASS &&
|
||||||
|
descriptor.bInterfaceProtocol == PROTOCOL_BLUETOOTH;
|
||||||
|
}
|
||||||
|
|
||||||
CWII_IPC_HLE_Device_usb_oh1_57e_305_real::CWII_IPC_HLE_Device_usb_oh1_57e_305_real(
|
CWII_IPC_HLE_Device_usb_oh1_57e_305_real::CWII_IPC_HLE_Device_usb_oh1_57e_305_real(
|
||||||
u32 device_id, const std::string& device_name)
|
u32 device_id, const std::string& device_name)
|
||||||
: CWII_IPC_HLE_Device_usb_oh1_57e_305_base(device_id, device_name)
|
: CWII_IPC_HLE_Device_usb_oh1_57e_305_base(device_id, device_name)
|
||||||
|
@ -94,10 +106,7 @@ IPCCommandResult CWII_IPC_HLE_Device_usb_oh1_57e_305_real::Open(u32 command_addr
|
||||||
|
|
||||||
const libusb_interface& interface = config_descriptor->interface[INTERFACE];
|
const libusb_interface& interface = config_descriptor->interface[INTERFACE];
|
||||||
const libusb_interface_descriptor& descriptor = interface.altsetting[0];
|
const libusb_interface_descriptor& descriptor = interface.altsetting[0];
|
||||||
if (descriptor.bInterfaceClass == LIBUSB_CLASS_WIRELESS &&
|
if (IsBluetoothDevice(descriptor) && IsWantedDevice(device_descriptor) && OpenDevice(device))
|
||||||
descriptor.bInterfaceSubClass == SUBCLASS &&
|
|
||||||
descriptor.bInterfaceProtocol == PROTOCOL_BLUETOOTH && IsWantedDevice(device_descriptor) &&
|
|
||||||
OpenDevice(device))
|
|
||||||
{
|
{
|
||||||
unsigned char manufacturer[50] = {}, product[50] = {}, serial_number[50] = {};
|
unsigned char manufacturer[50] = {}, product[50] = {}, serial_number[50] = {};
|
||||||
libusb_get_string_descriptor_ascii(m_handle, device_descriptor.iManufacturer, manufacturer,
|
libusb_get_string_descriptor_ascii(m_handle, device_descriptor.iManufacturer, manufacturer,
|
||||||
|
|
|
@ -50,8 +50,6 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static constexpr u8 INTERFACE = 0x00;
|
static constexpr u8 INTERFACE = 0x00;
|
||||||
static constexpr u8 SUBCLASS = 0x01;
|
|
||||||
static constexpr u8 PROTOCOL_BLUETOOTH = 0x01;
|
|
||||||
// Arbitrarily chosen value that allows emulated software to send commands often enough
|
// Arbitrarily chosen value that allows emulated software to send commands often enough
|
||||||
// so that the sync button event is triggered at least every 200ms.
|
// so that the sync button event is triggered at least every 200ms.
|
||||||
// Ideally this should be equal to 0, so we don't trigger unnecessary libusb transfers.
|
// Ideally this should be equal to 0, so we don't trigger unnecessary libusb transfers.
|
||||||
|
|
Loading…
Reference in New Issue