From 699c9309874a2b43b6f7bf4fe374013d83f52179 Mon Sep 17 00:00:00 2001 From: zhangyuan21 Date: Mon, 27 Feb 2023 14:52:21 +0800 Subject: [PATCH] drivers/usb: fixed sim usb dev and host build issue Signed-off-by: zhangyuan21 --- drivers/usbdev/cdcacm.c | 6 +++--- drivers/usbdev/rndis.c | 3 ++- drivers/usbhost/usbhost_cdcacm.c | 23 ++--------------------- drivers/usbhost/usbhost_enumerate.c | 2 +- 4 files changed, 8 insertions(+), 26 deletions(-) diff --git a/drivers/usbdev/cdcacm.c b/drivers/usbdev/cdcacm.c index 290c9c0028..6df211a1ae 100644 --- a/drivers/usbdev/cdcacm.c +++ b/drivers/usbdev/cdcacm.c @@ -471,9 +471,6 @@ static int cdcacm_recvpacket(FAR struct cdcacm_dev_s *priv, DEBUGASSERT(priv != NULL && rdcontainer != NULL); - uinfo("head=%d tail=%d nrdq=%d reqlen=%d\n", - priv->serdev.recv.head, priv->serdev.recv.tail, priv->nrdq, reqlen); - #ifdef CONFIG_CDCACM_IFLOWCONTROL DEBUGASSERT(priv->rxenabled && !priv->iactive); #else @@ -486,6 +483,9 @@ static int cdcacm_recvpacket(FAR struct cdcacm_dev_s *priv, reqbuf = &req->buf[rdcontainer->offset]; reqlen = req->xfrd - rdcontainer->offset; + uinfo("head=%d tail=%d nrdq=%d reqlen=%d\n", + priv->serdev.recv.head, priv->serdev.recv.tail, priv->nrdq, reqlen); + serdev = &priv->serdev; recv = &serdev->recv; diff --git a/drivers/usbdev/rndis.c b/drivers/usbdev/rndis.c index 765275febb..6bf11cf07b 100644 --- a/drivers/usbdev/rndis.c +++ b/drivers/usbdev/rndis.c @@ -34,6 +34,7 @@ #include #include #include +#include #include @@ -1242,7 +1243,7 @@ static inline int rndis_recvpacket(FAR struct rndis_dev_s *priv, if (priv->current_rx_datagram_size > (CONFIG_NET_ETH_PKTSIZE + 4) || priv->current_rx_datagram_size <= (ETH_HDRLEN + 4)) { - uerr("ERROR: Bad packet size dropped (%d)\n", + uerr("ERROR: Bad packet size dropped (%zu)\n", priv->current_rx_datagram_size); NETDEV_RXERRORS(&priv->netdev); priv->current_rx_datagram_size = 0; diff --git a/drivers/usbhost/usbhost_cdcacm.c b/drivers/usbhost/usbhost_cdcacm.c index 6607250f29..4314007583 100644 --- a/drivers/usbhost/usbhost_cdcacm.c +++ b/drivers/usbhost/usbhost_cdcacm.c @@ -26,6 +26,7 @@ #include #include +#include #include #include #include @@ -324,7 +325,6 @@ static int usbhost_cfgdesc(FAR struct usbhost_cdcacm_s *priv, /* (Little Endian) Data helpers */ static inline uint16_t usbhost_getle16(FAR const uint8_t *val); -static inline uint16_t usbhost_getbe16(FAR const uint8_t *val); static inline void usbhost_putle16(FAR uint8_t *dest, uint16_t val); #ifdef HAVE_CTRL_INTERFACE static void usbhost_putle32(FAR uint8_t *dest, uint32_t val); @@ -1626,25 +1626,6 @@ static inline uint16_t usbhost_getle16(FAR const uint8_t *val) return (uint16_t)val[1] << 8 | (uint16_t)val[0]; } -/**************************************************************************** - * Name: usbhost_getbe16 - * - * Description: - * Get a (possibly unaligned) 16-bit big endian value. - * - * Input Parameters: - * val - A pointer to the first byte of the big endian value. - * - * Returned Value: - * A uint16_t representing the whole 16-bit integer value - * - ****************************************************************************/ - -static inline uint16_t usbhost_getbe16(FAR const uint8_t *val) -{ - return (uint16_t)val[0] << 8 | (uint16_t)val[1]; -} - /**************************************************************************** * Name: usbhost_putle16 * @@ -1733,7 +1714,7 @@ static int usbhost_alloc_buffers(FAR struct usbhost_cdcacm_s *priv) sizeof(struct cdc_linecoding_s)); if (ret < 0) { - uerr("ERROR: DRVR_IOALLOC of line coding failed: %d (%d bytes)\n", + uerr("ERROR: DRVR_IOALLOC of line coding failed: %d (%zu bytes)\n", ret, sizeof(struct cdc_linecoding_s)); goto errout; } diff --git a/drivers/usbhost/usbhost_enumerate.c b/drivers/usbhost/usbhost_enumerate.c index 3b485310a0..3ac43ece10 100644 --- a/drivers/usbhost/usbhost_enumerate.c +++ b/drivers/usbhost/usbhost_enumerate.c @@ -460,7 +460,7 @@ int usbhost_enumerate(FAR struct usbhost_hubport_s *hport, if (cfglen > maxlen) { uerr("ERROR: Configuration doesn't fit in buffer, " - "length=%d, maxlen=%d\n", + "length=%d, maxlen=%zu\n", cfglen, maxlen); ret = -E2BIG; goto errout;