Merge pull request #1 from omoerbeek/openbsd-fixes
Fix OpenBSD/clang errors; fix Makefile to use CXX and add some include paths.hzcorr
commit
3152567a4a
17
Makefile
17
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
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "navmon.hh"
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <string>
|
||||
#include <string.h>
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include <sys/types.h>
|
||||
#include "storage.hh"
|
||||
#include <dirent.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
@ -45,7 +46,7 @@ vector<uint64_t> 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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -426,6 +426,7 @@ struct InfluxPusher
|
|||
cout<<"Not sending data to influxdb"<<endl;
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void addValue( const pair<pair<int,int>,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 <<endl;
|
||||
h2s.addListener(ComboAddress(address), actx);
|
||||
cout<<"Listening on "<< address <<endl;
|
||||
h2s.runLoop();
|
||||
});
|
||||
ws.detach();
|
||||
|
|
24
ubxtool.cc
24
ubxtool.cc
|
@ -33,7 +33,6 @@ using namespace std;
|
|||
uint16_t g_srcid{2};
|
||||
|
||||
#define BAUDRATE B115200
|
||||
#define MODEMDEVICE "/dev/ttyACM0"
|
||||
|
||||
|
||||
|
||||
|
@ -138,6 +137,10 @@ public:
|
|||
|
||||
bool g_fromFile{false};
|
||||
|
||||
#if !defined(O_LARGEFILE)
|
||||
#define O_LARGEFILE 0
|
||||
#endif
|
||||
|
||||
std::pair<UBXMessage, struct timeval> 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<std::string> 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<<app.help()<<endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
int fd = initFD(serial[0].c_str());
|
||||
int fd = initFD(serial[0].c_str(), doRTSCTS);
|
||||
|
||||
g_srcid = atoi(serial[1].c_str());
|
||||
|
||||
|
@ -380,7 +390,7 @@ int main(int argc, char** argv)
|
|||
for(int n=0 ; n< 20; ++n) {
|
||||
cerr<<"Waiting for device to come back"<<endl;
|
||||
try {
|
||||
fd = initFD(serial[0].c_str());
|
||||
fd = initFD(serial[0].c_str(), doRTSCTS);
|
||||
readSome(fd);
|
||||
}
|
||||
catch(...)
|
||||
|
|
Loading…
Reference in New Issue