mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-05-08 11:37:53 +03:00
LibusbUtils: Create ErrorWrap
This commit is contained in:
parent
0d8772ccbe
commit
457fcbaf5e
2 changed files with 44 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue