Page 4 of 5

Re: Metar URL in binary??!! What a rookie mistake!

Posted: Wed Aug 24, 2016 10:24 pm
by Sanni
I'm using 2016.2.1 with Linux. The address is in a binary called 'metar'.
And it doesn't matter if I use the old or the new address with singel or double backslashes -- metar isn't working.....
Can anyone tell me what's wrong?!?

Re: Metar URL in binary??!! What a rookie mistake!

Posted: Wed Aug 24, 2016 10:26 pm
by IAHM-COL
The address is in a binary called 'fgfs' :D

If you can do a binary editing (see here: )
Then you can try fixing this yourself.

IH-COL

See: https://forum.flightgear.org/viewtopic. ... 36#p291851

Re: Metar URL in binary??!! What a rookie mistake!

Posted: Wed Aug 24, 2016 10:34 pm
by Sanni
Editing 'fgfs' with emacs and searching for 'observations': failing I-search :(
but found it in 'metar'!

Re: Metar URL in binary??!! What a rookie mistake!

Posted: Wed Aug 24, 2016 11:09 pm
by IAHM-COL
:(

Re: Metar URL in binary??!! What a rookie mistake!

Posted: Wed Aug 24, 2016 11:26 pm
by KL-666
You better search for "noaa", as that is a quite distinguishing feature of the url.

Kind regards, vincent

Re: Metar URL in binary??!! What a rookie mistake!

Posted: Thu Aug 25, 2016 10:11 pm
by Sanni
You can find 'noaa' so many times ....
...'observations' is part of both links.

Re: Metar URL in binary??!! What a rookie mistake!

Posted: Thu Aug 25, 2016 10:23 pm
by IAHM-COL
Hi Sanni
Read simpler alternative solution below


I am going to dare a rather cryptic solution below. Note that I HAVE NOT TESTED THIS since I compiled myself the corrected binary 2016.3.
I believe it can work on Linux systems.
* Need to replace /path/to/bin with whatever is the proper binary path in your system (where fgfs is stored); if in doubt, check

Code: Select all

which fgfs


1. Backup!

beware we are risking the binary with the following steps

Code: Select all

cd ~/               #best executed as regular user at home
cp /path/to/bin/fgfs ./fgfs.bk -vi
cp /path/to/bin/fgfs ./fgfs -vi


With this step above you created the file fgfs.bk which is the safe backup of the fgfs binary. If we mess up you can restore like

Code: Select all

sudo cp fgfs.bk /path/to/bin/fgfs


2. Edit the binary
We will hexdump the binary first (hexdump), then replace (sed), and then restore the binary (xxd)

Note1: It is a single command
Note2: You really want to use the copy/paste method here, since this is not typo-friendly --beside looking like chicken-scratch.

Code: Select all

hexdump -ve '1/1 "%.2X"' fgfs | \
sed "s@http://weather.noaa.gov/pub/data/observations/metar/stations/@http://tgftp.nws.noaa.gov/data/observations/metar//stations//@g" | \
xxd -r -p > fgfs.patched


3. Replace the binary
Now you have 3 fgfs files. The original (fgfs) the backup (fgfs.bk) and the edited (fgfs.patched)
Simply replace the original with the edited, and try your patched file

Code: Select all

sudo cp fgfs.patched /path/to/bin/fgfs -vi
fgfs


Let us know if this gets you back in byzz.

IH-COL

Re: Metar URL in binary??!! What a rookie mistake!

Posted: Thu Aug 25, 2016 11:32 pm
by IAHM-COL
@Sanni: A simpler alternative


**ONLY LINUX**


Hi Sanni, The commands above maybe scary. (they are)
I created an script that I think maybe able to do the job in any linux FlightGear.

https://github.com/FGDATA/chatter.patch/blob/master/fixmetar

After download the script fixmetar above, give it executable permissions:

To download

Code: Select all

wget https://raw.githubusercontent.com/FGDATA/chatter.patch/master/fixmetar


To authorize

Code: Select all

chmod 755 fixmetar


Then execute with sudo permissions

Code: Select all

sudo ./fixmetar



That can do it.

IH-COL

Re: Metar URL in binary??!! What a rookie mistake!

Posted: Mon Sep 12, 2016 7:06 pm
by Sanni
Your script doesn't work :(
So I did it manually: No live weather..... 8|
I will wait to the next FG version :)

Re: Metar URL in binary??!! What a rookie mistake!

Posted: Mon Sep 12, 2016 10:16 pm
by IAHM-COL
Sanni wrote:Your script doesn't work :(
So I did it manually: No live weather..... 8|
I will wait to the next FG version :)



Oh OK
It was worth the try
Anyways, no much longer wait.
The release Rio 2016.3 is out today

Safe flight Sanni,
IAHM-COL

http://thejabberwocky.net/viewtopic.php ... 549#p13549

https://sourceforge.net/projects/flightgear/files/release-2016.3/