Re: Persistent USB serial?

From: Mehmet Erol Sanliturk <m.e.sanliturk_at_gmail.com>
Date: Fri, 08 Oct 2021 07:58:40 UTC
On Fri, Oct 8, 2021 at 9:01 AM Milan Obuch <freebsd-hackers@dino.sk> 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
>
>


I am not using the following idea , but my opinion on that case is as
follows :


Assume that there is a list of ports to be defined such as USB , PCI ,
RS-232 , etc .

If the board is a new one
(
Boot the computer and obtain the above list .
Make it a configuration file  with  ASSIGNED suitable port numbers by the
user .
)
otherwise use a previously prepared configuration .


When the computer starts to boot , it looks at the above file . If it is
present , ( without fancy mount operations by the user )
loads it and uses port numbersspecified in the given list . If it is not
present , the computer uses its own defaults .

In case of specified port numbers ( or names , labeling is not important )
, it uses giving numbers , causing
repeatable boot sequences and the related scripts , etc. can continue as
specified without being broken .

Perhaps , such an application requires some changes in the boot processing
sources which these are beyond
my knowledge .


Mehmet Erol Sanliturk