windows enum refactor fixes

This commit is contained in:
Jack Andersen
2015-11-20 16:58:56 -10:00
parent d040e20096
commit 84b78f2962
7 changed files with 118 additions and 119 deletions

View File

@@ -33,7 +33,7 @@ class HIDDeviceWinUSB final : public IHIDDevice
const std::string& m_devPath;
std::mutex m_initMutex;
std::condition_variable m_initCond;
std::thread* m_thread;
std::thread m_thread;
bool _sendUSBInterruptTransfer(const uint8_t* data, size_t length)
{
@@ -196,13 +196,13 @@ public:
{
devImp.m_hidDev = this;
std::unique_lock<std::mutex> lk(m_initMutex);
DeviceToken::TDeviceType dType = token.getDeviceType();
if (dType == DeviceToken::DEVTYPE_USB)
m_thread = new std::thread(_threadProcUSBLL, this);
else if (dType == DeviceToken::DEVTYPE_BLUETOOTH)
m_thread = new std::thread(_threadProcBTLL, this);
else if (dType == DeviceToken::DEVTYPE_GENERICHID)
m_thread = new std::thread(_threadProcHID, this);
DeviceToken::DeviceType dType = token.getDeviceType();
if (dType == DeviceToken::DeviceType::USB)
m_thread = std::thread(_threadProcUSBLL, this);
else if (dType == DeviceToken::DeviceType::Bluetooth)
m_thread = std::thread(_threadProcBTLL, this);
else if (dType == DeviceToken::DeviceType::GenericHID)
m_thread = std::thread(_threadProcHID, this);
else
throw std::runtime_error("invalid token supplied to device constructor");
m_initCond.wait(lk);
@@ -211,8 +211,7 @@ public:
~HIDDeviceWinUSB()
{
m_runningTransferLoop = false;
m_thread->join();
delete m_thread;
m_thread.join();
}

View File

@@ -142,7 +142,7 @@ class HIDListenerWinUSB final : public IHIDListener
/* Whew!! that's a single device enumerated!! */
if (!m_finder._hasToken(DeviceInterfaceDetailData.wtf.DevicePath))
m_finder._insertToken(DeviceToken(DeviceToken::DEVTYPE_USB,
m_finder._insertToken(DeviceToken(DeviceToken::DeviceType::USB,
vid, pid, manuf, product,
DeviceInterfaceDetailData.wtf.DevicePath));