From 7c4e3aff14984df107b8ec5ddeb685bf0234c564 Mon Sep 17 00:00:00 2001 From: dongjiuzhu1 Date: Tue, 5 Dec 2023 21:39:01 +0800 Subject: [PATCH] drivers/usbdev/mtp: fix compile break Signed-off-by: dongjiuzhu1 --- drivers/usbdev/mtp.c | 13 ++++--------- include/nuttx/usb/mtp.h | 14 ++++++++++++++ 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/drivers/usbdev/mtp.c b/drivers/usbdev/mtp.c index a96022902f..2c46719069 100644 --- a/drivers/usbdev/mtp.c +++ b/drivers/usbdev/mtp.c @@ -48,11 +48,6 @@ #define USBMTP_CHARDEV_PATH "/dev/mtp" -#define USBMTP_NUM_EPS (3) -#define USBMTP_EP_BULKIN_IDX (0) -#define USBMTP_EP_BULKOUT_IDX (1) -#define USBMTP_EP_INTIN_IDX (2) - /* USB Controller */ #ifdef CONFIG_USBDEV_SELFPOWERED @@ -303,7 +298,7 @@ static int16_t usbclass_mkcfgdesc(FAR uint8_t *buf, { bool hispeed = false; FAR struct usb_epdesc_s *epdesc; - FAR struct mtp_cfgdesc_s *dest; + FAR struct usb_ifdesc_s *dest; #ifdef CONFIG_USBDEV_DUALSPEED hispeed = (speed == USB_SPEED_HIGH); @@ -316,7 +311,7 @@ static int16_t usbclass_mkcfgdesc(FAR uint8_t *buf, } #endif - dest = (FAR struct mtp_cfgdesc_s *)buf; + dest = (FAR struct usb_ifdesc_s *)buf; epdesc = (FAR struct usb_epdesc_s *)(buf + sizeof(g_mtp_ifdesc)); memcpy(dest, &g_mtp_ifdesc, sizeof(g_mtp_ifdesc)); @@ -331,8 +326,8 @@ static int16_t usbclass_mkcfgdesc(FAR uint8_t *buf, #ifdef CONFIG_USBMTP_COMPOSITE /* For composite device, apply possible offset to the interface numbers */ - dest->ifdesc.ifno = devinfo->ifnobase; - dest->ifdesc.iif = devinfo->strbase + USBMTP_INTERFACESTRID; + dest->ifno = devinfo->ifnobase; + dest->iif = devinfo->strbase + USBMTP_INTERFACESTRID; #endif return sizeof(g_mtp_ifdesc) + 3 * USB_SIZEOF_EPDESC; diff --git a/include/nuttx/usb/mtp.h b/include/nuttx/usb/mtp.h index 0e07a88ee7..da6a8cda7d 100644 --- a/include/nuttx/usb/mtp.h +++ b/include/nuttx/usb/mtp.h @@ -28,6 +28,20 @@ #include #include +/**************************************************************************** + * Preprocessor definitions + ****************************************************************************/ + +/* Indexes for devinfo.epno[] array. + * Used for composite device configuration. + */ + +#define USBMTP_NUM_EPS (3) + +#define USBMTP_EP_BULKIN_IDX (0) +#define USBMTP_EP_BULKOUT_IDX (1) +#define USBMTP_EP_INTIN_IDX (2) + /**************************************************************************** * Public Function Prototypes ****************************************************************************/