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

Pali Rohár pali at kernel.org
Mon Sep 27 21:55:00 CEST 2021


On Thursday 19 August 2021 13:13:05 Loic Poulain wrote:
> +static void acm_notify_complete(struct usb_ep *ep, struct usb_request *req)
> +{
> +	if (req->status)
> +		printf("CDC ACM notify failed (%d)\n", req->status);
> +
> +	/* nothing to do */
> +}
> +
> +static void acm_tx_complete(struct usb_ep *ep, struct usb_request *req)
> +{
> +	static int once; /* prevent infinite recursion */
> +
> +	if (req->status && !once++)
> +		printf("CDC ACM TX failed (%d)\n", req->status);
> +
> +	struct f_acm *f_acm = req->context;
> +
> +	f_acm->tx_on = true;
> +}
> +
> +static void acm_rx_complete(struct usb_ep *ep, struct usb_request *req)
> +{
> +	struct f_acm *f_acm = req->context;
> +
> +	if (req->status != 0)
> +		printf("CDC ACM RX failed (%d)\n", req->status);

I guess all these prints can cause issues like infinite loop. If stdout
is set to this usb acm gadget then printf will call these functions
again.


More information about the U-Boot mailing list