Do not test rtl_wmbus for -f option if CMD is overridden.

pull/1146/head
Fredrik Öhrström 2024-01-18 15:40:15 +01:00
rodzic 4f21c04804
commit 42511190e7
1 zmienionych plików z 16 dodań i 14 usunięć

Wyświetl plik

@ -160,22 +160,24 @@ shared_ptr<BusDevice> openRTLWMBUS(Detected detected,
}
}
string out;
invokeShellCaptureOutput(rtl_wmbus, { "--help" }, {}, &out, true);
debug("(rtlwmbus) help %s\n", out.c_str());
string add_f = "";
if (out.find("-f exit if flow") != string::npos)
{
add_f = " -f";
}
else
{
warning("Warning! rtl_wbus executable lacks -f option! Without this option rtl_wmbus cannot detect when rtl-sdr stops working.\n"
"Please upgrade rtl_wmbus.\n");
}
if (command == "")
{
string add_f = "";
string out;
vector<string> args;
args.push_back("-h");
invokeShellCaptureOutput(rtl_wmbus, { "-h" }, {}, &out, true);
debug("(rtlwmbus) help %s\n", out.c_str());
if (out.find("-f exit if flow") != string::npos)
{
add_f = " -f";
}
else
{
warning("Warning! rtl_wbus executable lacks -f option! Without this option rtl_wmbus cannot detect when rtl-sdr stops working.\n"
"Please upgrade rtl_wmbus.\n");
}
if (!force_freq)
{
command = "ERRFILE=$(mktemp --suffix=_wmbusmeters_rtlsdr) ; echo ERRFILE=$ERRFILE ; date -Iseconds > $ERRFILE ; tail -f $ERRFILE & "+rtl_sdr+" "+ppm+" -d "+to_string(id)+" -f "+freq+" -s 1.6e6 - 2>>$ERRFILE | "+rtl_wmbus+" -s"+add_f;