Re: pyserial.tools.list_port improvement for FreeBSD

From: Tomek CEDRO <tomek_at_cedro.info>
Date: Tue, 22 Oct 2024 18:02:04 UTC
On Tue, Oct 22, 2024 at 2:36 PM Poul-Henning Kamp <phk@phk.freebsd.dk> wrote:
> --------
> Tomek CEDRO writes:
> > Very cool PHK! But I have some more ideas below :-) :-P
>
> I think "pyserial-ports -v" already gives you the USB info ?

System package:

%  pyserial-ports -v
/dev/cuaU0
    desc: n/a
    hwid: n/a
/dev/cuaU1
    desc: n/a
    hwid: n/a
/dev/cuaU2
    desc: n/a
    hwid: n/a
/dev/cuau0
    desc: n/a
    hwid: n/a
4 ports found

Your repo:

(venv3.9embedded) python3 list_ports.py -v
/dev/cuaU0
    desc: ugen0.7
    hwid: USB VID:PID=0483:374B SER="0667FF504955857567182143" LOCATION=ugen0.7
/dev/cuaU1
    desc: ugen0.8
    hwid: USB VID:PID=303A:1001 SER="60:55:F9:CC:E2:B8" LOCATION=ugen0.8
/dev/cuaU2
    desc: ugen0.9
    hwid: USB VID:PID=10C4:EA60 SER="1a2626680675eb11955981afb7be2ba5"
LOCATION=ugen0.9
/dev/cuau0
    desc: cuau0
    hwid: cuau0
4 ports found

% ~/.local/venv3.9embedded/bin/pyserial-ports -v
/dev/cuaU0
    desc: ugen0.7
    hwid: USB VID:PID=0483:374B SER="0667FF504955857567182143" LOCATION=ugen0.7
/dev/cuaU1
    desc: ugen0.8
    hwid: USB VID:PID=303A:1001 SER="60:55:F9:CC:E2:B8" LOCATION=ugen0.8
/dev/cuaU2
    desc: ugen0.9
    hwid: USB VID:PID=10C4:EA60 SER="1a2626680675eb11955981afb7be2ba5"
LOCATION=ugen0.9
/dev/cuau0
    desc: cuau0
    hwid: cuau0
4 ports found


It is here!! :-)

On the "desc:" in place of ugen I would put "Silicon Labs CP2102N USB
to UART Bridge Controller" as the ugen is in the HWID/LOCATION or
there is a reason to put ugen there? :-)

ugen0.9: <Silicon Labs CP2102N USB to UART Bridge Controller> at
usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (100mA)

  bLength = 0x0012
  bDescriptorType = 0x0001
  bcdUSB = 0x0200
  bDeviceClass = 0x0000  <Probed by interface class>
  bDeviceSubClass = 0x0000
  bDeviceProtocol = 0x0000
  bMaxPacketSize0 = 0x0040
  idVendor = 0x10c4
  idProduct = 0xea60
  bcdDevice = 0x0100
  iManufacturer = 0x0001  <Silicon Labs>
  iProduct = 0x0002  <CP2102N USB to UART Bridge Controller>
  iSerialNumber = 0x0003  <1a2626680675eb11955981afb7be2ba5>
  bNumConfigurations = 0x0001

Thank you!! :-)
Tomek

-- 
CeDeROM, SQ7MHZ, http://www.tomek.cedro.info