MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / cleanupDevice

Method cleanupDevice

app/src/IO/Drivers/HID.cpp:65–81  ·  view source on GitHub ↗

* @brief Stops the read thread, closes the device handle, and clears usage info. */

Source from the content-addressed store, hash-verified

63 * @brief Stops the read thread, closes the device handle, and clears usage info.
64 */
65void 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.

Callers

nothing calls this directly

Calls 3

waitMethod · 0.80
hid_closeFunction · 0.50
clearMethod · 0.45

Tested by

no test coverage detected