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

Method close

app/src/IO/Drivers/USB.cpp:244–266  ·  view source on GitHub ↗

* @brief Closes the device, tears down all active transfers, and stops the read thread. The * QThread::started connections are detached here so the next open() cycle re-wires exactly one * read slot instead of double-connecting. */

Source from the content-addressed store, hash-verified

242 * read slot instead of double-connecting.
243 */
244void IO::Drivers::USB::close()
245{
246 Q_ASSERT(m_ctx != nullptr);
247 Q_ASSERT(m_activeInEp != 0 || m_handle == nullptr);
248
249 stopReadThread();
250 cancelAndDrainTransfers();
251 freeTransfers();
252
253 disconnect(&m_readThread, &QThread::started, this, &USB::readLoop);
254 disconnect(&m_readThread, &QThread::started, this, &USB::isoReadLoop);
255
256 if (m_handle) {
257 releaseInterface();
258 libusb_close(m_handle);
259 m_handle = nullptr;
260 }
261
262 m_activeInEp = 0;
263 m_activeOutEp = 0;
264
265 Q_EMIT configurationChanged();
266}
267
268/**
269 * @brief Returns true when a USB device handle is open.

Callers 15

Concepts.hFile · 0.45
disconnectDeviceMethod · 0.45
rebuildDevicesMethod · 0.45
closeFileMethod · 0.45
startTransferMethod · 0.45
cancelTransferMethod · 0.45
parseReceivedHeaderMethod · 0.45
handleTimeoutMethod · 0.45
handleDataAckByteMethod · 0.45
handleAckByteMethod · 0.45
resetStateMethod · 0.45
handleTimeoutMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected