From 6721cd0139efda7a6d8810f9530ef1b43d83e655 Mon Sep 17 00:00:00 2001 From: Michael Clemens Date: Sat, 14 Nov 2020 11:07:18 +0100 Subject: [PATCH] fixed hamlib related things: * removed config parameters rigpath, rigmodel * added config parameters hamlibaddr, hamlibport * removed function connectrig() and all references to it --- config | 9 +++++---- yfk | 21 ++++++++++----------- yfksubs.pl | 34 +++++++++++----------------------- 3 files changed, 26 insertions(+), 38 deletions(-) diff --git a/config b/config index 3234b28..8f91b12 100644 --- a/config +++ b/config @@ -155,13 +155,14 @@ screenlayout=1 checklogs= -# (O) hamlib rig model. 0 for no hamlib. +# (O) IP address of rigctld. If executed on the same system, you can +# use the default: 127.0.0.1 -rigmodel=0 +hamlibaddr=127.0.0.1 -# (O) hamlib path to the device. For example /dev/ttyS0 etc. +# (O) TCP port of rigctld. You propably don't want to change this. -rigpath=/dev/ttyS0 +hamlibport=4532 # (O) autoqueryrig: If set to 1, YFKlog queries the frequency from the # transceiver via hamlib at every new QSO automatically. diff --git a/yfk b/yfk index 9752590..d26ec4c 100755 --- a/yfk +++ b/yfk @@ -2050,8 +2050,8 @@ while ($status == 16) { sprintf("awardmodes=%-15s - Modes for awards", $yfksubs::modes), sprintf("screenlayout=%-15s - Layout, 1 or 0 (requires restart to take eff.)", $yfksubs::screenlayout), sprintf("checklogs=%-15s - Other logs to check for QSOs", $yfksubs::checklogs), - sprintf("rigmodel=%-15s - hamlib rig model number (0 = disable hamlib)", $yfksubs::rigmodel), - sprintf("rigpath=%-15s - hamlib rig path (e.g. /dev/ttyS0)", $yfksubs::rigpath), + sprintf("hamlibaddr=%-15s - IP address of rigctld (default: localhost)", $yfksubs::hamlibaddr), + sprintf("hamlibport=%-15s - Port number of rigctl (default: 4532)", $yfksubs::hamlibport), sprintf("autoqueryrig=%-15s - Query hamlib automatically?", $yfksubs::autoqueryrig), sprintf("operator=%-15s - Operator's callsign", $yfksubs::operator), sprintf("lotwdetails=%-15s - Include details from LoTW?", $yfksubs::lotwdetails), @@ -2082,7 +2082,6 @@ while ($status == 16) { &readconfig; &readsubconfig; &connectdb; - &connectrig; $firstrun = 0; $status = 2; # endwin; @@ -2258,21 +2257,21 @@ while ($status == 16) { } } elsif ($choice == 18) { - $original = "rigmodel=$yfksubs::rigmodel"; - my $ret = &askbox(10,20,4,30, '\d', "Enter hamlib rigmodel (0=no rig)", - $yfksubs::rigmodel); + $original = "hamlibaddr=$yfksubs::hamlibaddr"; + my $ret = &askbox(10,20,4,30, '[0-9.]', "Enter IP address of rigctld", + $yfksubs::hamlibaddr); if ($ret eq 'm') { last } elsif ($ret ne '') { - &changeconfig($original, "rigmodel=$ret"); + &changeconfig($original, "hamlibaddr=$ret"); } } elsif ($choice == 19) { - $original = "rigpath=$yfksubs::rigpath"; - my $ret = &askbox(10,20,4,30, 'filename', "Enter hamlib rigpath", - $yfksubs::rigpath); + $original = "hamlibport=$yfksubs::hamlibport"; + my $ret = &askbox(10,20,4,30, '[0-9]', "Enter port number of rigctld", + $yfksubs::hamlibport); if ($ret eq 'm') { last } elsif ($ret ne '') { - &changeconfig($original, "rigpath=$ret"); + &changeconfig($original, "hamlibport=$ret"); } } elsif ($choice == 20) { diff --git a/yfksubs.pl b/yfksubs.pl index 34c36b3..8c4bd07 100644 --- a/yfksubs.pl +++ b/yfksubs.pl @@ -33,7 +33,7 @@ preparelabels labeltex emptyqslqueue adifexport ftpupload adifimport getlogs changemycall newlogtable oldlogtable choseeditqso geteditqso editw updateqso checkdate awards statistics qslstatistics editdb editdbw savedbedit lotwimport databaseupgrade xplanet queryrig tableexists changeconfig readsubconfig -connectdb connectrig jumpfield receive_qso tqslsign getlotwlocations +connectdb jumpfield receive_qso tqslsign getlotwlocations getlotwstartdate downloadlotw redraw create_windows rundxc getch2 waitkey senddxc mycurs_set); @@ -88,8 +88,8 @@ our $lon1 = "-8"; # Longitude of own station our $bands = '160 80 40 30 20 17 15 12 10 2'; # bands for award purposes our $modes = 'CW SSB'; # modes for award purposes our $screenlayout=0; # screen layout, 0 or 1 -our $rigmodel = 0; # for hamlib -our $rigpath = '/dev/ttyS0'; # for hamlib +#our $rigmodel = 0; # for hamlib +#our $rigpath = '/dev/ttyS0'; # for hamlib my $rig=0; my $dband = '80'; my $dmode = 'CW'; @@ -107,7 +107,8 @@ our $askme=0; # ask before clearing QSOs etc our $logsort="N"; # Order of log display our $prevsort="D"; # Order of prev. QSOs our $browser='dillo'; -our $hamlibtcpport = 4532; +our $hamlibport = 4532; +our $hamlibaddr = '127.0.0.1'; our $lotwlocation=""; # LoTW station locations in format: CALL:location,CALL:location our $lotwuser=""; # Username for automatic LoTW download our $lotwpass=""; # Password for automatic LoTW download @@ -432,11 +433,11 @@ while (defined (my $line = )) { # Read line into $line elsif ($line =~ /^screenlayout=(.+)/) { # screen layout, see doc. $screenlayout= $1; } - elsif ($line =~ /^rigmodel=(.+)/) { - $rigmodel= $1; + elsif ($line =~ /^hamlibaddr=(.+)/) { + $hamlibaddr= $1; } - elsif ($line =~ /^rigpath=(.+)/) { - $rigpath = $1; + elsif ($line =~ /^hamlibport=(.+)/) { + $hamlibport= $1; } elsif ($line =~ /^checklogs=(.+)/) { $checklogs = $1; @@ -512,7 +513,6 @@ return 1; # Only open Database when config file was read. if (&readsubconfig()) { &connectdb; - &connectrig; } ## We connect to the Database now... @@ -533,18 +533,6 @@ else { # MYSQL, only if defined. } -# Open Rig for Hamlib - -sub connectrig { - if ( $autoqueryrig eq 1) { - if (-r '/usr/local/share/yfklog/rigctld.sh') { - system('sh /usr/local/share/yfklog/rigctld.sh'); - sleep 1; - } - } -} - - # Now we read cty.dat or exit when it's not found. my $ctydat = "$prefix/share/yfklog/cty.dat"; if (-R "./cty.dat") { @@ -5714,8 +5702,8 @@ sub queryrig { my ($freq, $mode); - my $sock = new IO::Socket::INET ( PeerAddr => 'localhost', - PeerPort => $hamlibtcpport, Proto => 'tcp'); + my $sock = new IO::Socket::INET ( PeerAddr => $hamlibaddr, + PeerPort => $hamlibport, Proto => 'tcp'); return 0 unless $sock;