drivers/usbdev/mtp: fix compile break

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
This commit is contained in:
dongjiuzhu1 2023-12-05 21:39:01 +08:00 committed by Xiang Xiao
parent e7fd416f9f
commit 7c4e3aff14
2 changed files with 18 additions and 9 deletions

View File

@ -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;

View File

@ -28,6 +28,20 @@
#include <nuttx/config.h>
#include <nuttx/usb/usbdev.h>
/****************************************************************************
* 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
****************************************************************************/