From 886f73c3307e255777e0170edc99388e21d81d93 Mon Sep 17 00:00:00 2001 From: Jamie Vital Date: Sat, 22 Jul 2023 11:58:18 -0400 Subject: [PATCH] Fix Windows-Specific Bugs in packetdump, goespackets, and lritdump --- README.md | 10 +++------- src/decoder/packetdump.cc | 6 ++++-- src/goespackets/options.h | 2 +- src/lrit/lritdump.cc | 3 +++ 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index fae0149d..6a7d58d5 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Once you have a dish, amplifier, and SDR set up, Download the lastest build from ### System Requirements - Windows Vista or newer (Windows 10 or newer recommended). -- Microsoft Visual C++ Redistributable. You probably have it already, but if not you can get it [here](https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist). The 2022 redistributable is recommended, but it will run with the 2019 version as well. +- Microsoft Visual C++ Redistributable. You probably have it already, but if not you can get it [here](https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist). The 2022 redistributable is recommended. If you have weird issues, try updating this first! - An RTL-SDR or AirSpy SDR with driver installed - Proper dish and amplifier for LRIT/HRIT reception @@ -23,6 +23,7 @@ Once you have a dish, amplifier, and SDR set up, Download the lastest build from - lritdump - areadump - goespackets +- packetdump - packetinfo - benchmark - compute_sync_words @@ -30,11 +31,6 @@ Once you have a dish, amplifier, and SDR set up, Download the lastest build from - dcsdump - Old DCS lrit files only. New ones don't work on Linux either. - unzip - Can extract zips with a single file in it, like the data section of NWS/EMWIN lrit image files. For debugging purposes. -### Untested -- goesrecv (with an AirSpy). I'd love to get confirmation if this works! -- goesproc (with GOES-N series data). Goesproc has been validated against GOES-R series data only -- packetdump - takes LRIT packets into STDIN and does some analysis. Let me know if you use this, and it works for you. - ## Compiling from source For most users, I recommend using one of the pre-compiled releases. If you choose to compile from source: may the odds be ever in your favor. @@ -51,7 +47,7 @@ Goestools for Windows comes with PowerShell scripts to set up vcpkg and build th ![image](https://github.com/JVital2013/goestools-win/assets/24253715/ef7af001-c45e-4ee7-88e6-d9bb33d6a5fe) 3. Clone goestools-win somewhere on your computer via `git clone --recursive https://github.com/JVital2013/goestools-win` -4. Run Configure-VCPKG.ps1 in this repo to install and configure vcpkg at C:\vcpkg. +4. Run Configure-VCPKG.ps1 in this repo to install and configure vcpkg. 5. If everything succeded, run Build.ps1 in this repo 6. Your compiled code will be in \\build\dist diff --git a/src/decoder/packetdump.cc b/src/decoder/packetdump.cc index ea7ce470..96554f1d 100644 --- a/src/decoder/packetdump.cc +++ b/src/decoder/packetdump.cc @@ -1,4 +1,5 @@ #include +#include #include #include @@ -66,7 +67,7 @@ class FileWriter { fileName_ = timeToFileName(t); fileTime_ = t; - of_.open(fileName_, std::ofstream::out | std::ofstream::app); + of_.open(fileName_, std::ofstream::out | std::ofstream::app | std::ofstream::binary); ASSERT(of_.good()); std::cout @@ -89,13 +90,14 @@ class FileWriter { auto len = strftime( tsbuf.data(), tsbuf.size(), - "packets-%FT%TZ.raw", + "packets-%FT%H-%M-%SZ.raw", gmtime(&t)); return path_ + "/" + std::string(tsbuf.data(), len); } }; int main(int argc, char** argv) { + _setmode(0, _O_BINARY); auto reader = std::make_shared(0); auto writer = std::make_shared("."); decoder::Packetizer p(reader); diff --git a/src/goespackets/options.h b/src/goespackets/options.h index 6512015a..cf97bf25 100644 --- a/src/goespackets/options.h +++ b/src/goespackets/options.h @@ -11,7 +11,7 @@ struct Options { // Record packets stream bool record = false; - std::string filename = "./packets-%FT%H:%M:00.raw"; + std::string filename = "./packets-%FT%H-%M-00.raw"; // Filter these VCIDs (include everything if empty) std::set vcids; diff --git a/src/lrit/lritdump.cc b/src/lrit/lritdump.cc index 281602a9..a1594b80 100644 --- a/src/lrit/lritdump.cc +++ b/src/lrit/lritdump.cc @@ -1,3 +1,5 @@ +#include +#include #include #include #include @@ -197,6 +199,7 @@ int extract(const Options&, const std::string& name) { auto& ifs = *data; auto& ofs = std::cout; std::array buf; + _setmode( _fileno( stdout ), _O_BINARY ); while (!ifs.eof()) { ifs.read(buf.data(), buf.size()); ofs.write(buf.data(), ifs.gcount());