Boatbod OP25: patch for talkgroup name display

Status
Not open for further replies.

Papagei

Newbie
Joined
Oct 3, 2018
Messages
72
Hello all!

I bought a Realtek SDR from rtl-sdr.com a couple of years ago and played with it a bit at the time. I don't remember exactly what I tried, but it seemed P25 decoding was still pretty experimental then.

Recently, I started playing with it again, using boatbod's version of OP25, and it's working a lot better for me. I am able to monitor the MARRS system (Kansas City, MO and environs) fairly reliably.

One thing I did have a little trouble with is that terminal.py would sometimes crash out when it tried to update the screen with the name of the talkgroup from my .tsv file (per stderr). I took a quick look through my .tsv file, and I don't *think* I screwed up the formatting or used any illegal characters (Bobby Tables), but then again, that file is 800+ lines. I do have a couple of talkgroup names in the .tsv that are much wider than the xterm that OP25 runs in, which might be causing this problem.

I ended up wrapping that line in terminal.py in a try/pass, and the problem has not returned for several days so far.

Here is a diff:

Code:
--- terminal.py.orig    2018-10-03 02:31:36.613092317 -0500
+++ terminal.py 2018-10-03 02:33:34.579886950 -0500
@@ -256,7 +256,11 @@
             if msg['tag']:
                 s = msg['tag']
                 s = s[:(self.maxx - 1)]
-                self.active2.addstr(0, 0, s)
+                try:
+                    self.active2.addstr(0, 0, s)
+                except:
+                    pass
+
             self.active2.refresh()
             self.stdscr.refresh()
         return False

I have also patched terminal.py some more to add desktop notifications and a log file, but my Python style is fairly horrible (global variables, whee!), so I'm not publishing those diffs right now. :)

I run OP25 on my main office PC, and sometimes I'm not looking at the desktop where OP25 is running. The notifications make the talkgroup ID and description pop up in the corner of the screen whenever somebody talks, and then go away again when they stop.

Thanks!
 

boatbod

Member
Joined
Mar 3, 2007
Messages
3,410
Location
Talbot Co, MD
Hello all!

I bought a Realtek SDR from rtl-sdr.com a couple of years ago and played with it a bit at the time. I don't remember exactly what I tried, but it seemed P25 decoding was still pretty experimental then.

Recently, I started playing with it again, using boatbod's version of OP25, and it's working a lot better for me. I am able to monitor the MARRS system (Kansas City, MO and environs) fairly reliably.

One thing I did have a little trouble with is that terminal.py would sometimes crash out when it tried to update the screen with the name of the talkgroup from my .tsv file (per stderr). I took a quick look through my .tsv file, and I don't *think* I screwed up the formatting or used any illegal characters (Bobby Tables), but then again, that file is 800+ lines. I do have a couple of talkgroup names in the .tsv that are much wider than the xterm that OP25 runs in, which might be causing this problem.

I ended up wrapping that line in terminal.py in a try/pass, and the problem has not returned for several days so far.

Here is a diff:

Code:
--- terminal.py.orig    2018-10-03 02:31:36.613092317 -0500
+++ terminal.py 2018-10-03 02:33:34.579886950 -0500
@@ -256,7 +256,11 @@
             if msg['tag']:
                 s = msg['tag']
                 s = s[:(self.maxx - 1)]
-                self.active2.addstr(0, 0, s)
+                try:
+                    self.active2.addstr(0, 0, s)
+                except:
+                    pass
+
             self.active2.refresh()
             self.stdscr.refresh()
         return False

I have also patched terminal.py some more to add desktop notifications and a log file, but my Python style is fairly horrible (global variables, whee!), so I'm not publishing those diffs right now. :)

I run OP25 on my main office PC, and sometimes I'm not looking at the desktop where OP25 is running. The notifications make the talkgroup ID and description pop up in the corner of the screen whenever somebody talks, and then go away again when they stop.

Thanks!

If I understand correctly, the issues is a terminal.py crash caused by a TG Tag that exceeds the curses field size? That being the case, I'd prefer to implement a patch or solution that trims the tag text down to size rather than a try/catch block that just masks the error. Please could you email me your trunk.tsv file and let me know which tgid is causing the problem and I will take a look.
g n o r b u r y at b o n d c a r dot c o m

Thanks
Graham
 

boatbod

Member
Joined
Mar 3, 2007
Messages
3,410
Location
Talbot Co, MD
I'd prefer to implement a patch or solution that trims the tag text down to size rather than a try/catch block that just masks the error. Please could you email me your trunk.tsv file and let me know which tgid is causing the problem and I will take a look.

ETA: Having looked at this a little more, I see that I'm already limiting the length of the text that is being output and this is apparently working when I resize my terminal smaller, so I can't help thinking there is something else going on.
Code:
 s = s[:(self.maxx - 1)]
Please can you send me the error message/copy of the stderr.2 log (with -v 1 or higher) when it crashes, along with the trunk.tsv file and tgid that causes the barf.
 

Papagei

Newbie
Joined
Oct 3, 2018
Messages
72
If I understand correctly, the issues is a terminal.py crash caused by a TG Tag that exceeds the curses field size?
I think that's what is happening. When it crashes, I hear the first half-second or so of audio from that talkgroup, but the lines near the bottom of the terminal that normally list the talkgroup ID and the name from the .tsv file don't fill in before the window closes.

Some of the "long" names in my .tsv only talk a few times a day. I went into the .tsv and edited some extra stuff onto the names of some of the talkgroups that are talking this evening. I removed the try/except I added to terminal.py, so it was back to the original configuration, and ran it with -v 3. OP25 would then reliably crash when it hit a talkgroup whose name was padded to 80 characters. This is when running in a xterm sized to 80 characters by 15 lines.

Please can you send me the error message/copy of the stderr.2 log (with -v 1 or higher) when it crashes, along with the trunk.tsv file and tgid that causes the barf.
You've got mail™!

I don't know which tgid it is, at least from the terminal.py display - the tgid doesn't fill in on the screen before it crashes. The stderr output does report tgids that match the long ones in my .tsv, and the short snip of audio I hear before it crashes at least sounds like somebody I should be hearing on that talkgroup.

Thanks!
 

boatbod

Member
Joined
Mar 3, 2007
Messages
3,410
Location
Talbot Co, MD
The crash was caused by a latent bug that needed squishing. Thanks for bringing it to my attention.

Changes have been pushed.

Graham
 

Papagei

Newbie
Joined
Oct 3, 2018
Messages
72
Changes have been pushed.

I downloaded the updated terminal.py and have been running OP25 for about 15 minutes now. The fix seems to have worked; the talkgroup names I padded out to 60, 80, and 100 characters display without crashing.

For fun, I also tried resizing the xterm that OP is running in - it started at 80 characters wide, but I tried it at both 60 and 100, and the long talkgroup names do not cause a crash. I see more of the name the wider I make the terminal, which is what I expect.

Thanks!
 
Status
Not open for further replies.
Top