git: 6d6ce04aaa7a - main - devel/msp430-debug-stack: Better devd config installed as sample.

From: Lev A. Serebryakov <lev_at_FreeBSD.org>
Date: Fri, 11 Apr 2025 11:57:25 UTC
The branch main has been updated by lev:

URL: https://cgit.FreeBSD.org/ports/commit/?id=6d6ce04aaa7a5b1c8067321e82e6b95d20dcd144

commit 6d6ce04aaa7a5b1c8067321e82e6b95d20dcd144
Author:     Lev A. Serebryakov <lev@FreeBSD.org>
AuthorDate: 2025-04-11 11:54:50 +0000
Commit:     Lev A. Serebryakov <lev@FreeBSD.org>
CommitDate: 2025-04-11 11:54:50 +0000

    devel/msp430-debug-stack: Better devd config installed as sample.
    
     1. Install devd config as sample, to preserve actual config on package removal.
     2. Make this config better to support more devices and back-channel UART.
    
    PR:             286020
    Reported by:    Yusuf Yaman <nxjoseph@protonmail.com> [1]
    Reported by:    Petre Rodan <petre.rodan@subdimension.ro> [2]
---
 devel/msp430-debug-stack/Makefile                 |  4 +-
 devel/msp430-debug-stack/files/mspfet.conf        | 22 ----------
 devel/msp430-debug-stack/files/mspfet.conf.sample | 53 +++++++++++++++++++++++
 devel/msp430-debug-stack/pkg-plist                |  2 +-
 4 files changed, 56 insertions(+), 25 deletions(-)

diff --git a/devel/msp430-debug-stack/Makefile b/devel/msp430-debug-stack/Makefile
index 77b05bcbcc86..8c87cf41f3fb 100644
--- a/devel/msp430-debug-stack/Makefile
+++ b/devel/msp430-debug-stack/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	msp430-debug-stack
 PORTVERSION=	3.15.1.1
-PORTREVISION=	11
+PORTREVISION=	12
 CATEGORIES=	devel
 MASTER_SITES=	https://dr-download.ti.com/software-development/driver-or-library/MD-4vnqcP1Wk4/${PORTVERSION}/ \
 		LOCAL/lev:doc1 \
@@ -50,6 +50,6 @@ do-install:
 	${INSTALL_DATA} ${DISTDIR}/${DIST_SUBDIR}/slau320aj.pdf ${STAGEDIR}${DOCSDIR}/
 	${INSTALL_DATA} ${DISTDIR}/${DIST_SUBDIR}/slau656d.pdf ${STAGEDIR}${DOCSDIR}/
 	${MKDIR} ${STAGEDIR}${PREFIX}/etc/devd
-	${INSTALL_DATA} ${FILESDIR}/mspfet.conf ${STAGEDIR}${PREFIX}/etc/devd
+	${INSTALL_DATA} ${FILESDIR}/mspfet.conf.sample ${STAGEDIR}${PREFIX}/etc/devd
 
 .include <bsd.port.mk>
diff --git a/devel/msp430-debug-stack/files/mspfet.conf b/devel/msp430-debug-stack/files/mspfet.conf
deleted file mode 100644
index 3143c6d293cb..000000000000
--- a/devel/msp430-debug-stack/files/mspfet.conf
+++ /dev/null
@@ -1,22 +0,0 @@
-# Warning: Only a single instance of each FET product is supported
-#
-
-attach 20 {
-	device-name		"umodem[0-9]+";
-	match "vendor"		"0x2047";		# TI MSPBSL_STANDARD_USB_VID
-        match "product"		"0x001(0|3|4)";		# Products: UIF eZ-FET MSP-FET
-	match "interface"	"0";			# JTAG-Interface
-	action "cd /dev; p=$product; dn=$device-name;			\
-		un=$(sysctl -n dev.umodem.${dn#umodem}.ttyname);	\
-		chmod 666 cua${un}; ln -sf cua${un} mspfet${p#0x}";
-};
-
-notify 20 {
-	match "system"		"USB";
-	match "subsystem"	"INTERFACE";
-	match "type"		"DETACH";
-	match "vendor"		"0x2047";		# TI MSPBSL_STANDARD_USB_VID
-        match "product"		"0x001(0|3|4)";		# Products: UIF eZ-FET MSP-FET
-	match "interface"	"0";			# JTAG-Interface
-	action "p=$product; rm /dev/mspfet${p#0x}";
-};
diff --git a/devel/msp430-debug-stack/files/mspfet.conf.sample b/devel/msp430-debug-stack/files/mspfet.conf.sample
new file mode 100644
index 000000000000..11e4d0383642
--- /dev/null
+++ b/devel/msp430-debug-stack/files/mspfet.conf.sample
@@ -0,0 +1,53 @@
+# replacement /usr/local/etc/devd/mspfet.conf file that allows
+# unprivileged users in the 'operator' group to rw the MSP FETs
+# Warning: Only a single instance of each FET product is supported
+# while using mspdebug with the tilib interface
+
+attach 20 {
+    device-name "umodem[0-9]+";
+    match "vendor" "0x2047"; # TI MSPBSL_STANDARD_USB_VID
+    match "product" "0x001(0|3|4)"; # UIF eZ-FET MSP-FET
+    match "interface" "0"; # JTAG interface
+    action "cd /dev; p=$product; dn=$device-name; \
+        un=$(sysctl -n dev.umodem.${dn#umodem}.ttyname); \
+        chgrp operator cua${un}; chmod 660 cua${un}; \
+        ln -sf cua${un} mspfet${p#0x}";
+};
+
+attach 20 {
+    device-name "umodem[0-9]+";
+    match "vendor" "0x2047";
+    match "product" "0x001(0|3|4)";
+    match "interface" "2"; # back-channel uart interface
+    action "cd /dev; p=$product; dn=$device-name; \
+        un=$(sysctl -n dev.umodem.${dn#umodem}.ttyname); \
+        chgrp operator tty${un}; chmod 660 tty${un}";
+};
+
+notify 20 {
+    match "system" "USB";
+    match "subsystem" "INTERFACE";
+    match "type" "DETACH";
+    match "vendor" "0x2047";
+    match "product" "0x001(0|3|4)";
+    match "interface" "0"; # JTAG interface
+    action "p=$product; rm /dev/mspfet${p#0x}";
+};
+
+notify 100 {
+    match "system" "USB";
+    match "subsystem" "INTERFACE";
+    match "type" "ATTACH";
+    match "vendor" "0x2047";
+    match "product" "0x001(0|3|4)";
+    action "chgrp operator /dev/$cdev; chmod 660 /dev/$cdev";
+};
+
+notify 100 {
+    match "system" "USB";
+    match "subsystem" "INTERFACE";
+    match "type" "ATTACH";
+    match "vendor" "0x15ba"; # OLIMEX LTD
+    match "product" "0x0100"; # MSP430 JTAGISO ver.2
+    action "chgrp operator /dev/$cdev; chmod 660 /dev/$cdev";
+};
diff --git a/devel/msp430-debug-stack/pkg-plist b/devel/msp430-debug-stack/pkg-plist
index 5a06858bd3a7..94c36c67e23f 100644
--- a/devel/msp430-debug-stack/pkg-plist
+++ b/devel/msp430-debug-stack/pkg-plist
@@ -9,4 +9,4 @@ lib/libmsp430.so
 lib/libmsp430.a
 %%PORTDOCS%%%%DOCSDIR%%/slau320aj.pdf
 %%PORTDOCS%%%%DOCSDIR%%/slau656d.pdf
-etc/devd/mspfet.conf
+@sample etc/devd/mspfet.conf.sample