[PATCH v3 2/2] usb: gadget: Add CDC ACM function

Loic Poulain loic.poulain at linaro.org
Fri Nov 26 09:39:18 CET 2021

Hi Pali,

On Thu, 25 Nov 2021 at 19:10, Pali Rohár <pali at kernel.org> wrote:
> On Thursday 25 November 2021 18:16:15 Loic Poulain wrote:
> > Add support for CDC ACM using the new UDC and gadget API. This protocol
> > can be used for serial over USB data transfer and is widely supported
> > by various OS (GNU/Linux, MS-Windows, OSX...). The usual purpose of
> > such link is to access device debug console and can be useful for
> > products not exposing regular UART to the user.
> >
> > A default stdio device named 'usbacm' is created, and can be used
> > to redirect console to USB link over CDC ACM:
> >
> > > setenv stdin usbacm; setenv stdout usbacm
> >
> > Signed-off-by: Loic Poulain <loic.poulain at linaro.org>
> > ---
> >  v2: - remove possible infinite recursipe print loop
> >      - Remove acmconsole command, start function along the stdio device
> >  v3: - Use __constant_cpu_to_le16() when possible
> >      - Rename stdio dev to 'usbacm'
> >      - Rename init function to drv_usbacm_init
> Hello! Just one question: is in this v3 patch fixed stdout-only
> configuration, or it still has a bug which you described in email?
> https://lore.kernel.org/u-boot/CAMZdPi8185pAiO4w2QYMtWGAFJiX=eJ_BJW1CusRE990Wr7b_w@mail.gmail.com/
> Because neither in above change long nor in driver help description nor
> in driver source code is any comment related to stdout-only device.

No, actually it ended not being an issue, we can have it stdout/stdin
independently. The driver loops on 'irq'-handling to ensure the USB
controller has completely flushed TX before returning.

> Note that stdout-only does not have to be too uncommon. For example
> Nokia N900 has enabled UART, keyboard+lcd and usbtty by default and
> sometimes I enabled input only from keyboard and looked at usbtty
> terminal (as stdout-only) if everything is working fine (that every
> pressed key on keyboard was echoed correctly back to usbtty).

Yes, checked this case on a imx7d based board and stdout-only works as
you describe.


More information about the U-Boot mailing list