Skip to content

Commit c00a976

Browse files
committed
Merge pull request #211 from OSVR/dont-always-hardware-detect
Don't always hardware detect
2 parents e66da27 + 6b5d151 commit c00a976

File tree

5 files changed

+24
-3
lines changed

5 files changed

+24
-3
lines changed

inc/osvr/Server/Server.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,13 @@ namespace server {
137137
/// @brief Load all auto-loadable plugins.
138138
OSVR_SERVER_EXPORT void loadAutoPlugins();
139139

140+
/// @brief Adds the behavior that hardware detection should take place
141+
/// on client connection.
142+
///
143+
/// Safe to call from any thread, even when server is running, though it
144+
/// makes the most sense as a startup option.
145+
OSVR_SERVER_EXPORT void setHardwareDetectOnConnection();
146+
140147
/// @brief Instantiate the named driver with parameters.
141148
/// @param plugin The name of a plugin.
142149
/// @param driver The name of a driver registered by the plugin for

src/osvr/Server/ConfigureServer.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,11 @@ namespace server {
149149
m_server = Server::create(connPtr);
150150
}
151151

152-
if (sleepTime > 0.0)
152+
if (sleepTime > 0.0) {
153153
m_server->setSleepTime(sleepTime);
154+
}
155+
156+
m_server->setHardwareDetectOnConnection();
154157

155158
return m_server;
156159
}

src/osvr/Server/Server.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ namespace server {
6666

6767
void Server::loadAutoPlugins() { m_impl->loadAutoPlugins(); }
6868

69+
void Server::setHardwareDetectOnConnection() {
70+
m_impl->setHardwareDetectOnConnection();
71+
}
72+
6973
void Server::instantiateDriver(std::string const &plugin,
7074
std::string const &driver,
7175
std::string const &params) {

src/osvr/Server/ServerImpl.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,9 @@ namespace server {
9090
&ServerImpl::m_handleUpdatedRoute, this);
9191

9292
// Things to do when we get a new incoming connection
93+
// No longer doing hardware detect unconditionally here - see triggerHardwareDetect()
9394
m_commonComponent =
9495
m_systemDevice->addComponent(common::CommonComponent::create());
95-
m_commonComponent->registerPingHandler(
96-
[&] { triggerHardwareDetect(); });
9796
m_commonComponent->registerPingHandler([&] { m_sendTree(); });
9897

9998
// Set up the default display descriptor.
@@ -157,6 +156,11 @@ namespace server {
157156

158157
void ServerImpl::loadAutoPlugins() { m_ctx->loadPlugins(); }
159158

159+
void ServerImpl::setHardwareDetectOnConnection() {
160+
m_commonComponent->registerPingHandler(
161+
[&] { triggerHardwareDetect(); });
162+
}
163+
160164
void ServerImpl::instantiateDriver(std::string const &plugin,
161165
std::string const &driver,
162166
std::string const &params) {

src/osvr/Server/ServerImpl.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ namespace server {
8484
/// @brief Load all auto-loadable plugins.
8585
void loadAutoPlugins();
8686

87+
/// @copydoc Server::setHardwareDetectOnConnection()
88+
void setHardwareDetectOnConnection();
89+
8790
/// @copydoc Server::triggerHardwareDetect()
8891
void triggerHardwareDetect();
8992

0 commit comments

Comments
 (0)