Non-working implies opened first.

pull/156/head
Fredrik Öhrström 2020-09-25 17:02:42 +02:00
rodzic 0d9d856b6a
commit 1022a24799
3 zmienionych plików z 8 dodań i 7 usunięć

Wyświetl plik

@ -525,7 +525,7 @@ void check_for_dead_wmbus_devices(Configuration *config)
not_working.push_back(w.get());
if (config->use_auto_detect)
{
info("Lost %s closing %s\n", w->device().c_str(), toString(w->type()));
notice("Lost %s closing %s\n", w->device().c_str(), toString(w->type()));
}
}
}
@ -863,7 +863,7 @@ bool start(Configuration *config)
if (!meter_manager_->hasMeters())
{
notice("No meters configured. Printing id:s of all telegrams heard!\n\n");
notice("No meters configured. Printing id:s of all telegrams heard!\n");
meter_manager_->onTelegram([](vector<uchar> frame) {
Telegram t;

Wyświetl plik

@ -464,6 +464,7 @@ AccessCheck SerialDeviceCommand::open(bool fail_if_not_ok)
{
expectAscii();
bool ok = invokeBackgroundShell("/bin/sh", args_, envs_, &fd_, &pid_);
assert(fd_ >= 0);
if (!ok) return AccessCheck::NotThere;
setIsStdin();
verbose("(serialcmd) opened %s pid %d fd %d\n", command_.c_str(), pid_, fd_);
@ -790,7 +791,7 @@ void SerialCommunicationManagerImp::removeNonWorkingSerialDevices()
for (auto i = serial_devices_.begin(); i != serial_devices_.end(); )
{
if (!(*i)->working())
if ((*i)->opened() && !(*i)->working())
{
i = serial_devices_.erase(i);
}
@ -927,7 +928,7 @@ void *SerialCommunicationManagerImp::eventLoop()
trace("(SERIAL) select read on fd %d\n", sd->fd());
FD_SET(sd->fd(), &readfds);
}
if (!sd->working()) all_working = false;
if (sd->opened() && !sd->working()) all_working = false;
}
}
@ -995,13 +996,13 @@ void *SerialCommunicationManagerImp::eventLoop()
for (shared_ptr<SerialDevice> &sd : serial_devices_)
{
if (!sd->working()) non_working.push_back(sd);
if (sd->opened() && !sd->working()) non_working.push_back(sd);
}
}
for (shared_ptr<SerialDevice> &sd : non_working)
{
debug("(serial) closing non working fd=%d\n", sd->fd());
debug("(serial) closing non working fd=%d \"%s\"\n", sd->fd(), sd->device().c_str());
sd->close();
}

Wyświetl plik

@ -3383,7 +3383,7 @@ void WMBusCommonImplementation::disconnectedFromDevice()
{
if (is_working_)
{
debug("(wmbus) disconnect %s closing %s\n", device().c_str(), toString(type()));
debug("(wmbus) disconnected %s %s\n", device().c_str(), toString(type()));
is_working_ = false;
}
}