Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Merge pull request #4408 from leoetlino/usb
IOS: USB support (OH0, USB_VEN, USB_HID)
- Loading branch information
Showing
60 changed files
with
3,326 additions
and
859 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| // Copyright 2017 Dolphin Emulator Project | ||
| // Licensed under GPLv2+ | ||
| // Refer to the license.txt file included. | ||
|
|
||
| #include <libusb.h> | ||
| #include <memory> | ||
| #include <mutex> | ||
|
|
||
| #include "Common/LibusbContext.h" | ||
| #include "Common/MsgHandler.h" | ||
|
|
||
| namespace LibusbContext | ||
| { | ||
| static std::shared_ptr<libusb_context> s_libusb_context; | ||
| static std::once_flag s_context_initialized; | ||
|
|
||
| static libusb_context* Create() | ||
| { | ||
| libusb_context* context; | ||
| const int ret = libusb_init(&context); | ||
| if (ret < LIBUSB_SUCCESS) | ||
| { | ||
| bool is_windows = false; | ||
| #ifdef _WIN32 | ||
| is_windows = true; | ||
| #endif | ||
| if (is_windows && ret == LIBUSB_ERROR_NOT_FOUND) | ||
| PanicAlertT("Failed to initialize libusb because usbdk is not installed."); | ||
| else | ||
| PanicAlertT("Failed to initialize libusb: %s", libusb_error_name(ret)); | ||
| return nullptr; | ||
| } | ||
| return context; | ||
| } | ||
|
|
||
| std::shared_ptr<libusb_context> Get() | ||
| { | ||
| std::call_once(s_context_initialized, []() { | ||
| s_libusb_context.reset(Create(), [](auto* context) { | ||
| if (context != nullptr) | ||
| libusb_exit(context); | ||
| }); | ||
| }); | ||
| return s_libusb_context; | ||
| } | ||
| } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| // Copyright 2017 Dolphin Emulator Project | ||
| // Licensed under GPLv2+ | ||
| // Refer to the license.txt file included. | ||
|
|
||
| #include <memory> | ||
|
|
||
| struct libusb_context; | ||
|
|
||
| namespace LibusbContext | ||
| { | ||
| // libusb on Windows is limited to only a single context. Trying to open more | ||
| // than one can cause issues with device enumerations. | ||
| // libusb is thread-safe so this context can be safely used from different threads. | ||
| std::shared_ptr<libusb_context> Get(); | ||
| } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,7 +31,6 @@ enum LOG_TYPE | |
| IOS_DI, | ||
| IOS_ES, | ||
| IOS_FILEIO, | ||
| IOS_HID, | ||
| IOS_NET, | ||
| IOS_SD, | ||
| IOS_SSL, | ||
|
|
||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.