Changeset 8d22ef
- Timestamp:
- 01/11/12 11:38:03 (4 months ago)
- Branches:
- ('master', 'deebf2045e7119c339412580f37a1e653f7d5715')('controller-upgrade', '00f95d22e12d96ef089e0902ef62ae8ce841dc6f')
- Children:
- d7cce515ff9fca11b5be98bf926bcc355c949294
- Parents:
- 0c8de249d4250159c0b215c5d806d15d28de3bae
- git-author:
- Stefan Persson <stefan.persson@telldus.se>2012-01-11 11:38:03+01:00
- git-committer:
- Stefan Persson <stefan.persson@telldus.se>2012-01-11 11:38:03+01:00
- Location:
- telldus-core/service
- Files:
-
- 4 edited
-
ControllerManager.cpp (modified) (8 diffs)
-
DeviceManager.cpp (modified) (4 diffs)
-
TellStick_libftdi.cpp (modified) (4 diffs)
-
TelldusMain.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
telldus-core/service/ControllerManager.cpp
r673daf r8d22ef 93 93 94 94 std::list<TellStickDescriptor>::iterator it = list.begin(); 95 Log::notice("Before for-loop");96 95 for(; it != list.end(); ++it) { 97 Log::notice("Something in the loop");98 96 //Most backend only report non-opened devices. 99 97 //If they don't make sure we don't open them twice … … 101 99 ControllerMap::const_iterator cit = d->controllers.begin(); 102 100 for(; cit != d->controllers.end(); ++cit) { 103 Log::notice("Something in the second loop");104 101 TellStick *tellstick = reinterpret_cast<TellStick*>(cit->second); 105 102 if (!tellstick) { 106 Log::notice("No tellstick");107 103 continue; 108 104 } 109 105 if (tellstick->isSameAsDescriptor(*it)) { 110 106 found = true; 111 Log::notice("FOUND");112 107 break; 113 108 } … … 119 114 int controllerId = d->lastControllerId-1; 120 115 TellStick *controller = new TellStick(controllerId, d->event, *it); 121 Log::notice("Is it open?");122 116 if (!controller->isOpen()) { 123 Log::notice("Yes it was");124 117 delete controller; 125 118 continue; … … 137 130 TelldusCore::MutexLocker locker(&d->mutex); 138 131 for(ControllerMap::iterator it = d->controllers.begin(); it != d->controllers.end(); ++it) { 139 Log::notice("found a controller");140 132 TellStick *tellstick = reinterpret_cast<TellStick*>(it->second); 141 133 if (tellstick) { 142 Log::notice("found a tellstick");143 134 tellStickControllers.push_back(tellstick); 144 135 } … … 147 138 148 139 bool reloadControllers = false; 149 std::string noop = " noop";140 std::string noop = "N+"; 150 141 for(std::list<TellStick *>::iterator it = tellStickControllers.begin(); it != tellStickControllers.end(); ++it) { 151 142 int success = (*it)->send(noop); … … 153 144 Log::warning("TellStick query: Error in communication with TellStick, resetting USB"); 154 145 resetController(*it); 155 Log::notice("has reset");156 146 } 157 147 if(success == TELLSTICK_ERROR_COMMUNICATION || success == TELLSTICK_ERROR_NOT_FOUND){ 158 148 reloadControllers = true; 159 Log::notice("Set reload");160 149 } 161 150 } … … 163 152 if(!tellStickControllers.size() || reloadControllers){ 164 153 //no tellstick at all found, or controller was reset 165 Log:: warning("TellStick query: Rescanning USB ports");154 Log::debug("TellStick query: Rescanning USB ports"); //only log as debug, since this will happen all the time if no TellStick is connected 166 155 loadControllers(); 167 156 } … … 173 162 return true; //not tellstick, nothing to reset at the moment, just return true 174 163 } 175 Log::notice("resettingController"); 176 int success = controller->reset(); 177 Log::notice("Remove device"); 164 int success = tellstick->reset(); 178 165 deviceInsertedOrRemoved(tellstick->vid(), tellstick->pid(), tellstick->serial(), false); //remove from list and delete 179 Log::notice("Device removed");180 166 return success; 181 167 } -
telldus-core/service/DeviceManager.cpp
rdfae48 r8d22ef 6 6 #include "Strings.h" 7 7 #include "Message.h" 8 9 #include "common.h" //TODO remove? 10 #include "Log.h" //TODO remove? 8 #include "Log.h" 11 9 12 10 #include <map> … … 434 432 } 435 433 else{ 436 Log::notice("Getting a controller...");437 434 Controller *controller = d->controllerManager->getBestControllerById(device->getPreferredControllerId()); 438 Log::notice("Doing action...");439 435 if(!controller){ 440 Log::warning(" No controller found, rescanning USB ports");436 Log::warning("Trying to execute action, but no controller found. Rescanning USB ports"); 441 437 //no controller found, scan for one, and retry once 442 438 d->controllerManager->loadControllers(); … … 445 441 446 442 if(controller){ 447 Log::notice("But now, a controller!");448 443 retval = device->doAction(action, data, controller); 449 Log::notice("Retval received, %d.", retval);450 444 if(retval == TELLSTICK_ERROR_COMMUNICATION){ 451 Log::warning("Error in communication with TellStick , resetting USB");445 Log::warning("Error in communication with TellStick when executing action. Resetting USB"); 452 446 d->controllerManager->resetController(controller); 453 Log::notice("Controller reset");454 447 } 455 448 if(retval == TELLSTICK_ERROR_COMMUNICATION || retval == TELLSTICK_ERROR_NOT_FOUND){ 456 449 Log::warning("Rescanning USB ports"); 457 450 d->controllerManager->loadControllers(); 458 Log::notice("Loaded, get one");459 451 controller = d->controllerManager->getBestControllerById(device->getPreferredControllerId()); 460 452 if(!controller){ … … 462 454 return TELLSTICK_ERROR_NOT_FOUND; 463 455 } 464 Log::notice("Got a new, do action");465 456 retval = device->doAction(action, data, controller); //retry one more time 466 Log::notice("Did action");467 457 } 468 458 } else { -
telldus-core/service/TellStick_libftdi.cpp
r673daf r8d22ef 146 146 147 147 int TellStick::reset(){ 148 Log::notice("Resetting one");149 148 int success = ftdi_usb_reset( &d->ftHandle ); 150 Log::notice("Has reset one");151 149 if(success < 0){ 152 150 return TELLSTICK_ERROR_UNKNOWN; //-1 = FTDI reset failed, -2 = USB device unavailable … … 211 209 c = false; 212 210 } else if(ret != strMessage.length()) { 213 fprintf(stderr, "weird send length? retval %i instead of %d\n", 214 ret, (int)strMessage.length()); 211 Log::debug("Weird send length? retval %i instead of %d\n", ret, (int)strMessage.length()); 215 212 } 216 213 217 214 delete[] tempMessage; 218 if(strMessage == "noop"){ 215 Log::notice("Message: %s", strMessage.c_str()); 216 if(strMessage == "N+" && ((pid() == 0x0C31 && firmwareVersion() < 5) || (pid() == 0x0C30 && firmwareVersion() < 6))){ 217 //these firmware versions doesn't implement ack to noop, just check that the noop can be sent correctly 218 Log::notice("Too old firmware, accepting this"); 219 219 if(c){ 220 220 return TELLSTICK_SUCCESS; … … 224 224 } 225 225 } 226 Log::warning("Continuing"); 226 227 227 228 int retrycnt = 500; … … 301 302 ftdi_init(&ftdic); 302 303 303 Log::notice("Trying to find Duo");304 304 int ret = ftdi_usb_find_all(&ftdic, &devlist, vid, pid); 305 305 if (ret > 0) { 306 Log::notice("Curdev > 0");307 306 for (curdev = devlist; curdev != NULL; curdev = curdev->next) { 308 Log::notice("Something in the loop");309 307 ret = ftdi_usb_get_strings(&ftdic, curdev->dev, NULL, 0, NULL, 0, serialBuffer, 10); 310 Log::notice("Ret: %d",ret);311 //blir -9 efter felen, "get serial number failed", även lsusb -v ger annat svar än innan...?312 308 if (ret != 0) { 313 309 continue; -
telldus-core/service/TelldusMain.cpp
r673daf r8d22ef 44 44 EventRef janitor = d->eventHandler.addEvent(); //Used for regular cleanups 45 45 Timer supervisor(janitor); //Tells the janitor to go back to work 46 supervisor.setInterval(10); // Every 5 minutes TODO how often? 60*546 supervisor.setInterval(10); //TODO Once every minute 47 47 supervisor.start(); 48 48
Note: See TracChangeset
for help on using the changeset viewer.
