usbx icon indicating copy to clipboard operation
usbx copied to clipboard

Is there a USBX HOST PIMA reference code ?

Open 111llll111 opened this issue 1 year ago • 6 comments

Hi ,

I need to use STM32H573 as a USB host to read and write Android phone files.

I registered the pima class, connected to the mobile phone to set the MTP function, enumeration failed, but the PTP function can be successfully enumerated.

I have not used PIMA function. What function code should I use to read and write files on my phone?

Do you have the usbx host pima reference code?

Thanks!

111llll111 avatar Jan 10 '24 08:01 111llll111

Define UX_PIMA_WITH_MTP_SUPPORT and compile again to enable MTP support. PIMA manages files as objects, you can use object functions to access your files. Usually you should open a session, get object information, open it, read/write it then close it.

xiaocq2001 avatar Jan 11 '24 05:01 xiaocq2001

Hi 20240111142234

MTP mode still fails enumeration, PTP enumerates successfully.

I opened the macro definition UX_PIMA_WITH_MTP_SUPPORT ,But this macro definition only seems to work on the USB DEVICE side?

111llll111 avatar Jan 11 '24 06:01 111llll111

Hi CQ,

I would like to confirm whether these are the only file formats supported by MTP?

/* Define PIMA Object Format Codes.  */

#define UX_HOST_CLASS_PIMA_OFC_UNDEFINED                        0x3000
#define UX_HOST_CLASS_PIMA_OFC_ASSOCIATION                      0x3001
#define UX_HOST_CLASS_PIMA_OFC_SCRIPT                           0x3002
#define UX_HOST_CLASS_PIMA_OFC_EXECUTABLE                       0x3003
#define UX_HOST_CLASS_PIMA_OFC_TEXT                             0x3004
#define UX_HOST_CLASS_PIMA_OFC_HTML                             0x3005
#define UX_HOST_CLASS_PIMA_OFC_DPOF                             0x3006
#define UX_HOST_CLASS_PIMA_OFC_AIFF                             0x3007
#define UX_HOST_CLASS_PIMA_OFC_WAV                              0x3008
#define UX_HOST_CLASS_PIMA_OFC_MP3                              0x3009
#define UX_HOST_CLASS_PIMA_OFC_AVI                              0x300A
#define UX_HOST_CLASS_PIMA_OFC_MPEG                             0x300B
#define UX_HOST_CLASS_PIMA_OFC_ASF                              0x300C
#define UX_HOST_CLASS_PIMA_OFC_QT                               0x300D
#define UX_HOST_CLASS_PIMA_OFC_EXIF_JPEG                        0x3801
#define UX_HOST_CLASS_PIMA_OFC_TIFF_EP                          0x3802
#define UX_HOST_CLASS_PIMA_OFC_FLASHPIX                         0x3803
#define UX_HOST_CLASS_PIMA_OFC_BMP                              0x3804
#define UX_HOST_CLASS_PIMA_OFC_CIFF                             0x3805
#define UX_HOST_CLASS_PIMA_OFC_GIF                              0x3807
#define UX_HOST_CLASS_PIMA_OFC_JFIF                             0x3808
#define UX_HOST_CLASS_PIMA_OFC_PCD                              0x3809
#define UX_HOST_CLASS_PIMA_OFC_PICT                             0x380A
#define UX_HOST_CLASS_PIMA_OFC_PNG                              0x380B
#define UX_HOST_CLASS_PIMA_OFC_TIFF                             0x380D
#define UX_HOST_CLASS_PIMA_OFC_TIFF_IT                          0x380E
#define UX_HOST_CLASS_PIMA_OFC_JP2                              0x380F
#define UX_HOST_CLASS_PIMA_OFC_JPX                              0x3810

If I want to transfer zip files or bin files, is it not supported?

Thanks!

111llll111 avatar Jan 11 '24 06:01 111llll111

The upper code is actually defined by PIMA 15740:2000. I'm not sure if how your device reports zip or bin files, if they can be referenced in undefined code or some other codes you can use them.

xiaocq2001 avatar Jan 11 '24 09:01 xiaocq2001

Hi CQ,

Can you help us see why the MTP enumeration fails, but the PTP enumeration succeeds?

111llll111 avatar Jan 11 '24 09:01 111llll111

Do you have traces for the enumerations to analyze?

xiaocq2001 avatar Jan 16 '24 03:01 xiaocq2001