Date: Sun, 11 Feb 2024 17:34:13 GMT From: Nicola Vitale <nivit@FreeBSD.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org Subject: git: b6998fd13cf6 - main - sysutils/py-blinkstick: Add new port Message-ID: <202402111734.41BHYDJS075128@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by nivit: URL: https://cgit.FreeBSD.org/ports/commit/?id=b6998fd13cf6354a837506d53c87e58fd9307417 commit b6998fd13cf6354a837506d53c87e58fd9307417 Author: Nicola Vitale <nivit@FreeBSD.org> AuthorDate: 2024-02-11 17:29:41 +0000 Commit: Nicola Vitale <nivit@FreeBSD.org> CommitDate: 2024-02-11 17:29:41 +0000 sysutils/py-blinkstick: Add new port Python interface to control Blinkstick devices connected to computer. https://pypi.org/project/BlinkStick/ --- sysutils/Makefile | 1 + sysutils/py-blinkstick/Makefile | 29 ++++++++++++++++++++++ sysutils/py-blinkstick/distinfo | 3 +++ .../py-blinkstick/files/blinkstick-devices.conf | 13 ++++++++++ .../files/patch-blinkstick_blinkstick.py | 17 +++++++++++++ sysutils/py-blinkstick/pkg-descr | 1 + sysutils/py-blinkstick/pkg-message | 15 +++++++++++ 7 files changed, 79 insertions(+) diff --git a/sysutils/Makefile b/sysutils/Makefile index 89209c34ea66..44bdc5cb6982 100644 --- a/sysutils/Makefile +++ b/sysutils/Makefile @@ -1092,6 +1092,7 @@ SUBDIR += py-azure-cli-core SUBDIR += py-azure-cli-telemetry SUBDIR += py-bitrot + SUBDIR += py-blinkstick SUBDIR += py-borgmatic SUBDIR += py-concurrent-log-handler SUBDIR += py-cron-descriptor diff --git a/sysutils/py-blinkstick/Makefile b/sysutils/py-blinkstick/Makefile new file mode 100644 index 000000000000..3f82eddc3dc0 --- /dev/null +++ b/sysutils/py-blinkstick/Makefile @@ -0,0 +1,29 @@ +PORTNAME= blinkstick +DISTVERSION= g20230504 +CATEGORIES= sysutils python +PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX} +DISTNAME= BlinkStick-${PORTVERSION} + +MAINTAINER= nivit@FreeBSD.org +COMMENT= Python package to control BlinkStick USB devices +WWW= https://pypi.org/project/BlinkStick/ + +LICENSE= BSD3CLAUSE +LICENSE_FILE= ${WRKSRC}/LICENSE.txt + +RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}pyusb>=1.2.1:devel/py-pyusb@${PY_FLAVOR} + +USES= python + +USE_GITHUB= yes +GH_ACCOUNT= arvydas +GH_PROJECT= ${PORTNAME}-python +GH_TAGNAME= 8140b9fa +USE_PYTHON= autoplist distutils + +PLIST_FILES= etc/devd/blinkstick-devices.conf + +post-install: + ${INSTALL_DATA} ${FILESDIR}/blinkstick-devices.conf ${STAGEDIR}${PREFIX}/etc/devd/ + +.include <bsd.port.mk> diff --git a/sysutils/py-blinkstick/distinfo b/sysutils/py-blinkstick/distinfo new file mode 100644 index 000000000000..2e5ea8373c4a --- /dev/null +++ b/sysutils/py-blinkstick/distinfo @@ -0,0 +1,3 @@ +TIMESTAMP = 1707667097 +SHA256 (arvydas-blinkstick-python-g20230504-8140b9fa_GH0.tar.gz) = 56b09bc6fcde82c9cabb7bfe47fa830e43049c8027df1241d56a81a3779ff24d +SIZE (arvydas-blinkstick-python-g20230504-8140b9fa_GH0.tar.gz) = 18708 diff --git a/sysutils/py-blinkstick/files/blinkstick-devices.conf b/sysutils/py-blinkstick/files/blinkstick-devices.conf new file mode 100644 index 000000000000..5bce2267dc61 --- /dev/null +++ b/sysutils/py-blinkstick/files/blinkstick-devices.conf @@ -0,0 +1,13 @@ +# devd configuration for Blinkstick devices +# +# users must be added to the operator group + +notify 8352 { + match "system" "USB"; + match "subsystem" "DEVICE"; + match "type" "ATTACH"; + match "vendor" "0x20a0"; + match "product" "0x41e5"; + action "chgrp operator /dev/$cdev; chmod 660 /dev/$cdev"; +}; + diff --git a/sysutils/py-blinkstick/files/patch-blinkstick_blinkstick.py b/sysutils/py-blinkstick/files/patch-blinkstick_blinkstick.py new file mode 100644 index 000000000000..8b946c7cf6f6 --- /dev/null +++ b/sysutils/py-blinkstick/files/patch-blinkstick_blinkstick.py @@ -0,0 +1,17 @@ +--- blinkstick/blinkstick.py.orig 2023-05-04 08:45:38 UTC ++++ blinkstick/blinkstick.py +@@ -1,4 +1,5 @@ from ._version import __version__ + from ._version import __version__ ++import os + import time + import sys + import re +@@ -820,7 +821,7 @@ class BlinkStick(object): + if self.device is None: + raise BlinkStickException("Could not find BlinkStick...") + +- if self.device.is_kernel_driver_active(0): ++ if os.geteuid() == 0 and self.device.is_kernel_driver_active(0): + try: + self.device.detach_kernel_driver(0) + except usb.core.USBError as e: diff --git a/sysutils/py-blinkstick/pkg-descr b/sysutils/py-blinkstick/pkg-descr new file mode 100644 index 000000000000..94cd2589d45a --- /dev/null +++ b/sysutils/py-blinkstick/pkg-descr @@ -0,0 +1 @@ +Python interface to control Blinkstick devices connected to computer. diff --git a/sysutils/py-blinkstick/pkg-message b/sysutils/py-blinkstick/pkg-message new file mode 100644 index 000000000000..556d44de91c6 --- /dev/null +++ b/sysutils/py-blinkstick/pkg-message @@ -0,0 +1,15 @@ +[ +{ type: install + message: <<EOM +Blinkstick has been installed. You have to restart devd(8) with the command: + +# service devd restart + +Blinkstick also requires read/write access to devices, so the users +must belong to the operator group. You can add them with the command: + +# pw group mod operator -m <user> + +EOM +} +]
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202402111734.41BHYDJS075128>