mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-22 22:00:39 -06:00
Use a single libusb context
libusb on Windows is limited to only a single context. Trying to open more than one can cause device enumerations to fail randomly. libusb is thread-safe and we don't use the manual polling support (with `poll()`) so this should be safe.
This commit is contained in:
15
Source/Core/Common/LibusbContext.h
Normal file
15
Source/Core/Common/LibusbContext.h
Normal file
@ -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();
|
||||
}
|
Reference in New Issue
Block a user