Skip to content

Commit

Permalink
Fix Windows-Specific Bugs in packetdump, goespackets, and lritdump
Browse files Browse the repository at this point in the history
  • Loading branch information
JVital2013 committed Jul 22, 2023
1 parent bd6ba6b commit 886f73c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
10 changes: 3 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -23,18 +23,14 @@ Once you have a dish, amplifier, and SDR set up, Download the lastest build from
- lritdump
- areadump
- goespackets
- packetdump
- packetinfo
- benchmark
- compute_sync_words
- goesemwin - GOES-N EMWIN only. Built and verified operation for completeness.
- 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.

Expand All @@ -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 \<goestools-win\>\build\dist

Expand Down
6 changes: 4 additions & 2 deletions src/decoder/packetdump.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include <io.h>
#include <fcntl.h>

#include <ctime>
#include <fstream>
Expand Down Expand Up @@ -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
Expand All @@ -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<FileReader>(0);
auto writer = std::make_shared<FileWriter>(".");
decoder::Packetizer p(reader);
Expand Down
2 changes: 1 addition & 1 deletion src/goespackets/options.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<int> vcids;
Expand Down
3 changes: 3 additions & 0 deletions src/lrit/lritdump.cc
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#include <io.h>
#include <fcntl.h>
#include <getopt.h>
#include <string.h>
#include <sys/types.h>
Expand Down Expand Up @@ -197,6 +199,7 @@ int extract(const Options&, const std::string& name) {
auto& ifs = *data;
auto& ofs = std::cout;
std::array<char, 8192> buf;
_setmode( _fileno( stdout ), _O_BINARY );
while (!ifs.eof()) {
ifs.read(buf.data(), buf.size());
ofs.write(buf.data(), ifs.gcount());
Expand Down

0 comments on commit 886f73c

Please sign in to comment.