mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
LibusbUtils: Create ErrorWrap
This commit is contained in:
@ -23,7 +23,7 @@ public:
|
||||
Impl()
|
||||
{
|
||||
const int ret = libusb_init(&m_context);
|
||||
ASSERT_MSG(IOS_USB, ret == LIBUSB_SUCCESS, "Failed to init libusb: {}", libusb_error_name(ret));
|
||||
ASSERT_MSG(IOS_USB, ret == LIBUSB_SUCCESS, "Failed to init libusb: {}", ErrorWrap(ret));
|
||||
if (ret != LIBUSB_SUCCESS)
|
||||
return;
|
||||
|
||||
@ -118,4 +118,22 @@ ConfigDescriptor MakeConfigDescriptor(libusb_device* device, u8 config_num)
|
||||
#endif
|
||||
return {nullptr, [](auto) {}};
|
||||
}
|
||||
|
||||
const char* ErrorWrap::GetName() const
|
||||
{
|
||||
#if defined(__LIBUSB__)
|
||||
return libusb_error_name(m_error);
|
||||
#else
|
||||
return "__LIBUSB__ not defined";
|
||||
#endif
|
||||
}
|
||||
|
||||
const char* ErrorWrap::GetStrError() const
|
||||
{
|
||||
#if defined(__LIBUSB__)
|
||||
return libusb_strerror(static_cast<libusb_error>(m_error));
|
||||
#else
|
||||
return "__LIBUSB__ not defined";
|
||||
#endif
|
||||
}
|
||||
} // namespace LibusbUtils
|
||||
|
Reference in New Issue
Block a user