From c35be687c0ce2285842ccc1521a247b06c284b88 Mon Sep 17 00:00:00 2001 From: Micke Prag Date: Wed, 25 Jan 2012 17:41:27 +0100 Subject: [PATCH] pid=0 and vid=0 means all. This way we can easily disconnect all controllers or initiate a rescan --- telldus-core/service/ControllerManager.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/telldus-core/service/ControllerManager.cpp b/telldus-core/service/ControllerManager.cpp index 6865e450..fc46b350 100644 --- a/telldus-core/service/ControllerManager.cpp +++ b/telldus-core/service/ControllerManager.cpp @@ -33,6 +33,20 @@ ControllerManager::~ControllerManager() { } void ControllerManager::deviceInsertedOrRemoved(int vid, int pid, const std::string &serial, bool inserted) { + if (vid == 0x0 && pid == 0x0) { //All + if (inserted) { + loadControllers(); + } else { + //Disconnect all + TelldusCore::MutexLocker locker(&d->mutex); + while(d->controllers.size()) { + ControllerMap::iterator it = d->controllers.begin(); + delete it->second; + d->controllers.erase(it); + } + } + return; + } if (vid != 0x1781) { return; }