File tree Expand file tree Collapse file tree 5 files changed +24
-3
lines changed
Expand file tree Collapse file tree 5 files changed +24
-3
lines changed Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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 }
Original file line number Diff line number Diff 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 ¶ms) {
Original file line number Diff line number Diff 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 ¶ms) {
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments