Merge branch 'master' into AddAlarm

pull/143/head
Fredrik Öhrström 2020-08-09 17:18:37 +02:00
commit f9ab051a40
3 zmienionych plików z 11 dodań i 13 usunięć

Wyświetl plik

@ -97,7 +97,9 @@ provided you with this binary. Read the full license for all details.
// We want the data visible in the log file asap!
setbuf(stdout, NULL);
startUsingCommandline(cmdline.get());
exit(0);
}
error("(main) internal error\n");
}
bool startUsingCommandline(Configuration *config)
@ -372,7 +374,6 @@ LIST_OF_METERS
}
manager->waitForStop();
if (config->daemon) {
notice("(wmbusmeters) shutting down\n");
}

Wyświetl plik

@ -969,6 +969,7 @@ static int openSerialTTY(const char *tty, int baud_rate)
int rc = 0;
speed_t speed = 0;
struct termios tios;
//int DTR_flag = TIOCM_DTR;
int fd = open(tty, O_RDWR | O_NOCTTY | O_NONBLOCK);
if (fd == -1) {
@ -1021,6 +1022,11 @@ static int openSerialTTY(const char *tty, int baud_rate)
rc = tcsetattr(fd, TCSANOW, &tios);
if (rc < 0) goto err;
// This code can toggle DTR... maybe necessary
// for the pl2303 usb2serial driver/device.
//rc = ioctl(fd, TIOCMBIC, &DTR_flag);
//if (rc != 0) goto err;
return fd;
err:

Wyświetl plik

@ -179,18 +179,9 @@ void stopBackgroundShell(int pid)
{
assert(pid > 0);
// This will actually stop the entire process group.
// But it is ok, for now, since this function is
// only called when wmbusmeters is exiting.
// If we send sigint only to pid, then this will
// not always propagate properly to the child processes
// of the bgshell, ie rtl_sdr and rtl_wmbus, thus
// leaving those hanging in limbo and messing everything up.
// The solution for now is to send sigint to 0, which
// means send sigint to the whole process group that the
// sender belongs to.
int rc = kill(0, SIGINT);
// Sending SIGTERM to the pid will properly shut down the subshell
// and its contents.
int rc = kill(pid, SIGTERM);
if (rc < 0) {
debug("(bgshell) could not sigint pid %d, exited already?\n", pid);
return;