Re: Persistent USB serial?

From: Milan Obuch <freebsd-hackers_at_dino.sk>
Date: Fri, 08 Oct 2021 07:34:13 UTC
On Fri, 8 Oct 2021 09:25:37 +0200
Daniel Ebdrup Jensen <debdrup@FreeBSD.org> wrote:

> On Fri, Oct 08, 2021 at 08:00:16AM +0200, Milan Obuch wrote:
> >Hi,
> >
> >I'd like to solicit opinions/hints for following scenario, which is
> >quite common currently.
> >
> >There are some development and evaluation boards designed with USB
> >port as power source and serial console at the same time (sometimes
> >even more ports or JTAG as well). When board has power on switch,
> >usually no activity is present on USB wire without board being
> >powered - there is some USB-to-UART circuitry powered from board
> >power source. So serial port device /dev/cuaUn et al. get created
> >only after power on of the board.
> >
> >Problem: port number can be different depending on USB port
> >enumeration or connection order. Another one: it is easy to miss
> >first characters sent from the board if you are not able to write
> >required command like 'cu -l /dev/cuaU9 -s 115200' quickly.
> >
> >Maybe it is possible to write some devd config file snippet which
> >ensures consistent device naming without need of maintaining correct
> >(everytime the same) order of cable connecting, but even that, this
> >does not solve second problem, starting up some terminal or terminal
> >like program in time.
> >
> >Has anybody some experience in this area who can share it? Some hints
> >what to test? Do we have some pseudo serial device, which can be used
> >as device argument for cu command, which can just grab the real USB
> >serial when it appears on connecting the board under test?
> >
> >Regards,
> >Milan
> >
>
> Hi Milan,
>
> There's an open review [1] for location-based unit numbering for USB,
> which some of us have been using for quite some time - and while it's
> not completely done, it's very useful.
> 
> Yours,
> Daniel Ebdrup Jensen
> 
> 1: https://reviews.freebsd.org/D21886

Thanks for pointer, I'll try to evaluate. This does not give me a full
solution, if I understand it right - I can have some unique name for a
given USB serial port instance, but I still must write my command to
attach to this port quickly in order to not miss first characters sent
over this port, right?

Regards,
Milan