[Bug 253999] comms/nanovna-saver: files/Sysctl.py makes wrong assumptions

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Wed Mar 3 22:13:02 UTC 2021


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=253999

            Bug ID: 253999
           Summary: comms/nanovna-saver: files/Sysctl.py makes wrong
                    assumptions
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: Individual Port(s)
          Assignee: hamradio at FreeBSD.org
          Reporter: joerg at FreeBSD.org
          Assignee: hamradio at FreeBSD.org
             Flags: maintainer-feedback?(hamradio at FreeBSD.org)

When trying to run comms/nanovna-saver, it crashes with:

$ NanoVNASaver
NanoVNASaver 0.3.8

Copyright (C) 2019, 2020 Rune B. Broberg
Copyright (C) 2020 NanoVNA-Saver Authors

This program comes with ABSOLUTELY NO WARRANTY
This program is licensed under the GNU General Public License version 3

See https://github.com/NanoVNA-Saver/nanovna-saver for further details.

Settings: /home/joerg/.config/NanoVNASaver/NanoVNASaver.ini
Traceback (most recent call last):
  File "/usr/local/bin/NanoVNASaver", line 11, in <module>
    load_entry_point('NanoVNASaver==0.3.8', 'console_scripts',
'NanoVNASaver')()
  File "/usr/local/lib/python3.7/site-packages/NanoVNASaver/__main__.py", line
80, in main
    window = NanoVNASaver()
  File "/usr/local/lib/python3.7/site-packages/NanoVNASaver/NanoVNASaver.py",
line 366, in __init__
    self.rescanSerialPort()
  File "/usr/local/lib/python3.7/site-packages/NanoVNASaver/NanoVNASaver.py",
line 469, in rescanSerialPort
    for iface in get_interfaces():
  File
"/usr/local/lib/python3.7/site-packages/NanoVNASaver/Hardware/Hardware.py",
line 69, in get_interfaces
    vid_pid = usb_vid_pid(d.device)
  File
"/usr/local/lib/python3.7/site-packages/NanoVNASaver/Hardware/Sysctl.py", line
20, in usb_vid_pid
    result =
(posix_sysctlbyname(b'dev.umodem.'+bytes(digit,'ascii')+b'.%pnpinfo')).decode('ascii')
  File
"/usr/local/lib/python3.7/site-packages/NanoVNASaver/Hardware/Sysctl.py", line
15, in posix_sysctlbyname
    raise Exception('sysctlbyname returned with error %s' % result)
Exception: sysctlbyname returned with error -1

It turns out it simply uses the digits from the device names, and tries to use
them as indices into sysctl("dev.umodem.<N>.%pnpinfo"). That just does not work
as intended.

List of (accessible by users) serial devices here is:

$ python3
Python 3.7.9 (default, Oct 16 2020, 21:50:54) 
[Clang 10.0.1 (git at github.com:llvm/llvm-project.git llvmorg-10.0.1-0-gef32c611a
on freebsd12
Type "help", "copyright", "credits" or "license" for more information.
>>> from serial.tools import list_ports
>>> s = list_ports.comports()
>>> for p in s:
...   print(p.device)
... 
/dev/cuau0
/dev/cuaU1
/dev/cuaU3

Actually /dev/cuaU3 is the device in question, which corresponds to
dev.umodem.0:

$ sysctl dev.umodem.0
dev.umodem.0.ttyports: 1
dev.umodem.0.ttyname: U3
dev.umodem.0.%parent: uhub9
dev.umodem.0.%pnpinfo: vendor=0x0483 product=0x5740 devclass=0x02
devsubclass=0x02 devproto=0x00 sernum="00000000001A" release=0x0200 mode=host
intclass=0x02 intsubclass=0x02 intprotocol=0x01 ttyname=U3 ttyports=1
dev.umodem.0.%location: bus=5 hubaddr=2 port=4 devaddr=6 interface=0
ugen=ugen5.6
dev.umodem.0.%driver: umodem
dev.umodem.0.%desc: SYSJOINT NanoVNA-F Virtual COMPort, class 2/2, rev
2.00/2.00, addr 6

When proceeding to digit 1 (from /dev/cuaU1), it hits the above error.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-ports-bugs mailing list