git: 7f1b354e3c83 - main - comms/py-elelabs-zigbee-ezsp-utility: new port

From: Neel Chauhan <nc_at_FreeBSD.org>
Date: Mon, 12 Sep 2022 16:44:05 UTC
The branch main has been updated by nc:

URL: https://cgit.FreeBSD.org/ports/commit/?id=7f1b354e3c834448592d58a3f1f4433f8305b6ef

commit 7f1b354e3c834448592d58a3f1f4433f8305b6ef
Author:     Rozhuk Ivan <rozhuk.im@gmail.com>
AuthorDate: 2022-09-12 00:16:27 +0000
Commit:     Neel Chauhan <nc@FreeBSD.org>
CommitDate: 2022-09-12 16:44:02 +0000

    comms/py-elelabs-zigbee-ezsp-utility: new port
    
    PR:     266380
---
 comms/Makefile                                   |  1 +
 comms/py-elelabs-zigbee-ezsp-utility/Makefile    | 47 ++++++++++++++++++++++++
 comms/py-elelabs-zigbee-ezsp-utility/distinfo    |  3 ++
 comms/py-elelabs-zigbee-ezsp-utility/pkg-descr   | 21 +++++++++++
 comms/py-elelabs-zigbee-ezsp-utility/pkg-message | 34 +++++++++++++++++
 5 files changed, 106 insertions(+)

diff --git a/comms/Makefile b/comms/Makefile
index 3c67a58fc4b6..89ee6a0f75e2 100644
--- a/comms/Makefile
+++ b/comms/Makefile
@@ -131,6 +131,7 @@
     SUBDIR += pr
     SUBDIR += predict
     SUBDIR += py-adafruit-ampy
+    SUBDIR += py-elelabs-zigbee-ezsp-utility
     SUBDIR += py-esptool
     SUBDIR += py-fritzconnection
     SUBDIR += py-hid
diff --git a/comms/py-elelabs-zigbee-ezsp-utility/Makefile b/comms/py-elelabs-zigbee-ezsp-utility/Makefile
new file mode 100644
index 000000000000..b8aa6152655d
--- /dev/null
+++ b/comms/py-elelabs-zigbee-ezsp-utility/Makefile
@@ -0,0 +1,47 @@
+PORTNAME=	elelabs-zigbee-ezsp-utility
+DISTVERSION=	20220218
+CATEGORIES=	comms python
+PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
+
+MAINTAINER=	rozhuk.im@gmail.com
+COMMENT=	Elelabs Firmware Update Utility
+WWW=		https://github.com/Elelabs/elelabs-zigbee-ezsp-utility
+
+LICENSE=	APACHE20
+LICENSE_FILE=	${WRKSRC}/LICENSE
+
+RUN_DEPENDS=	${PYTHON_PKGNAMEPREFIX}pyserial>=3.4:comms/py-pyserial@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}xmodem>=0.4.5:comms/py-xmodem@${PY_FLAVOR}
+
+USES=		python:3.6+ shebangfix
+USE_GITHUB=	yes
+GH_ACCOUNT=	Elelabs
+GH_TAGNAME=	7fc415497f7e2b3410e3350b359ac5c71043399e
+USE_PYTHON=	flavors
+
+SHEBANG_FILES=	Elelabs_EzspFwUtility.py
+
+NO_ARCH=	yes
+NO_BUILD=	yes
+
+post-patch:
+	@${REINPLACE_CMD} -e "s|data/EFR32|${DATADIR}/EFR32|g" \
+		${WRKSRC}/Elelabs_EzspFwUtility.py
+
+# This is to prevent Mk/Uses/python.mk do-configure target from firing.
+do-configure:
+	@${ECHO} 'No configure'
+
+do-install:
+	${INSTALL_SCRIPT} ${WRKSRC}/Elelabs_EzspFwUtility.py ${STAGEDIR}${PREFIX}/bin/
+	${CHMOD} +x ${STAGEDIR}${PREFIX}/bin/Elelabs_EzspFwUtility.py
+	(cd ${WRKSRC}/data && ${COPYTREE_SHARE} . ${STAGEDIR}${DATADIR})
+
+post-install:
+# Regenerate .PLIST.pymodtemp to get all installed files from
+# ${STAGEDIR}.
+	@${FIND} ${STAGEDIR} -type f -o -type l | \
+		${SORT} | ${SED} -e 's|${STAGEDIR}||' \
+		>> ${WRKDIR}/.PLIST.mktmp
+
+.include <bsd.port.mk>
diff --git a/comms/py-elelabs-zigbee-ezsp-utility/distinfo b/comms/py-elelabs-zigbee-ezsp-utility/distinfo
new file mode 100644
index 000000000000..1e4b2a1476e0
--- /dev/null
+++ b/comms/py-elelabs-zigbee-ezsp-utility/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1662938072
+SHA256 (Elelabs-elelabs-zigbee-ezsp-utility-20220218-7fc415497f7e2b3410e3350b359ac5c71043399e_GH0.tar.gz) = 412f7c5b0b7786c8a6d6f760a3063d4c0e0551d79bd023a731e7200c69324158
+SIZE (Elelabs-elelabs-zigbee-ezsp-utility-20220218-7fc415497f7e2b3410e3350b359ac5c71043399e_GH0.tar.gz) = 1244999
diff --git a/comms/py-elelabs-zigbee-ezsp-utility/pkg-descr b/comms/py-elelabs-zigbee-ezsp-utility/pkg-descr
new file mode 100644
index 000000000000..ce81d67a8358
--- /dev/null
+++ b/comms/py-elelabs-zigbee-ezsp-utility/pkg-descr
@@ -0,0 +1,21 @@
+The Elelabs Firmware Update Utility is a basic Python 3 script to flash
+the the firmware inside a range of Elelabs Zigbee and Thread products to
+a newer version.
+
+Currently sold supported products based on Silicon Labs microcontrollers:
+    Elelabs Zigbee Raspberry Pi Shield ELR023 (EFR32MG13P)
+    Elelabs Zigbee USB Adapter ELU013 (EFR32MG13P)
+
+Previously sold supported products based on Silicon Labs microcontrollers:
+    Elelabs Zigbee Raspberry Pi Shield ELR022 (EFR32MG1B)
+    Elelabs Zigbee USB Adapter ELU012 (EFR32MG1B)
+    Elelabs Zigbee Raspberry Pi Shield EZBPIS (EM357)
+    Elelabs Zigbee USB Adapter EZBUSBA (EM357)
+
+Disclaimer: This utility should also work with other generic EZSP
+(EmberZNet Serial Protocol) or Spinel (Openthread Serial Protocol) based
+adapters and modules from other vendors, however firmwares for products
+not from Elelabs are not provided here and there is no guarantees that
+it will work with non-Elelabs products. Be wanted that you may void your
+warranty and even brick your adapter if the firmware update is not
+supported by your mnaufacturer.
diff --git a/comms/py-elelabs-zigbee-ezsp-utility/pkg-message b/comms/py-elelabs-zigbee-ezsp-utility/pkg-message
new file mode 100644
index 000000000000..f096790047b7
--- /dev/null
+++ b/comms/py-elelabs-zigbee-ezsp-utility/pkg-message
@@ -0,0 +1,34 @@
+[
+{ type: install
+  message: <<EOM
+
+!!! ATTENTION !!!
+
+Make sure that you are flashing proper F/W.
+There is different pinout in different images and you may loose
+connection to EFR32 chip after flashing.
+
+
+Extra F/W sources:
+https://www.zigbee2mqtt.io/guide/adapters/
+https://github.com/xsp1989/zigbeeFirmware/
+https://github.com/grobasoz/zigbee-firmware
+https://github.com/zha-ng/EZSP-Firmware
+https://github.com/MattWestb/EFR32-FW
+https://github.com/walthowd/husbzb-firmware
+
+
+Please note if you are using the EZSP v8 firmware you will also have to
+add the following to your configuration.yaml for the Home Assistant
+ZHA integration to load successfully.
+
+zha:
+  zigpy_config:
+    ezsp_config:
+      CONFIG_PACKET_BUFFER_COUNT: 64
+      CONFIG_MAX_END_DEVICE_CHILDREN: 32
+      CONFIG_SOURCE_ROUTE_TABLE_SIZE: 200
+
+EOM
+}
+]