khaytsus / gqrx-scan

Control GRQX to scan frequencies or from channels using the GQRX Bookmark or CSV file
67 stars 8 forks source link

Channel Switching Too Soon Before Transmission Ends #11

Closed BT-Justice closed 9 years ago

BT-Justice commented 9 years ago

I am noticing when a channel gets a transmission that after the transmission finishes and another operator transmits on the same channel a few seconds later--within the delay time--that gqrx-scan starts scanning again while the other operator is talking. It's like the countdown from the delay time starts right when activity is first picked up on a channel instead of starting when all activity ends. Shouldn't it wait until all activity has ended then start the countdown from delay and then start scanning again?

I looked through the gqrx-scan settings file and changed these but it doesn't seem to help:

our $levelwait = "1"; our $delaylevel = "-50" our $delaytime = "8";

Am I overlooking something?

khaytsus commented 9 years ago

Do you have $wait set to 1?

--wait Stop scanning until the channel is clear (default: 0)

$levelwait determines how long it waits before moving onto the next channel if it's quiet.. IE: This will just slow scanning down if set to 1. .5 is safe, I'm experimenting with .3 here and it seems to work okay, although I do hear it miss every so often so I'll eventually try .4

I'm going to add more details to my sample config file, I had intended to do that and didn't get to it. Let me know if $wait fixes this issue for you.

BT-Justice commented 9 years ago

I found $wait = "1" commented in gqrx-scan-defaults.pm which I just uncommented so I will see if that works. I was confused by what should and should not be commented there. Here is what I have enabled from that file:

$pausefile = "/home/owner/gqrx-scan/pause.pm"; $logfile = "/home/owner/gqrx-scan/gqrxscan.log"; $config = "/home/owner/gqrx-scan/gmrs.pm"; $type = "gqrxfile"; $wait = "1"; $gqrxcsvfilename = "/home/owner/.config/gqrx/bookmarks.csv";

khaytsus commented 9 years ago

Understood, and to be very honest, I did a REALLY CRAPPY job naming things.... A lot of it was internal-only stuff that got externalized etc.. What I should have done is rename everything to something sane at that point.

I'm just not sure how to do it at this point.... but maybe I will, and just give a guide to say "change this to that" to fix existing configs etc... Because again, things are not clear on what they actually do.

I've added some additional help to the sample config file, but ideally long term I should make the variables make sense.. Perhaps I'll go ahead and log myself an issue to keep track of that.

Let me know if $wait=1 does it for you

BT-Justice commented 9 years ago

It doesn't seem $wait="1" is helping. And stop being hard on yourself. It is AWESOME you were able to make this. Maybe you could put the two files into one with the user customizable settings at the top and the stuff that should not be changed at the bottom.

khaytsus commented 9 years ago

Well, all of the stuff in the config file is anything that can be changed or can be set as a command line parameter, the idea being that people could create config files and not save a bunch of command line parameters, like scanning their local PD freqs, or scanning ham repeaters, or scanning GMRS, etc etc

But best practices on developing is don't create internal variables which can't be understood; exposing such badly named variables to users is just plain mean ;)

Odd that $wait=1 isn't helping.... So it scans to a frequency that's busy and it keeps going? $delaylevel=-50 is requiring a fairly strong signal, are you sure it's -50 or stronger (-40 would be stronger yet, etc.... -70 would be a very weak signal.... etc)

BT-Justice commented 9 years ago

It hits a frequency with traffic and it is almost -10. To me, it seems like as soon as the scan hits an active frequency, the delay immediately starts counting down instead of starting after activity on the frequency ends. Someone talks then unkeys then someone new keys up and talks and during their talking it starts scanning again. If a frequency has activity, the delay countdown should remain frozen until activity ends and start counting down. If someone new transmits within the delay time, the delay should reset itself and start counting down again. Once the delay time passes, scanning should resume.

BT-Justice commented 9 years ago

Is there anything I can try to fix this? I hate it when police and EMS (on different frequencies) have something going on and gqrx-scan starts scanning again instead of waiting :(

khaytsus commented 9 years ago

Oops, sorry, I thought this was resolved for you. I'm not sure what the issue is, maybe I can paste you an example config I have here and you can compare? I know this will stay on channel until it's clear (for 5 seconds)

$type="gqrxfile"; $wait="1"; $pause=".35"; $delaylevel="-65"; $delaytime="5"; $sort="1"; $tags="GMRS"; $coloroutput="1"; $light="0";

1;

BT-Justice commented 9 years ago

I am assuming these go to "gqrx-scan-defaults.pm"...

$pause=".35"; This was not enabled and was set to ".5".

$tags, $colouroutput, $light, $sort were not enabled.

In gqrx-scan, I see this...

Delay scanning if we hear a signal our $levelstop = 1;

In defaults, I see this...

$levelstop = "-50";

Here is what is and is not enabled in defaults...

$config = "/home/owner/gqrx-scan/gmrs.pm"; $type = "gqrxfile";

$mode = "usb";

$start = "28,4e6";

$end = "28.6e6";

$channel = "1,4";

$showall = "1";

$step = "1000";

$pattern = "14[6][7]";

$tags = "GMRS";

$exclude = "144.390e6";

$delaylevel = "-65"; $delaytime = "5"; $pause = "0.35";

$stop = "0";

$wait = "1"; $levelstop = "-50";

$record = "1";

$monitor = "0";

$dumpchannels = "0";

$coloroutput = "1"; $light = "0"; $sort = "1";

$csvfilename = "/opt/gqrx-remote/gqrx-bookmarks.csv";

$gqrxcsvfilename = "/home/owner/.config/gqrx/bookmarks.csv";

1;

khaytsus commented 9 years ago

That config is actually part of my GMRS scanning, but yeah, it doesn't really matter. If you want that to be the default behavior, then that works. Are you sure that you're loading the file btw? Make sure it's showing that it loaded, it'll show something like this at the top:

Loading default config file /home/wally/gqrx-scan-defaults.pm

Oops, looks like I made a mistake in putting $levelstop as a level vs a flag. I'll fix that.

BT-Justice commented 9 years ago

I redownloaded from scratch gqrx-scan and simply edited "gqrx-scan-defaults.pm" only. Here is what it is using and still it doesn't stay on an active frequency long enough:

http://pastebin.com/8pdzqfSN (Expires 2015-09-13)

Now I have noticed a couple of things:

$pausefile = "/home/owner/gqrx-scan/.gqrx-pause.txt";

This file does not exist (I do have show hidden files enabled). There is a file there simply called "pause" though. I might change it to that and see if that makes any difference.

These files also do not exist:

$logfile = "/home/owner/gqrx-scan/gqrxscan.log"; $config = "/home/owner/gqrx-scan/gmrs.pm";

BT-Justice commented 9 years ago

It appears to be looking for you. Can I make a suggestion? Would it be possible to have one file in future versions of gqrx-scan where the users does their settings "gqrx-scan-defaults.pm" and the other file "gqrx-scan" does the scanning with the other files?

I mean most people will get it with git so there will be a gqrx-scan folder in the home directory which is what I have. Maybe $home could be defined in "gqrx-scan-defaults.pm".

No default config file found..

Starting in gqrxfile mode scanning for tags: ISP

Can't write to /home/wally/baofeng/gqrxscan.log, logging to /tmp/gqrxscan.log Channel/Frequency pause time: 0.5s Delaylevel: [-40] Delaytime: [5]

Loaded 22 lines from GQRX CSV file

khaytsus commented 9 years ago

Okay, the log part I've fixed, I had it hard-coded in the script, it looks at $home now so it'll at least fail for YOUR homedir.. You can mkdir the directory etc as necessary.

However, the first line is what I expected since you're having issues with the settings in the config file. It's not finding gqrx-scan-defaults.pm at all. It SHOULD be looking for it in $home/gqrx-scan-defaults.pm Can you make sure the file is there in your homedir? This should work in any shell:

ls $home/gqrx-scan-defaults.pm

If it can't find it, put the config file you've been working on, as well as the defaults, into your homedir and try again. I think you're just bumping into the file being in a different place than the script expects it :)

BT-Justice commented 9 years ago

I reinstalled gqrx-scan again except this time I did the settings in "gqrx-scan" and left the defaults file alone. I have literally been waiting for awhile now for someone to talk on one the frequencies I scan. I'll report back later. Here is that file with the changes I made to Line 85:

http://pastebin.com/sLiLhnss

BT-Justice commented 9 years ago

Well that didn't work. I get...

BT-Justice commented 9 years ago

When that happens, GQRX seems to be frozen so I have to hit the start button in it to clear it and restart gqrx-scan. There are times this doesn't happen and it waits on the frequency until it clears, but they are few and far between.

BT-Justice commented 9 years ago

Still experiencing this issue. I am out of ideas.

khaytsus commented 9 years ago

I'm not quite sure what the current issue is, sorry ;) If GQRX is frozen, that's nothing to do with my script. I've seen that a time or two and I just exit GQRX, unplug the SDR for a few seconds, re-plug it, then GQRX is fine.

If you're still having trouble loading a config, please paste the output again. Last time you did that, it was not loading the config, I don't know if you've resolved that or not. It's just a path issue really. gqrx-scan --config filename.pm will specifically load a config file if you want to try it that way. Try it with the sample config I gave you, but you'll need to update it with the tags/frequencies etc you want to scan of course.

BT-Justice commented 9 years ago

Loading default config file /home/owner/gqrx-scan/gqrx-scan-defaults.pm

Starting in gqrxfile mode scanning for tags: ISP

On detection of signal will wait until channel is clear

Channel/Frequency pause time: 0.5s Delaylevel: [-30] Delaytime: [8]

Loaded 22 lines from GQRX CSV file

BT-Justice commented 9 years ago

Not being mean or anything, but it is something with the script. If I don't run it, GQRX works fine other than I have to manually change frequencies. Now I am not 100% sure, but it seems like this happens when the scan comes up on a frequency where the transmission just ended or there is a distant, weak transmission.

khaytsus commented 9 years ago

Oh I wouldn't call that "mean", I just don't think the script would do that. All it does is tell GQRX to tune to a frequency via GQRX's TCP interface. It queries GQRX for signal levels, if record is set to on it tells GQRX to start or stop recording, etc. Nothing low level, all just commands into GQRX network control.

So it's still behaving like this? Could you give me a log file when this happens and the config file you're using? You can attach them as files, easier to look at than pasting them into the comment.

BT-Justice commented 9 years ago

I am not seeing any options to attach those files. There are options for pictures though.

BT-Justice commented 9 years ago

I uploaded them here...

http://www.fileconvoy.com/dfl.php?id=g957127c6ab7704e0999708682aeec67e02830e656

BT-Justice commented 9 years ago

I think I have figured out what is going on and I cannot fix it. It's not gqrx-scan but rather Gqrx. If I set the sample rate to 1200000, everything appears to work fine for several hours. If I go above that then it locks up doing gqrx-scan when a signal is detected.

When set to 1200000, I can see the dBFS meter pop up to 0 on and off. When set to 2400000, the meter acts fine but Gqrx will lock up with gqrx-scan.

khaytsus commented 9 years ago

Odd, must have USB issues. You might want to use rtl_test to see how fast your stick can transfer without failing. rtl_test -s 3200000 for 3.2Mhz (way out of bounds) will show "lost at least XXX bytes" repeatedly. Drop this back until you don't see any, or very few, of these errors. For me, I can reliably get 2.3Mhz (2300000) but it might depend on the stick and your USB, computer load, etc etc..

Make sure GQRX isn't running, and you might have to run it as root, but try it without first. That'll help you find the bandwidth your RTLSDR can provide. If you're JUST scanning with it, you don't really care too much, but if you're using GQRX to watch the spectrum, it's nice to have more bandwidth shown at once.

Glad to hear you resolved it, I didn't think it was the scanning doing it. I'll leave this open for right now in case you need any more follow up help, but I'll consider it fixed for me ;)

BT-Justice commented 9 years ago

Looks like I can hit a max of 2200000. It still freezes up though when scanning. Interestingly, SDR# converted to Microsoft .NET 4.6 and now works on both Linux and Apple with the latest version of Mono. Is Gqrx still getting updated?

khaytsus commented 9 years ago

eh? He's committing code several times a week.

https://github.com/csete/gqrx/commits/master

But sounds like this is fixed now, hope everything is working well for you :)