htc: implement mux side of connecting (and more)

This commit is contained in:
Michael Scire
2021-02-09 19:07:51 -08:00
committed by SciresM
parent 70aae4e27a
commit 42cf3f50d7
24 changed files with 474 additions and 12 deletions

View File

@@ -55,6 +55,20 @@ namespace ams::htclow::driver {
return ResultSuccess();
}
void DriverManager::CloseDriver() {
/* Lock ourselves. */
std::scoped_lock lk(m_mutex);
/* Clear our driver type. */
m_driver_type = std::nullopt;
/* Close our driver. */
if (m_open_driver != nullptr) {
m_open_driver->Close();
m_open_driver = nullptr;
}
}
impl::DriverType DriverManager::GetDriverType() {
/* Lock ourselves. */
std::scoped_lock lk(m_mutex);
@@ -69,6 +83,10 @@ namespace ams::htclow::driver {
return m_open_driver;
}
void DriverManager::Cancel() {
m_open_driver->CancelSendReceive();
}
void DriverManager::SetDebugDriver(IDriver *driver) {
m_debug_driver = driver;
m_driver_type = impl::DriverType::Debug;