BTReal: Treat libusb_get_string_descriptor_ascii failure as non-fatal warning
This commit is contained in:
parent
559f5a6dfb
commit
a23a7f7b10
|
@ -106,19 +106,42 @@ std::optional<IPCReply> BluetoothRealDevice::Open(const OpenRequest& request)
|
|||
unsigned char manufacturer[50] = {}, product[50] = {}, serial_number[50] = {};
|
||||
const int manufacturer_ret = libusb_get_string_descriptor_ascii(
|
||||
m_handle, device_descriptor.iManufacturer, manufacturer, sizeof(manufacturer));
|
||||
if (manufacturer_ret < LIBUSB_SUCCESS)
|
||||
{
|
||||
WARN_LOG_FMT(IOS_WIIMOTE,
|
||||
"Failed to get string for manufacturer descriptor {:02x} for device "
|
||||
"{:04x}:{:04x} (rev {:x}): {}",
|
||||
device_descriptor.iManufacturer, device_descriptor.idVendor,
|
||||
device_descriptor.idProduct, device_descriptor.bcdDevice,
|
||||
LibusbUtils::ErrorWrap(manufacturer_ret));
|
||||
manufacturer[0] = '?';
|
||||
manufacturer[1] = '\0';
|
||||
}
|
||||
const int product_ret = libusb_get_string_descriptor_ascii(
|
||||
m_handle, device_descriptor.iProduct, product, sizeof(product));
|
||||
if (product_ret < LIBUSB_SUCCESS)
|
||||
{
|
||||
WARN_LOG_FMT(IOS_WIIMOTE,
|
||||
"Failed to get string for product descriptor {:02x} for device "
|
||||
"{:04x}:{:04x} (rev {:x}): {}",
|
||||
device_descriptor.iProduct, device_descriptor.idVendor,
|
||||
device_descriptor.idProduct, device_descriptor.bcdDevice,
|
||||
LibusbUtils::ErrorWrap(product_ret));
|
||||
product[0] = '?';
|
||||
product[1] = '\0';
|
||||
}
|
||||
const int serial_ret = libusb_get_string_descriptor_ascii(
|
||||
m_handle, device_descriptor.iSerialNumber, serial_number, sizeof(serial_number));
|
||||
if (manufacturer_ret < LIBUSB_SUCCESS || product_ret < LIBUSB_SUCCESS ||
|
||||
serial_ret < LIBUSB_SUCCESS)
|
||||
if (serial_ret < LIBUSB_SUCCESS)
|
||||
{
|
||||
ERROR_LOG_FMT(IOS_WIIMOTE,
|
||||
"Failed to get descriptor for device {:04x}:{:04x} (rev {:x}): {}/{}/{}",
|
||||
device_descriptor.idVendor, device_descriptor.idProduct,
|
||||
device_descriptor.bcdDevice, LibusbUtils::ErrorWrap(manufacturer_ret),
|
||||
LibusbUtils::ErrorWrap(product_ret), LibusbUtils::ErrorWrap(serial_ret));
|
||||
return true;
|
||||
WARN_LOG_FMT(IOS_WIIMOTE,
|
||||
"Failed to get string for serial number descriptor {:02x} for device "
|
||||
"{:04x}:{:04x} (rev {:x}): {}",
|
||||
device_descriptor.iSerialNumber, device_descriptor.idVendor,
|
||||
device_descriptor.idProduct, device_descriptor.bcdDevice,
|
||||
LibusbUtils::ErrorWrap(serial_ret));
|
||||
serial_number[0] = '?';
|
||||
serial_number[1] = '\0';
|
||||
}
|
||||
NOTICE_LOG_FMT(IOS_WIIMOTE, "Using device {:04x}:{:04x} (rev {:x}) for Bluetooth: {} {} {}",
|
||||
device_descriptor.idVendor, device_descriptor.idProduct,
|
||||
|
|
Loading…
Reference in New Issue