add --support option

This commit is contained in:
Mike Kinney
2021-12-07 09:30:10 -08:00
parent 068b902f12
commit 70099cf82d
2 changed files with 30 additions and 0 deletions

View File

@@ -17,6 +17,7 @@ from .tcp_interface import TCPInterface
from .ble_interface import BLEInterface
from . import test, remote_hardware
from . import portnums_pb2, channel_pb2, mesh_pb2, radioconfig_pb2
from .util import support_info
"""We only import the tunnel code if we are on a platform that can run it"""
have_tunnel = platform.system() == 'Linux'
@@ -195,6 +196,7 @@ def onConnected(interface):
closeNow = False # Should we drop the connection after we finish?
try:
global args
print("Connected to radio")
def getNode():
@@ -569,6 +571,11 @@ def common():
parser.print_help(sys.stderr)
sys.exit(1)
else:
if args.support:
print("")
support_info()
sys.exit(0)
if args.ch_index is not None:
global channelIndex
channelIndex = int(args.ch_index)
@@ -788,6 +795,9 @@ def initParser():
parser.add_argument('--version', action='version',
version=f"{pkg_resources.require('meshtastic')[0].version}")
parser.add_argument(
"--support", action='store_true', help="Show support info (useful when troubleshooting an issue)")
args = parser.parse_args()

View File

@@ -4,10 +4,12 @@ import traceback
from queue import Queue
import sys
import time
import platform
import logging
import threading
import serial
import serial.tools.list_ports
import pkg_resources
"""Some devices such as a seger jlink we never want to accidentally open"""
blacklistVids = dict.fromkeys([0x1366])
@@ -111,3 +113,21 @@ class DeferredExecution():
logging.error(
f"Unexpected error in deferred execution {sys.exc_info()[0]}")
print(traceback.format_exc())
def support_info():
"""Print out info that is helping in support of the cli."""
print('If having issues with meshtastic cli or python library')
print('or wish to make feature requests, visit:')
print('https://github.com/meshtastic/Meshtastic-python/issues')
print('When adding an issue, be sure to include the following info:')
print(' System: {0}'.format(platform.system()))
print(' Platform: {0}'.format(platform.platform()))
print(' Release: {0}'.format(platform.uname().release))
print(' Machine: {0}'.format(platform.uname().machine))
print(' meshtastic: v{0}'.format(pkg_resources.require('meshtastic')[0].version))
print(' Executable: {0}'.format(sys.argv[0]))
print(' Python: {0} {1} {2}'.format(platform.python_version(),
platform.python_implementation(), platform.python_compiler()))
print('')
print('Please add the output from the command: meshtastic --info')
print('')