Reading out the modem-versin directly from the configured modem in MMDVM.ini
DONT FORGET: Read the README!!! Add user mmdvm to group dialout!!! Otherwise it will not work!
This commit is contained in:
parent
dc8c740cd4
commit
3755cdb5ff
4 changed files with 37 additions and 6 deletions
|
@ -44,6 +44,7 @@ Actually known:
|
||||||
|
|
||||||
### Installation steps
|
### Installation steps
|
||||||
* first of all (if not already done by installation of MMDVMHost): create a syetemuser with `sudo adduser --system --no-create-home --group mmdvm`
|
* first of all (if not already done by installation of MMDVMHost): create a syetemuser with `sudo adduser --system --no-create-home --group mmdvm`
|
||||||
|
* also add the new user to the group "dialout" with `usermod -a -G dialout mmdvm`
|
||||||
* add following line to /etc/sudoers with `sudo visudo` for getting the logtailer access to MMDVMHost: `www-data ALL=(ALL) NOPASSWD: /usr/local/bin/MMDVMHost`
|
* add following line to /etc/sudoers with `sudo visudo` for getting the logtailer access to MMDVMHost: `www-data ALL=(ALL) NOPASSWD: /usr/local/bin/MMDVMHost`
|
||||||
* clone this repository to your home-directory with `git clone --recurse-submodules -j8 https://github.com/dg9vh/MMDVMHost-Websocketboard` to clone the repository with it's submodules
|
* clone this repository to your home-directory with `git clone --recurse-submodules -j8 https://github.com/dg9vh/MMDVMHost-Websocketboard` to clone the repository with it's submodules
|
||||||
* create directory with `sudo mkdir /opt/MMDVMDash`
|
* create directory with `sudo mkdir /opt/MMDVMDash`
|
||||||
|
|
|
@ -478,10 +478,10 @@ function getLastHeard(document, event) {
|
||||||
lines.forEach(function(line, index, array) {
|
lines.forEach(function(line, index, array) {
|
||||||
logIt("LogLine: " + line);
|
logIt("LogLine: " + line);
|
||||||
if (!inDashboardBlacklist(line)) {
|
if (!inDashboardBlacklist(line)) {
|
||||||
if (line.indexOf("description:") > 0 ) {
|
/*if (line.indexOf("description:") > 0 ) {
|
||||||
modem = line.substring(line.indexOf("description:") + 12);
|
modem = line.substring(line.indexOf("description:") + 12);
|
||||||
document.getElementById("modem").innerHTML = modem;
|
document.getElementById("modem").innerHTML = modem;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
txing = false;
|
txing = false;
|
||||||
if (line.indexOf("Talker Alias") < 0 && line.indexOf("Downlink Activate") < 0 && line.indexOf("Preamble CSBK") < 0 && line.indexOf("data header") < 0 && line.indexOf("0000:") < 0 && line.length > 0 && (line.indexOf("received") > 0 || line.indexOf("network watchdog") > 0)) {
|
if (line.indexOf("Talker Alias") < 0 && line.indexOf("Downlink Activate") < 0 && line.indexOf("Preamble CSBK") < 0 && line.indexOf("data header") < 0 && line.indexOf("0000:") < 0 && line.length > 0 && (line.indexOf("received") > 0 || line.indexOf("network watchdog") > 0)) {
|
||||||
|
@ -747,7 +747,9 @@ function getSysInfo(document, event) {
|
||||||
data = data.substring(data.indexOf(" ") + 1);
|
data = data.substring(data.indexOf(" ") + 1);
|
||||||
document.getElementById("mmdvmhost_version").innerHTML = data.substring(data.indexOf("mmdvmhost_version:") + 18, data.indexOf(" mmdvmhost_ctime"));
|
document.getElementById("mmdvmhost_version").innerHTML = data.substring(data.indexOf("mmdvmhost_version:") + 18, data.indexOf(" mmdvmhost_ctime"));
|
||||||
data = data.substring(data.indexOf(" ") + 1);
|
data = data.substring(data.indexOf(" ") + 1);
|
||||||
document.getElementById("built").innerHTML = data.substring(data.indexOf("mmdvmhost_ctime:") + 16, data.indexOf(" callsign"));
|
document.getElementById("built").innerHTML = data.substring(data.indexOf("mmdvmhost_ctime:") + 16, data.indexOf(" mmdvm_version"));
|
||||||
|
data = data.substring(data.indexOf(" ") + 1);
|
||||||
|
document.getElementById("modem").innerHTML = data.substring(data.indexOf("mmdvm_version:") + 14, data.indexOf(" callsign"));
|
||||||
data = data.substring(data.indexOf(" callsign") + 1);
|
data = data.substring(data.indexOf(" callsign") + 1);
|
||||||
document.getElementById("callsign").innerHTML = data.substring(data.indexOf("callsign:") + 9, data.indexOf(" "));
|
document.getElementById("callsign").innerHTML = data.substring(data.indexOf("callsign:") + 9, data.indexOf(" "));
|
||||||
data = data.substring(data.indexOf(" ") + 1);
|
data = data.substring(data.indexOf(" ") + 1);
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
var dashboard_version = "2021-02-08 20:53:38";
|
var dashboard_version = "2021-02-09 17:45:07";
|
||||||
|
|
32
logtailer.py
32
logtailer.py
|
@ -19,6 +19,7 @@ import functools
|
||||||
from http import HTTPStatus
|
from http import HTTPStatus
|
||||||
import subprocess
|
import subprocess
|
||||||
import time
|
import time
|
||||||
|
import serial
|
||||||
|
|
||||||
MIME_TYPES = {
|
MIME_TYPES = {
|
||||||
"html": "text/html",
|
"html": "text/html",
|
||||||
|
@ -38,6 +39,32 @@ dmrids = {}
|
||||||
logging.basicConfig(format='%(asctime)s %(levelname)s %(message)s', level=logging.INFO)
|
logging.basicConfig(format='%(asctime)s %(levelname)s %(message)s', level=logging.INFO)
|
||||||
conv = Ansi2HTMLConverter(inline=True)
|
conv = Ansi2HTMLConverter(inline=True)
|
||||||
|
|
||||||
|
def getMMDVMVersion(port):
|
||||||
|
try:
|
||||||
|
logging.info('Modem-Port={}'.format(port))
|
||||||
|
ser = serial.Serial(port, baudrate = 115200)
|
||||||
|
logging.info('Connected!');
|
||||||
|
time.sleep(1)
|
||||||
|
logging.info('Querying version from modem');
|
||||||
|
ser.write(bytearray.fromhex("E0 03 00"))
|
||||||
|
ch = ""
|
||||||
|
while ch != bytearray.fromhex("01"):
|
||||||
|
ch = ser.read()
|
||||||
|
|
||||||
|
version = ""
|
||||||
|
ch = ""
|
||||||
|
while ch != bytearray.fromhex("00"):
|
||||||
|
ch = ser.read()
|
||||||
|
version += ch.decode()
|
||||||
|
ser.close()
|
||||||
|
logging.info('Modem-Version={}'.format(version))
|
||||||
|
|
||||||
|
return version
|
||||||
|
except Exception as e:
|
||||||
|
logging.info('Modem-Exception={}'.format(e))
|
||||||
|
return "Actually not available"
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
async def process_request(sever_root, path, request_headers):
|
async def process_request(sever_root, path, request_headers):
|
||||||
"""Serves a file when doing a GET request with a valid path."""
|
"""Serves a file when doing a GET request with a valid path."""
|
||||||
|
@ -73,6 +100,7 @@ async def process_request(sever_root, path, request_headers):
|
||||||
logging.info("HTTP GET {} 200 OK".format(path))
|
logging.info("HTTP GET {} 200 OK".format(path))
|
||||||
return HTTPStatus.OK, response_headers, body
|
return HTTPStatus.OK, response_headers, body
|
||||||
|
|
||||||
|
|
||||||
async def view_log(websocket, path):
|
async def view_log(websocket, path):
|
||||||
global config
|
global config
|
||||||
global dmrids
|
global dmrids
|
||||||
|
@ -163,11 +191,12 @@ async def view_log(websocket, path):
|
||||||
mmdvmhost_version = str(subprocess.Popen(config['MMDVMHost']['MMDVM_bin'] + " -v", shell=True, stdout=subprocess.PIPE).stdout.read().decode("utf-8"))
|
mmdvmhost_version = str(subprocess.Popen(config['MMDVMHost']['MMDVM_bin'] + " -v", shell=True, stdout=subprocess.PIPE).stdout.read().decode("utf-8"))
|
||||||
mmdvmhost_ctime = time.ctime(os.path.getmtime(config['MMDVMHost']['MMDVM_bin']))
|
mmdvmhost_ctime = time.ctime(os.path.getmtime(config['MMDVMHost']['MMDVM_bin']))
|
||||||
mmdvmhost_buildtime = datetime.datetime.strptime(mmdvmhost_ctime, "%a %b %d %H:%M:%S %Y")
|
mmdvmhost_buildtime = datetime.datetime.strptime(mmdvmhost_ctime, "%a %b %d %H:%M:%S %Y")
|
||||||
|
mmdvm_version = getMMDVMVersion(mmdvmhost_config['Modem']['Port'])
|
||||||
callsign = mmdvmhost_config['General']['Callsign']
|
callsign = mmdvmhost_config['General']['Callsign']
|
||||||
dmrid = mmdvmhost_config['General']['Id']
|
dmrid = mmdvmhost_config['General']['Id']
|
||||||
txqrg = mmdvmhost_config['Info']['TXFrequency']
|
txqrg = mmdvmhost_config['Info']['TXFrequency']
|
||||||
rxqrg = mmdvmhost_config['Info']['RXFrequency']
|
rxqrg = mmdvmhost_config['Info']['RXFrequency']
|
||||||
await websocket.send("HOSTINFO: mmdvmhost_version:" + mmdvmhost_version + " mmdvmhost_ctime:" + mmdvmhost_ctime + " callsign:" + callsign + " dmrid:" + dmrid + " txqrg:" + txqrg + " rxqrg:" + rxqrg)
|
await websocket.send("HOSTINFO: mmdvmhost_version:" + mmdvmhost_version + " mmdvmhost_ctime:" + mmdvmhost_ctime + " mmdvm_version:" + mmdvm_version + " callsign:" + callsign + " dmrid:" + dmrid + " txqrg:" + txqrg + " rxqrg:" + rxqrg)
|
||||||
await asyncio.sleep(1)
|
await asyncio.sleep(1)
|
||||||
while True:
|
while True:
|
||||||
cpu_temp = ""
|
cpu_temp = ""
|
||||||
|
@ -236,7 +265,6 @@ def websocketserver():
|
||||||
asyncio.get_event_loop().run_forever()
|
asyncio.get_event_loop().run_forever()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
dmr_id_lookup = config['MMDVMHost']['DMR_ID_Lookup']
|
dmr_id_lookup = config['MMDVMHost']['DMR_ID_Lookup']
|
||||||
dmr_id_lookupfile = config['MMDVMHost']['DMR_ID_LookupFile']
|
dmr_id_lookupfile = config['MMDVMHost']['DMR_ID_LookupFile']
|
||||||
|
|
Loading…
Reference in a new issue