crescentvenus/WALB

help with compling

Closed this issue · 19 comments

Hello, I 'm very new to SDR and linux in general but this project looks like it could do what I need and also give me in site on how things work in the SDR world.
So I am just trying to get this setup I believe I have everything right up to the point of compiling it....

so the error I get is.
pi@raspberrypi:~/WALB $ gcc replay2.c -I/usr/local/include -L/usr/local/lib -lwiringPi -o replay2
replay2.c: In function ‘proc’:
replay2.c:123:14: warning: implicit declaration of function ‘disp_sub’ [-Wimplicit-function-declaration]
num2=disp_sub(count, num2, Lmax,"*TxPower", Lbuf);
^~~~~~~~
Again, I am very new to all this so ...
Here is what I have done so far...

  1. Installed Raspbian (Sketch) on a PI3
  2. Copied all the repositories Hackrf tools, wiringPi, php5 and apache2

I have the files from the WALB repository at.
pi@raspberrypi:/WALB $ ls
bin images level2.txt python replay2 scritps
date2.txt IQ-files menu2.txt README.md replay2.c webui
pi@raspberrypi:
/WALB $


I have the files from gps-sdr-sim repository at.
pi@raspberrypi:/gps-sdr-sim $ ls
bladerf.script getopt.c gpssim.h README.md satgen
brdc3540.14n getopt.h LICENSE rocket.csv triumphv3.txt
circle.csv gps-sdr-sim-uhd.py Makefile rtk ublox.jpg
extclk gpssim.c player satellite.csv u-center.png
pi@raspberrypi:
/gps-sdr-sim $


I have the files from wiringPi repository at.
pi@raspberrypi:~ $ cd wiringPi
pi@raspberrypi:/wiringPi $ ls
build debian-template gpio People update wiringPi
COPYING.LESSER devLib INSTALL pins VERSION wiringPiD
debian examples newVersion README.TXT version.h
pi@raspberrypi:
/wiringPi $


I have the drivers for the hackrf at, and can see my hackrf board.
pi@raspberrypi:/hackrf $ ls
appveyor.yml doc hardware issue_template.md TRADEMARK
COPYING firmware host Readme.md
pi@raspberrypi:
/hackrf $
pi@raspberrypi:/hackrf $ hackrf_info
hackrf_info version: git-1ae7c21
libhackrf version: git-1ae7c21 (0.5)
Found HackRF
Index: 0
Serial number: 0000000000000000308066e62258944b
Board ID Number: 2 (HackRF One)
Firmware Version: 2018.01.1 (API:1.02)
Part ID Number: 0xa000cb3c 0x007c435d
pi@raspberrypi:
/hackrf $

I also copied over the files from /WALB/webui into the /var/www/html/webui folder ( a copy is still in the /home/pi/WALB folder )

pi@raspberrypi:/var/www/html/webui $ ls
kill_proc.sh LatLon.ini.php LatLon.php README.md start2.php
LatLon.css LatLon.js LatLon.tmpl.php smooth2.php
pi@raspberrypi:/var/www/html/webui $

I think this is what I needed to do, but i'm unclear..
I'm not sure if I'm on the right track or not.
I tried to change the gcc replay command to the following per the comment of (You may need to adjust -I/Lxxxxx for the location of wireringPi)..
so I issued this.. pi@raspberrypi:~/WALB $ gcc replay2.c -I/usr/local/include -L/usr/local/lib -lwiringPi -o replay2
no luck.. Can someone help me out? I'm not sure I'm even on the right track to get this working or not... Thanks in advance!

What kind of error message you get when you tried to compline ?

I am getting ...
pi@raspberrypi:~/WALB $ gcc replay2.c -I/usr/local/include -L/usr/local/lib -lwiringPi -o replay2

replay2.c: In function ‘proc’:

replay2.c:123:14: warning: implicit declaration of function ‘disp_sub’ [-Wimplicit-function-declaration]
num2=disp_sub(count, num2, Lmax,"*TxPower", Lbuf);
^~~~~~~~

pi@raspberrypi:~/WALB $

I also tried to change the directory to reflect where the wiringPi was located at like below
gcc replay2.c -I/home/pi/wiringPi -L/home/pi/wiringPi -lwiringPi -o replay2

gcc replay2.c -I/home/pi/wiringPi -L/home/pi/wiringPi -lwiringPi -o replay2
replay2.c: In function ‘proc’:
replay2.c:123:14: warning: implicit declaration of function ‘disp_sub’ [-Wimplicit-function-declaration]
num2=disp_sub(count, num2, Lmax,"*TxPower", Lbuf);
^~~~~~~~
pi@raspberrypi:~/WALB $

Any idea's?

A line you provided is just a 'warning'. You can ignore 'warning' messages if you will.
If there are real error(s), you should see something like below.

replay2.c:153:18: error: ‘a’ undeclared (first use in this function) // I modified the source code to generate error intentionally.

Is there any "error:" lines ?

There are no errors. from what I can see. So that's good news!
So the rest probably is my ignorance of linux.... I have the "normal" gps-sdr-sim project working on the Raspberry pi and can spoof my location on my phone with a static as well as a user motion file.

So please forgive me if it is somewhere in the documentation and my feeble mind can't grasp it.... So how do I drive this thing?
-- I'm waiting on the components to come in to build the rest of this, but am hoping I can test maybe the interactive mapping part of this project?
-- when I try to run this ( if that is how it is even done..) I enter in... ./relpay2
pi@raspberrypi:~/WALB $ ./replay2

I get..
pi@raspberrypi:~/WALB $ ./replay2
Main menu:menu2.txt
menu2.txtFile open failed.
level2.txtFile open failed.
date2.txtFile open failed.
(null) (null) (null) (null) 2016/04/15,00:00:00
Segmentation fault

So looking at this it looks like the first file loaded.. Since I don't yet have the components in is there a way to test anything? I do get a index page of Apache2 Debian Default Page when I try to go to my ip of the pi. Another php files like 192.168.1.117/LatLon.php error out.

Again I'm not 100% sure I have the files located in the correct directories ( as I listed above )...

Again, I'm really sorry if this project is just to far out of my skill level...

Looks like you are executing in different PATH.
There are many hard corded file PATH name in current source tree.
It assumes all code is under /home/pi.
I may be need to clean up my code, so that you can define the PATH.

OK, I moved everything over to the /home/pi directory. I ran into some permissions errors when running replay2 so I issued a chmod 777 to all the txt files and it seems to be running ( though I do not have a display yet..)

I also moved all the files from the webui folder to my /var/www/html/ folder.

AND I can get to the php site of http://192.168.3.49/LatLon.php !! ( I'm getting there, I can almost taste it..)
So now my issue ( i think, or maybe not) is the page loads and I can click on different locations, but when it loads I get a pop up saying " Google" This page can't load Google Maps correctly.
"
When I put in a lat or lon in the upper left hand side the map does not go to that area of the country. ( though I'm not sure it is designed too or if it is because of the error message i get when I first loaded the page.

I'm almost there... When I click on a few placed on the map and then click "SIM-START" I do not see my hackrf transmitting anything out ( no tx light), BUT I did notice that if i query the board using hackrf_info -- it shows it as Resource busy, and when I click "sim-stop" it releases the hackrf board. and I see it as normal
Board ID Number: 2 (HackRF One)
Firmware Version: 2018.01.1 (API:1.02)
Part ID Number: 0xa000cb3c 0x007c435d

I know you are probably annoyed with walking me though this... Again thanks for your help!

Thank you for your feedback and I am pleased to hear your progress.
Regarding webui, Google have requested to add API-KEY some time ago.
There for, you have to get an API-KEY from Google and then add API-KEY at line #63 of LatLon.tmpl.php.
Reference: Google Maps API
https://developers.google.com/maps/documentation/javascript/tutorial
Reference: Get API Key
https://developers.google.com/maps/documentation/javascript/get-api-key

I will comment on HackRF transmitting issue sometime later.

OK, Thanks!
I got the website working ok with your assistance from the last post. It appears like it is working on the web page itself. Poking around I noticed that the file latlog.txt is being generated when you click on the map, but nothing is inside the text file. it looks like the file is being created in the folder named ...

root@raspberrypi:/tmp/systemd-private-226ba5031a2b4579abd4da757cf7645b-apache2.service-8GqoGv/tmp# ls
fifo LatLon.txt

when I nano both files They do not have anything inside them.

It seems like permission issue of fifo and LatLon.txt files.
Try chmod 666.

Please read README.md in webui directory and update kill_proc.sh.

I applied the chmod 666, the file still looks empty ( though I see the file being created once you click on the map.
here is the current file permissions
root@raspberrypi:/tmp/systemd-private-47db1f65ce8d48d3868c69608a3601a5-apache2.service-evslds/tmp# ls -l
total 4
prw-r--r-- 1 www-data www-data 0 Sep 15 19:01 fifo
-rw-r--r-- 1 www-data www-data 1 Sep 15 19:02 LatLon.txt

Is there any kind of logs that I can check to see where there may be a problem?

Please look at my previous comment.

I tried your last comment and updated the kill_proc.sh and no change.

So I deleted everything and started over...

I did a git clone from the WALB repository and copied all the files from the WALB folder to the /home/pi directory. I noticed that the folder "scripts" was actually named "scritps" I assumed this was a typo, but just to be sure I copied all the files from "scritps" to "scritps" so they both have the same files in the( just incase they are refered to by another process. I then compiled the program.

  1. I then did a git clone for the gps-sdr-sim from https://github.com/osqzss/gps-sdr-sim.git
    it placed the files in the /home/pi/gps-sdr-sim folder. I then compiled it.

  2. I downloaded a newer bdrc file, uncompressed it and renamed it to "brdc3640.15n" ( because I noticed a few .sh scripts referenced this name for the file brdc3640.15n. I copied this file to the /home/pi/bin as well as the /home/pi/gps-sdr-sim directory.

  3. I updated the php files with my api key and moved them into the directory of /var/www/html as well as /var/www/html/webui

drwxr-xr-x 4 root root 4096 Sep 17 15:22 .
drwxr-xr-x 3 root root 4096 Sep 16 16:18 ..
-rw-rw-rw- 1 pi pi 301 Sep 16 18:09 kill_proc.sh
-rw-rw-rw- 1 pi pi 507 Sep 16 18:09 LatLon.css
-rw-rw-rw- 1 pi pi 165 Sep 16 18:09 LatLon.ini.php
-rw-r--r-- 1 pi pi 2570 Sep 16 18:09 LatLon.js
-rw-rw-rw- 1 pi pi 2161 Sep 16 18:41 LatLon.php
-rw-r--r-- 1 pi pi 3537 Sep 17 15:22 LatLon.tmpl.php
-rw-rw-rw- 1 pi pi 29 Sep 17 16:26 LatLon.txt
drwxr-xr-x 2 root root 4096 Sep 16 16:19 modwebui
-rw-r--r-- 1 pi pi 654 Sep 16 18:09 README.md
-rw-rw-rw- 1 pi pi 4608 Sep 16 18:09 smooth2.php
-rw-rw-rw- 1 pi pi 726 Sep 16 18:09 start2.php
drwxr-xr-x 2 pi pi 4096 Sep 17 15:24 webui
root@raspberrypi:/var/www/html#
( I added a blank file of LatLon.txt and placed it in /var/www/html directory) I did notice that the file LatLon.txt is updated with the newest coordinates you last clicked on the map. example 85.05113,-180,100,13,10


  1. I updated all the files that were root access to pi:pi via the command sudo chown pi:pi LatLon.tmpl.php. I did that to all the files above. Not sure if that was right or not. Some were root access and other were pi access..

So, here is my current problems.... I noticed some of the logs are
sh: 1: /var/www/html/start2.php: Permission denied
[Mon Sep 17 00:58:53.999469 2018] [:error] [pid 514] [client 192.168.3.29:32830] PHP Notice: Use of undefined constant selected - assumed 'selected' in /var/www/html/LatLon.tmpl.php on line 26, referer: http://192.168.3.49/LatLon.php

I also noticed that now when I hit "start-Sim" on the web site it does not show using hackrf_info as the board being "resource busy" as it was doing before on my last attempt.

I think that was all my steps I tried on my current setup. Any help would be appreciated!
I'm leaning toward problems with the directory structure or permissions, but can't seem to figure it out.

I did notice that I did not have the correct permissions on the files in the /var/www/html/webui. I changed them to www-data:www-data, but no difference.
pi@raspberrypi:/var/www/html/webui $ ls -la
total 52
drwxr-xr-x 2 pi pi 4096 Sep 17 19:49 .
drwxr-xr-x 4 root root 4096 Sep 17 17:26 ..
-rw-r--r-- 1 www-data www-data 301 Sep 16 18:09 kill_proc.sh
-rw-r--r-- 1 www-data www-data 507 Sep 16 18:09 LatLon.css
-rw-r--r-- 1 www-data www-data 165 Sep 16 18:09 LatLon.ini.php
-rw-r--r-- 1 www-data www-data 2570 Sep 16 18:09 LatLon.js
-rw-r--r-- 1 www-data www-data 2161 Sep 16 18:41 LatLon.php
-rw-r--r-- 1 www-data www-data 3537 Sep 17 15:24 LatLon.tmpl.php
-rw-rw-rw- 1 www-data www-data 28 Sep 17 19:49 LatLon.txt
-rw-r--r-- 1 www-data www-data 655 Sep 17 19:32 README.md
-rw-r--r-- 1 www-data www-data 4608 Sep 16 18:09 smooth2.php
-rw-r--r-- 1 www-data www-data 726 Sep 16 18:09 start2.php
pi@raspberrypi:/var/www/html/webui $

(1) Check which webui related process is running like..
$ps ax | grep -e hackrf_transfer -e gps-sdr-sim -e smooth2.php

(2) gps-sdr-sim for WALB is not same as original one. -l option doesn't exist in original gps-sdr-sim and it will fail to run from start2.php.

(3)scritps is typo.

(4)undefined constant selected - assumed 'selected' ..... selected -> "selected"

By the way, did you set udev rules which is described top README.md ?

I was able to get it to work by modifing the permissions as 0775 to a bunch of files... I did do the dev rules as you suggested above, but that alone did not fix it. I believe the problems is some of the steps would not let me execute from the normal pi login so I had to do it as "sudo su pi" so I think it messed some permissions up.

I do have it up and running, however I have a weird problem... about 50 percent of the time I can click on the map and I see the tx light on the hackRF light up and it works fine. I boot it up an hour/day later and do the same thing and the hack rf does not Tx anything. I can reboot the hackrf and or the Pi and nothing changes. I can manually tx something and it works. I see the start sim and stop sim grab and release the Hackrf like it should, when this happens I see no errors in /var/log/apache2/error.log file except ...
#######
[Mon Sep 24 18:33:42.595943 2018] [mpm_prefork:notice] [pid 519] AH00169: caught SIGTERM, shutting down
[Mon Sep 24 18:33:58.123458 2018] [mpm_prefork:notice] [pid 485] AH00163: Apache/2.4.25 (Raspbian) configured -- resuming normal operations
[Mon Sep 24 18:33:58.125057 2018] [core:notice] [pid 485] AH00094: Command line: '/usr/sbin/apache2'
#######
but I think those are older logs from a reboot.
the weird thing is as I'm looking at the logs, stating the hackrf board and generally ready to pull my hair out I'll attempt the start sim ( for the 10th or 20th time and all of a sudden it will start to transmit.
The error log will show it the board transmitting out and everything works until the next powercycle. I can't find any rhyme or reason to what makes it start working or why it does not work.. I use the shutdown command so I don't think it corrupts anything during a reboot.

Any ideas to how I can tell what is not running or erroring out?

I think I figured it out. I guess you need to wait about 10 mins before you hit start Sim. then it will transmit. I guess it takes awhile to process the file.

It is weird. What I can remember is HackRF can't be recognized after kill the process. At that time, just unplug HackRF and reconnect recover the operation. I don't see such a problem recently though.