From 284daf0258308ff48074f5b5587cf342ca6a329d Mon Sep 17 00:00:00 2001 From: dj2ls Date: Tue, 11 Jan 2022 14:57:11 +0100 Subject: [PATCH] hamlib test --- tnc/daemon.py | 13 ++++++++++++- tnc/rig.py | 10 ++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/tnc/daemon.py b/tnc/daemon.py index 6fd12b9f..36ced126 100755 --- a/tnc/daemon.py +++ b/tnc/daemon.py @@ -64,8 +64,18 @@ def noalsaerr(): try: # installation path for Ubuntu 20.04 LTS python modules sys.path.append('/usr/local/lib/python'+ python_version +'/site-packages') + # installation path for Ubuntu 20.10 + sys.path.append('/usr/local/lib/') + + # everything else... not nice, but an attempt + sys.path.append('/usr/local/lib/python3.6/site-packages') + sys.path.append('/usr/local/lib/python3.7/site-packages') + sys.path.append('/usr/local/lib/python3.8/site-packages') + sys.path.append('/usr/local/lib/python3.9/site-packages') + sys.path.append('/usr/local/lib/python3.10/site-packages') + + import Hamlib # https://stackoverflow.com/a/4703409 @@ -104,7 +114,7 @@ class CMDTCPRequestHandler(socketserver.BaseRequestHandler): structlog.get_logger("structlog").debug("[DMN] Client connected", ip=self.client_address[0]) # loop through socket buffer until timeout is reached. then close buffer - socketTimeout = time.time() + 3 + socketTimeout = time.time() + 6 while socketTimeout > time.time(): time.sleep(0.01) @@ -347,6 +357,7 @@ class CMDTCPRequestHandler(socketserver.BaseRequestHandler): stop_bits = str(received_json["parameter"][0]["stop_bits"]) handshake = str(received_json["parameter"][0]["handshake"]) + hamlib = rig.radio() hamlib.open_rig(devicename=devicename, deviceport=deviceport, hamlib_ptt_type=pttprotocol, serialspeed=serialspeed, pttport=pttport, data_bits=data_bits, stop_bits=stop_bits, handshake=handshake) diff --git a/tnc/rig.py b/tnc/rig.py index 790491f8..d22f87d3 100644 --- a/tnc/rig.py +++ b/tnc/rig.py @@ -14,10 +14,20 @@ try: # installation path for Ubuntu 20.04 LTS python modules sys.path.append('/usr/local/lib/python'+ python_version +'/site-packages') + # installation path for Ubuntu 20.10 + sys.path.append('/usr/local/lib/') + # installation path for Suse sys.path.append('/usr/local/lib64/python'+ python_version +'/site-packages') + + # everything else... not nice, but an attempt to see how its running within app bundle + sys.path.append('/usr/local/lib/python3.6/site-packages') + sys.path.append('/usr/local/lib/python3.7/site-packages') + sys.path.append('/usr/local/lib/python3.8/site-packages') + sys.path.append('/usr/local/lib/python3.9/site-packages') + sys.path.append('/usr/local/lib/python3.10/site-packages') + import Hamlib # https://stackoverflow.com/a/4703409