git: c802989b601a - main - comms/meshcore-cli: new port, CLI to manage MeshCore devices
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 10 Feb 2026 16:31:06 UTC
The branch main has been updated by samm:
URL: https://cgit.FreeBSD.org/ports/commit/?id=c802989b601ae197406105231c963ef884d8fe0e
commit c802989b601ae197406105231c963ef884d8fe0e
Author: Oleksii Samorukov <samm@FreeBSD.org>
AuthorDate: 2026-02-10 16:30:28 +0000
Commit: Oleksii Samorukov <samm@FreeBSD.org>
CommitDate: 2026-02-10 16:30:28 +0000
comms/meshcore-cli: new port, CLI to manage MeshCore devices
---
comms/Makefile | 1 +
comms/meshcore-cli/Makefile | 24 ++++++
comms/meshcore-cli/distinfo | 3 +
.../files/patch-src_meshcore__cli_meshcore__cli.py | 94 ++++++++++++++++++++++
comms/meshcore-cli/pkg-descr | 3 +
5 files changed, 125 insertions(+)
diff --git a/comms/Makefile b/comms/Makefile
index 6a5b41fbee23..e812e40d8ca6 100644
--- a/comms/Makefile
+++ b/comms/Makefile
@@ -96,6 +96,7 @@
SUBDIR += locator
SUBDIR += lrzsz
SUBDIR += lysdr
+ SUBDIR += meshcore-cli
SUBDIR += mbelib
SUBDIR += mgetty+sendfax
SUBDIR += minicom
diff --git a/comms/meshcore-cli/Makefile b/comms/meshcore-cli/Makefile
new file mode 100644
index 000000000000..30c588b013f7
--- /dev/null
+++ b/comms/meshcore-cli/Makefile
@@ -0,0 +1,24 @@
+PORTNAME= meshcore_cli
+PORTVERSION= 1.4.0
+CATEGORIES= comms python
+MASTER_SITES= PYPI
+PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}
+
+MAINTAINER= samm@FreeBSD.org
+COMMENT= CLI interface to MeschCore companion app over TCP or Serial
+WWW= https://github.com/meshcore-dev/meshcore-cli
+
+LICENSE= MIT
+LICENSE_FILE= ${WRKSRC}/LICENSE
+
+BUILD_DEPENDS= ${PYTHON_PKGNAMEPREFIX}hatchling>0:devel/py-hatchling@${PY_FLAVOR}
+RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}meshcore>0:comms/py-meshcore@${PY_FLAVOR} \
+ ${PYTHON_PKGNAMEPREFIX}prompt-toolkit>0:devel/py-prompt-toolkit@${PY_FLAVOR} \
+ ${PYTHON_PKGNAMEPREFIX}pycryptodome>0:security/py-pycryptodome@${PY_FLAVOR} \
+ ${PYTHON_PKGNAMEPREFIX}requests>0:www/py-requests@${PY_FLAVOR}
+
+USES= python:3.10+
+USE_PYTHON= autoplist concurrent pep517
+NO_ARCH= yes
+
+.include <bsd.port.mk>
diff --git a/comms/meshcore-cli/distinfo b/comms/meshcore-cli/distinfo
new file mode 100644
index 000000000000..3735881d081e
--- /dev/null
+++ b/comms/meshcore-cli/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1770719737
+SHA256 (meshcore_cli-1.4.0.tar.gz) = 93c6d7a75c91bfd2d16c4a1248df9c2d663b1a7463f66251133ce38ea4264fc6
+SIZE (meshcore_cli-1.4.0.tar.gz) = 44928
diff --git a/comms/meshcore-cli/files/patch-src_meshcore__cli_meshcore__cli.py b/comms/meshcore-cli/files/patch-src_meshcore__cli_meshcore__cli.py
new file mode 100644
index 000000000000..1e4a332117b6
--- /dev/null
+++ b/comms/meshcore-cli/files/patch-src_meshcore__cli_meshcore__cli.py
@@ -0,0 +1,94 @@
+--- src/meshcore_cli/meshcore_cli.py.orig 2020-02-02 00:00:00 UTC
++++ src/meshcore_cli/meshcore_cli.py
+@@ -9,8 +9,6 @@ import time, datetime
+ import getopt, json, shlex, re
+ import logging
+ import requests
+-from bleak import BleakScanner, BleakClient
+-from bleak.exc import BleakError, BleakDBusError
+ import serial.tools.list_ports
+ from pathlib import Path
+ import traceback
+@@ -27,6 +25,13 @@ from prompt_toolkit.document import Document
+ from Crypto.Cipher import AES
+ from Crypto.Hash import HMAC, SHA256
+
++try:
++ from bleak import BleakScanner, BleakClient
++ from bleak.exc import BleakError, BleakDBusError
++ BLEAK_AVAILABLE = True
++except ImportError:
++ BLEAK_AVAILABLE = False
++
+ import re
+
+ from meshcore import MeshCore, EventType, logger
+@@ -4307,16 +4312,17 @@ async def main(argv):
+ case "-q": # quiet (turns logger to ERROR only)
+ quiet = True
+ case "-l" :
+- print("BLE devices:")
+- try :
+- devices = await BleakScanner.discover(timeout=timeout)
+- if len(devices) == 0:
+- print(" No ble device found")
+- for d in devices :
+- if not d.name is None and d.name.startswith("MeshCore-"):
+- print(f" {d.address} {d.name}")
+- except (BleakError, BleakDBusError):
+- print(" No BLE HW")
++ if BLEAK_AVAILABLE:
++ print("BLE devices:")
++ try :
++ devices = await BleakScanner.discover(timeout=timeout)
++ if len(devices) == 0:
++ print(" No ble device found")
++ for d in devices :
++ if not d.name is None and d.name.startswith("MeshCore-"):
++ print(f" {d.address} {d.name}")
++ except (BleakError, BleakDBusError):
++ print(" No BLE HW")
+ print("\nSerial ports:")
+ ports = serial.tools.list_ports.comports()
+ for port, desc, hwid in sorted(ports):
+@@ -4325,13 +4331,14 @@ async def main(argv):
+ case "-S" :
+ choices = []
+
+- try :
+- devices = await BleakScanner.discover(timeout=timeout)
+- for d in devices:
+- if not d.name is None and d.name.startswith("MeshCore-"):
+- choices.append(({"type":"ble","device":d}, f"{d.address:<22} {d.name}"))
+- except (BleakError, BleakDBusError):
+- logger.info("No BLE Device")
++ if BLEAK_AVAILABLE:
++ try :
++ devices = await BleakScanner.discover(timeout=timeout)
++ for d in devices:
++ if not d.name is None and d.name.startswith("MeshCore-"):
++ choices.append(({"type":"ble","device":d}, f"{d.address:<22} {d.name}"))
++ except (BleakError, BleakDBusError):
++ logger.info("No BLE Device")
+
+ ports = serial.tools.list_ports.comports()
+ for port, desc, hwid in sorted(ports):
+@@ -4388,7 +4395,7 @@ async def main(argv):
+ mc = await MeshCore.create_tcp(host=hostname, port=port, debug=debug, only_error=json_output)
+ elif not serial_port is None : # connect via serial port
+ mc = await MeshCore.create_serial(port=serial_port, baudrate=baudrate, debug=debug, only_error=json_output)
+- else : #connect via ble
++ elif BLEAK_AVAILABLE : #connect via ble
+ client = None
+ if device or address and len(address.split(":")) == 6 :
+ pass
+@@ -4471,6 +4478,9 @@ async def main(argv):
+ f.write(device.address)
+ elif not address is None:
+ f.write(address)
++
++ if mc is None:
++ return
+
+ handle_message.mc = mc # connect meshcore to handle_message
+ handle_advert.mc = mc
diff --git a/comms/meshcore-cli/pkg-descr b/comms/meshcore-cli/pkg-descr
new file mode 100644
index 000000000000..e518ff9bb894
--- /dev/null
+++ b/comms/meshcore-cli/pkg-descr
@@ -0,0 +1,3 @@
+meshcore-cli is a tool that connects to companion radio node (meshcore client)
+over BLE, TCP or Serial and lets you interact with it from a terminal using a
+command line interface.