Hi Robert,

Thanks for sharing your finding!

I think the current implementation is more fail safe, but of course, it
doesn't fit for all user cases.

Some years ago a company created a thermal printer using NuttX and they
said when the computer was sending too much data to the printer NuttX was
losing data.

Then Greg added support to flow control to USB CDC/ACM driver. You can use
the Watermark to setup the buffer level to the driver indicate to the host
computer it should stop.

There is also an apps example to do stress test of the ttyACM.

BR,

Alan

On Sunday, October 22, 2023, Robert Middleton <osfan6...@gmail.com> wrote:

> Update: After looking through the code a bit, I discovered that the
> CAIOC_GETCTRLLINE ioctl exists.  This seems to do exactly what I want
> it to, in that once the host system opens the ttyACM the DTR and RTS
> lines are raised.  As long as the host system does not turn off the
> DTR line it should be fine.
>
> Sample code(no error checking):
>
> int get_val;
> ioctl(fd, CAIOC_GETCTRLLINE, &get_val);
> printf("get val: 0x%02X.  RTS: %d DTR: %d\n",
>   get_val,
>   (get_val & CDCACM_UART_RTS) > 0,
>   (get_val & CDCACM_UART_DTR) > 0);
>
> -Robert Middleton
>

Reply via email to