* @brief Stops the read thread, closes the device handle, and clears usage info. */
| 63 | * @brief Stops the read thread, closes the device handle, and clears usage info. |
| 64 | */ |
| 65 | void IO::Drivers::HID::cleanupDevice() |
| 66 | { |
| 67 | m_running = false; |
| 68 | |
| 69 | if (m_readThread.isRunning()) { |
| 70 | m_readThread.quit(); |
| 71 | m_readThread.wait(); |
| 72 | } |
| 73 | |
| 74 | if (m_handle) { |
| 75 | hid_close(m_handle); |
| 76 | m_handle = nullptr; |
| 77 | } |
| 78 | |
| 79 | m_usagePage.clear(); |
| 80 | m_usage.clear(); |
| 81 | } |
| 82 | |
| 83 | /** |
| 84 | * @brief Closes the device and tears down the hidapi enumeration cache. |