From nobody Mon Jun 06 20:09:40 2022 X-Original-To: dev-commits-ports-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 240001BD6600; Mon, 6 Jun 2022 20:09:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4LH4Mn0T6hz3Bn0; Mon, 6 Jun 2022 20:09:41 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1654546181; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=5WbCgd2pDdKA49DUm75BdIJzafbSgDsBJFukorHJuYc=; b=KHdYVMSl9Y1JoddeiXtiVbCGrRbxAP4t0caJmfUiWIp3hBmTebVvqOk+5LyH1I4LWa4Xw0 5HCyrrcGhRCxQt1jv1sj60Ht6bRn+e+vCfzymSlWWNkQfNhaj7fBgcZU7gPZ8OpHQ7JfcU MTuL41qytpnPRTqrWmohI0BjSWZXe7EO3hm1ylBk7Zh1WQlPUEU6qKm1h9I5Fbl4OnxZM+ LBJrYBhYAKILEBauxWwO1eNOA+eXaInn9f6T337HzJwvHdDPpPX5rfc4V+u62E1BTa/LBZ IO2Mq1JR3ccQC8gf+2HP6zAqn54j5gNiPzKD2iUgFmthN55AX/gEJGO8oBNRFQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DF3F44BAC; Mon, 6 Jun 2022 20:09:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 256K9emP031662; Mon, 6 Jun 2022 20:09:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 256K9ehL031661; Mon, 6 Jun 2022 20:09:40 GMT (envelope-from git) Date: Mon, 6 Jun 2022 20:09:40 GMT Message-Id: <202206062009.256K9ehL031661@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Diane Bruce Subject: git: 1ae8d833d66a - main - comms/nanovna-saver: Fixed incorrect /dev/cua* to umodem number mapping List-Id: Commit messages for all branches of the ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-all@freebsd.org X-BeenThere: dev-commits-ports-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: db X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1ae8d833d66af8d3917b55714d628914abb3412c Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1654546181; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=5WbCgd2pDdKA49DUm75BdIJzafbSgDsBJFukorHJuYc=; b=s8jJUrosRNqimkioH8S3C5NfCwxFds5krwr7hd5aVt968HjTIXCbQIg3iCtwomfE3x56A7 o4cxOpbs+26LPTpkI1fagzCELlcfks+fc8Xi5tH85cz+MgvawQFikuRJMzMlmISy3M6g4y ULPt9xkQHc2u8DHNzOI3P8GR6aVNFmR8v3EZQz1wMKUi8L8ZyGrv0yc6zsds28FDzwYJFn 2WnzSwdwmrBT1ts5y7owcmRYWwx6OOWbZkXCxyllAzC2dtbS2uXT5knsAFB5U+Gntp6NFE FyLdZuER14BUCj+QO2VGme8CnRdXgP8We+GDPqQSQptiaTL12m8fvpTmX88UuA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1654546181; a=rsa-sha256; cv=none; b=PVzT1csfJyXJIQTGqBs3iZ35o3j3nKlGpFv8PU4WdQypXdyZTgKdtqbZhW1N3Yc4QVX2cb JlU3BgxMcyNfCAAZHAigk3kn/Stvsb5Tsv6f0c6hDar6PHtR4JSTksn4wrByeUR1nYcAgK 22VKWIGyybjf0iSXwDFx5SLlOlp/jIMA33BMsbfVcfLGeJNQUAo26KQrbJ3HolHJj2iqxP iMg/4+k4RNzqoFipWiffC+GesDyIViOjLPCwG4TiFvAwS0aYfEO7CylEU2Y3/TUAV7DM8k KNzce2bWB7wtrhL0zZfI4BJMGA6wvWWIMx4fclepx+Kh0OxpnmuFyN6kGMncwQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by db: URL: https://cgit.FreeBSD.org/ports/commit/?id=1ae8d833d66af8d3917b55714d628914abb3412c commit 1ae8d833d66af8d3917b55714d628914abb3412c Author: Diane Bruce AuthorDate: 2022-06-06 20:00:38 +0000 Commit: Diane Bruce CommitDate: 2022-06-06 20:00:38 +0000 comms/nanovna-saver: Fixed incorrect /dev/cua* to umodem number mapping Linux has an ioctl that directly retrieves information about the usb serial port on (FreeBSD) I have to find the umodem dev that the usb serial port is reference then use a sysctl to find the needed for nanovna-saver to work correctly. Originally I assumed a 1-1 mapping of devices. I was wrong. PR: ports/264272 Reported by: jeffpc@josefsipek.net --- comms/nanovna-saver/Makefile | 2 +- comms/nanovna-saver/files/Sysctl.py | 20 ++++++++++++++------ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/comms/nanovna-saver/Makefile b/comms/nanovna-saver/Makefile index faedd3e34948..f4873bfe58d8 100644 --- a/comms/nanovna-saver/Makefile +++ b/comms/nanovna-saver/Makefile @@ -1,7 +1,7 @@ PORTNAME= nanovna-saver DISTVERSIONPREFIX= v DISTVERSION= 0.3.10 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= comms hamradio MAINTAINER= hamradio@FreeBSD.org diff --git a/comms/nanovna-saver/files/Sysctl.py b/comms/nanovna-saver/files/Sysctl.py index c05dd8036b9b..db94a418a1c4 100644 --- a/comms/nanovna-saver/files/Sysctl.py +++ b/comms/nanovna-saver/files/Sysctl.py @@ -1,4 +1,5 @@ import re +import os from ctypes import * from ctypes.util import find_library @@ -15,9 +16,16 @@ def posix_sysctlbyname(name): return _mem.value def usb_vid_pid(name): - digit = (re.search(r'\d',name)).group() - result = (posix_sysctlbyname(b'dev.umodem.'+bytes(digit,'ascii')+b'.%pnpinfo')).decode('ascii') - items=result.split(' ') - vendor=int(items[0].split('=')[1],0) - product=int(items[1].split('=')[1],0) - return([vendor,product]) + dev = bytes(name[8:],'ascii') + for i in range(len(os.listdir('/dev/usb'))): + try: + found_dev = posix_sysctlbyname(b'dev.umodem.'+bytes(str(i),'ascii')+b'.ttyname') + if dev == found_dev: + result = (posix_sysctlbyname(b'dev.umodem.'+bytes(str(i),'ascii')+b'.%pnpinfo')).decode('ascii') + items=result.split(' ') + vendor=int(items[0].split('=')[1],0) + product=int(items[1].split('=')[1],0) + return([vendor,product]) + except: + pass + return [-1,-1]