diff --git a/Makefile b/Makefile index b76a202..c5ba2fa 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,8 @@ CXXFLAGS:= -std=gnu++17 -Wall -O3 -MMD -MP -ggdb -fno-omit-frame-pointer -Iext/CLI11 \ -Iext/fmt-5.2.1/include/ -Iext/powerblog/ext/simplesocket -Iext/powerblog/ext/ \ -I/usr/local/opt/openssl/include/ \ - -Iext/sgp4/libsgp4/ + -Iext/sgp4/libsgp4/ \ + -I/usr/local/include # CXXFLAGS += -Wno-delete-non-virtual-dtor @@ -23,29 +24,29 @@ navparse: navparse.o ext/fmt-5.2.1/src/format.o $(H2OPP) $(SIMPLESOCKETS) minicu $(CXX) -std=gnu++17 $^ -o $@ -pthread -L/usr/local/lib -L/usr/local/opt/openssl/lib/ -lh2o-evloop -lssl -lcrypto -lz -lcurl -lprotobuf $(WSLAY) navdump: navdump.o ext/fmt-5.2.1/src/format.o bits.o navmon.pb.o gps.o ephemeris.o beidou.o glonass.o navmon.o $(patsubst %.cc,%.o,$(wildcard ext/sgp4/libsgp4/*.cc)) tle.o - $(CXX) -std=gnu++17 $^ -o $@ -pthread -lprotobuf + $(CXX) -std=gnu++17 $^ -o $@ -L/usr/local/lib -pthread -lprotobuf navdisplay: navdisplay.o ext/fmt-5.2.1/src/format.o bits.o navmon.pb.o gps.o ephemeris.o beidou.o glonass.o ephemeris.o navmon.o - $(CXX) -std=gnu++17 $^ -o $@ -pthread -lprotobuf -lncurses + $(CXX) -std=gnu++17 $^ -o $@ -L/usr/local/lib -pthread -lprotobuf -lncurses navnexus: navnexus.o ext/fmt-5.2.1/src/format.o $(SIMPLESOCKETS) ubx.o bits.o navmon.pb.o storage.o - $(CXX) -std=gnu++17 $^ -o $@ -pthread -lprotobuf + $(CXX) -std=gnu++17 $^ -o $@ -L/usr/local/lib -pthread -lprotobuf navrecv: navrecv.o ext/fmt-5.2.1/src/format.o $(SIMPLESOCKETS) navmon.pb.o storage.o - $(CXX) -std=gnu++17 $^ -o $@ -pthread -lprotobuf + $(CXX) -std=gnu++17 $^ -o $@ -L/usr/local/lib -pthread -lprotobuf tlecatch: tlecatch.o $(patsubst %.cc,%.o,$(wildcard ext/sgp4/libsgp4/*.cc)) - $(CXX) -std=gnu++17 $^ -o $@ -pthread -lprotobuf + $(CXX) -std=gnu++17 $^ -o $@ -L/usr/local/lib -pthread -lprotobuf navmon.pb.cc: navmon.proto protoc --cpp_out=./ navmon.proto ubxtool: navmon.pb.o ubxtool.o ubx.o bits.o ext/fmt-5.2.1/src/format.o galileo.o gps.o beidou.o navmon.o ephemeris.o - $(CXX) -std=gnu++17 $^ -o $@ -lprotobuf + $(CXX) -std=gnu++17 $^ -o $@ -L/usr/local/lib -lprotobuf testrunner: navmon.pb.o testrunner.o ubx.o bits.o ext/fmt-5.2.1/src/format.o galileo.o gps.o beidou.o ephemeris.o - $(CXX) -std=gnu++17 $^ -o $@ -lprotobuf + $(CXX) -std=gnu++17 $^ -o $@ -L/usr/local/lib -lprotobuf check: testrunner ./testrunner diff --git a/navmon.cc b/navmon.cc index cf5a761..76661d9 100644 --- a/navmon.cc +++ b/navmon.cc @@ -1,4 +1,5 @@ #include "navmon.hh" +#include #include #include #include diff --git a/navnexus.cc b/navnexus.cc index f5cf65a..1d9e722 100644 --- a/navnexus.cc +++ b/navnexus.cc @@ -14,6 +14,7 @@ #include #include "storage.hh" #include +#include using namespace std; @@ -45,7 +46,7 @@ vector getSources() } if(result->d_name[0] != '.') { uint64_t src; - if(sscanf(result->d_name, "%08llx", &src)==1) + if(sscanf(result->d_name, "%08" PRIx64, &src)==1) ret.push_back(src); } } diff --git a/navparse.cc b/navparse.cc index 737d018..1afdbee 100644 --- a/navparse.cc +++ b/navparse.cc @@ -426,6 +426,7 @@ struct InfluxPusher cout<<"Not sending data to influxdb"< void addValue( const pair,SVStat>& ent, string_view name, const T& value) { @@ -931,11 +932,11 @@ try }); h2s.addDirectory("/", argc > 2 ? argv[2] : "./html/"); - int port = argc > 1 ? atoi(argv[1]) : 29599; - std::thread ws([&h2s, port]() { + const char *address = argc > 1 ? argv[1] : "127.0.0.1:29599"; + std::thread ws([&h2s, address]() { auto actx = h2s.addContext(); - h2s.addListener(ComboAddress("::", port), actx); - cout<<"Listening on port "<< port < getUBXMessage(int fd) { static int logfile; @@ -284,7 +287,7 @@ void readSome(int fd) struct termios g_oldtio; -int initFD(const char* fname) +int initFD(const char* fname, bool doRTSCTS) { int fd; if(string(fname) != "stdin" && string(fname) != "/dev/stdin" && isCharDevice(fname)) { @@ -300,7 +303,9 @@ int initFD(const char* fname) } bzero(&newtio, sizeof(newtio)); - newtio.c_cflag = BAUDRATE | CRTSCTS | CS8 | CLOCAL | CREAD; + newtio.c_cflag = BAUDRATE | CS8 | CLOCAL | CREAD; + if (doRTSCTS) + newtio.c_cflag |= CRTSCTS; newtio.c_iflag = IGNPAR; newtio.c_oflag = 0; @@ -335,7 +340,12 @@ int main(int argc, char** argv) CLI::App app("ubxtool"); vector serial; - bool doGPS{true}, doGalileo{true}, doGlonass{false}, doBeidou{true}, doReset{false}, doWait{false}; + bool doGPS{true}, doGalileo{true}, doGlonass{false}, doBeidou{true}, doReset{false}, doWait{false}, doRTSCTS{true}; + +#ifdef OpenBSD + doRTSCTS = false; +#endif + app.add_option("serial", serial, "Serial"); app.add_flag("--wait", doWait, "Wait a bit, do not try to read init messages"); @@ -344,6 +354,7 @@ int main(int argc, char** argv) app.add_flag("--gps,-g", doGPS, "Enable GPS reception"); app.add_flag("--glonass,-r", doGlonass, "Enable Glonass reception"); app.add_flag("--galileo,-e", doGalileo, "Enable Galileo reception"); + app.add_option("--rtscts", doRTSCTS, "Set hardware handshaking"); try { @@ -352,13 +363,12 @@ int main(int argc, char** argv) return app.exit(e); } - if(serial.size() != 2) { cout<