You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello I am trying to make nanovnasaver v0.6.8 work under NetBSD and FreeBSD operating systems. In both operating systems serial port detection that relies on py-serial python modules does not work. py-serial does not work the same way as in Linux.
Under Linux, device is /dev/ttyAMC0, in NetBSD device is /dev/ttyU0 and /dev/dtyU0, FreeBSD is /dev/cuaU0. I have given permission to the device and can perfectly be accesed with the cu program as a normal user: I can send and receive commands from the device.
netbsd-x260$ cu -l /dev/ttyU0
Connected
ChibiOS/RT Shell
ch> help
Commands: help exit info threads version reset freq offset time dac saveconfig clearconfig data dump frequencies port stat gain power sample scan sweep test touchcal touchtest pause resume cal save recall trace marker edelay capture vbat transform threshold
ch> info
Kernel: 4.0.0
Compiler: GCC 8.2.1 20181213 (release) [gcc-8-branch revision 267074]
Architecture: ARMv6-M
Core Variant: Cortex-M0
Port Info: Preemption through NMI
Platform: STM32F072xB Entry Level Medium Density devices
Board: NanoVNA-H
Build time: Oct 18 2019 - 16:10:54
ch> ~
[EOT]
netbsd-x260$
Nanovnaserver uses py-serial python module to communicate with Nanovna but in NetBSD nanovnasaver program is confused with py-serial detection functions output, they do not work the same as in Linux.
LINUX detects theese ports:
ramiro@debian-x260:~$ pyserial-ports -v
/dev/ttyACM0
desc: ChibiOS/RT Virtual COM Port
hwid: USB VID:PID=0483:5740 SER=400 LOCATION=1-1:1.0
/dev/ttyS0
desc: n/a
hwid: n/a
2 ports found
ramiro@debian-x260:~$
On the other hand, in NetBSD and FreeBSD py-serial detect 121 of devices but no useful information on /dev/ttyU0 and /dev/dtyU0
If I run this simple python program that scan the ports using py-serial python module:
netbsd-x260$ cat test.py
import serial
from serial.tools import list_ports
from serial.tools.list_ports_common import ListPortInfo
for d in list_ports.comports(include_links=True):
print('device',d.device)
print('name',d.name)
print('description',d.description)
print('hwid',d.hwid)
print('vid',d.vid)
print('pid',d.pid)
print('serial_number',d.serial_number)
print('location',d.location)
print('manufacturer',d.manufacturer)
print('product',d.product)
print('interface',d.interface)
LINUX output:
device /dev/ttyACM0
name ttyACM0
description ChibiOS/RT Virtual COM Port
hwid USB VID:PID=0483:5740 SER=400 LOCATION=1-1.2:1.0
vid 1155
pid 22336
serial_number 400
location 1-1.2:1.0
manufacturer STMicroelectronics
product ChibiOS/RT Virtual COM Port
interface None
NETBSD outputs 121 devices but I only print below the device of interest. There is no information about the description, hwid, vendor, product and serial number:
I have been told that py-serial in the BSD operating system does not provide USB information like vid,pid etc, so It is not a good way automatically configuring the serial port. For those operating systems it would be a good thing beeing able to configure it manually instead.
I can fool nanovnasaver by entering serial port configuration data literaly in the code this way in Hardware.py file: in this two functions:
def get_interfaces() -> list[Interface]:
interfaces = []
# serial like usb interfaces
for d in list_ports.comports():
if platform.system() == "Windows" and d.vid is None:
d = _fix_v2_hwinfo(d) # noqa: PLW2901
#remigio
d.device="/dev/dtyU0"
d.name="dtyU0"
d.vid=0x0483
d.pid=0x5740
#remigio
if not (typename := usb_typename(d)):
continue
logger.debug(
"Found %s USB:(%04x:%04x) on port %s",
typename,
d.vid,
d.pid,
d.device,
)
iface = Interface("serial", typename)
iface.port = d.device
iface.open()
iface.comment = get_comment(iface)
iface.close()
interfaces.append(iface)
#remigio
break
#remigio
def get_portinfos() -> list[str]:
portinfos = []
# serial like usb interfaces
for d in list_ports.comports():
#remigio
d.device="/dev/dtyU0"
d.name="dtyU0"
d.vid=0x0483
d.pid=0x5740
#remigio
logger.debug("Found USB:(%04x:%04x) on port %s", d.vid, d.pid, d.device)
iface = Interface("serial", "DEBUG")
iface.port = d.device
iface.open()
version = detect_version(iface)
iface.close()
portinfos.append(version)
#remigio
break
#remigio
return portinfos
This way the device "/dev/dtyU0 H" or "/dev/cuaU0 H" are shown in the serial control box in NetBSD and FreeBSD. When pressing to "Connect to the device":
In FreeBSD the device sometimes work and sometimes do not work. When it works, device is detected and I am able to do frequency sweeps. When it does not work the error shown is the same as in NetBSD operating system.
In NetBSD it never works giving this error in the Debug file:
Both FreeBSD (when it fails ) and NetBSD fail on the same command when retrieving frequencies from the VNA:
netbsd-x260$ python3.11 nanovna-saver.py
NanoVNASaver 0.6.9.dev1+gb5da81b.d20250112
Copyright (C) 2019, 2020 Rune B. Broberg
Copyright (C) 2020ff 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.
2025-01-12 11:28:22,963 - NanoVNASaver.Hardware.NanoVNA - WARNING - too many retries reading frequencies
Traceback (most recent call last):
File "/home/ramiro/nanovna-saver/src/NanoVNASaver/Controls/SerialControl.py", line 84, in serialButtonClick
self.connect_device()
File "/home/ramiro/nanovna-saver/src/NanoVNASaver/Controls/SerialControl.py", line 123, in connect_device
frequencies = self.app.vna.read_frequencies()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ramiro/nanovna-saver/src/NanoVNASaver/Hardware/NanoVNA.py", line 128, in read_frequencies
return super().read_frequencies()
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ramiro/nanovna-saver/src/NanoVNASaver/Hardware/VNA.py", line 164, in read_frequencies
return [int(f.real) for f in self.readValues("frequencies")]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ramiro/nanovna-saver/src/NanoVNASaver/Hardware/NanoVNA.py", line 138, in readValues
return super().readValues(value)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ramiro/nanovna-saver/src/NanoVNASaver/Hardware/VNA.py", line 206, in readValues
result = [
^
File "/home/ramiro/nanovna-saver/src/NanoVNASaver/Hardware/VNA.py", line 206, in <listcomp>
result = [
^
File "/home/ramiro/nanovna-saver/src/NanoVNASaver/Hardware/VNA.py", line 115, in exec_command
raise IOError("too many retries")
OSError: too many retries
[1] Abort trap (core dumped) python3.11 nanovna-saver.py
netbsd-x260$
I do not know why it does fail sometimes in FreeBSD and it always fails in NetBSD. Any hints will be appreciated. I have been playing with software timeouts just in case but it did not work.
Thanks.
Ramiro.
Describe Preferred Solution
Apart from py-serial port autodetect, it would be a good thing to manually configure serial ports. Also fix the code to make it work under BSD.
The text was updated successfully, but these errors were encountered:
Feature Request
Hello I am trying to make nanovnasaver v0.6.8 work under NetBSD and FreeBSD operating systems. In both operating systems serial port detection that relies on py-serial python modules does not work. py-serial does not work the same way as in Linux.
Under Linux, device is /dev/ttyAMC0, in NetBSD device is /dev/ttyU0 and /dev/dtyU0, FreeBSD is /dev/cuaU0. I have given permission to the device and can perfectly be accesed with the cu program as a normal user: I can send and receive commands from the device.
Nanovnaserver uses py-serial python module to communicate with Nanovna but in NetBSD nanovnasaver program is confused with py-serial detection functions output, they do not work the same as in Linux.
LINUX detects theese ports:
On the other hand, in NetBSD and FreeBSD py-serial detect 121 of devices but no useful information on /dev/ttyU0 and /dev/dtyU0
NETBSD:
If more detail is requested it does not output more details:
If I run this simple python program that scan the ports using py-serial python module:
LINUX output:
NETBSD outputs 121 devices but I only print below the device of interest. There is no information about the description, hwid, vendor, product and serial number:
I have been told that py-serial in the BSD operating system does not provide USB information like vid,pid etc, so It is not a good way automatically configuring the serial port. For those operating systems it would be a good thing beeing able to configure it manually instead.
I can fool nanovnasaver by entering serial port configuration data literaly in the code this way in Hardware.py file: in this two functions:
This way the device "/dev/dtyU0 H" or "/dev/cuaU0 H" are shown in the serial control box in NetBSD and FreeBSD. When pressing to "Connect to the device":
In FreeBSD the device sometimes work and sometimes do not work. When it works, device is detected and I am able to do frequency sweeps. When it does not work the error shown is the same as in NetBSD operating system.
In NetBSD it never works giving this error in the Debug file:
Both FreeBSD (when it fails ) and NetBSD fail on the same command when retrieving frequencies from the VNA:
I do not know why it does fail sometimes in FreeBSD and it always fails in NetBSD. Any hints will be appreciated. I have been playing with software timeouts just in case but it did not work.
Thanks.
Ramiro.
Describe Preferred Solution
Apart from py-serial port autodetect, it would be a good thing to manually configure serial ports. Also fix the code to make it work under BSD.
The text was updated successfully, but these errors were encountered: