cancel
Showing results for 
Search instead for 
Did you mean: 

USB Host MTP/PTP to digital camera

PCu1
Senior

Hello, 

I'm testing the STM3240G-eval with the USB host MTP. The goal is to retrieve the photo from a canon EOS 100.

The camera uses PTP protocol.

As the demonstration  code read .wav file, I wrote a wav file to the root of the SD card.

 

The digital camera is recognised but when the code arrives on  USBH_MTP_GetObjectHandles(&hUSBHost, 0, PTP_OFC_WAV, 0xFFFFFFFF, &WavHandles), no file is returned.

 

Perhaps I should replace the USH_MTP_xx function by USBH_PTP_xx ?

Any idea?

 

Pierre

7 REPLIES 7
Mohamed_AYED
Associate III

Hi @PCu1 ,

You need to check your device (Canon EOS 100) which class support MTP or PTP. 

do you have an usb trace of enumeration phase.

 

Hi @Mohamed_AYED ,

Following the documentation, the Canon supports PTP. (class 0x06)

It is confirmed with the STM32 MTP example demo because it passes the comparison level. And also I captured some informations with USBtreeview when the camera is connected with the PC that confirm class 0x06.

 

I have an Logic Salae analyser but it will be RAW data packet. I don't know if it can help. Do you have a tool suggestion?

Pierre

Pavel A.
Evangelist III

Maybe a picture camera just does not understand what are .wav files and skips them in enumeration?

Yes may be...

But I already changed this line with the JPEG filter and I added a jpeg image on the root of the SD card (if the STM32 can't read in /DCIM/... subdirectory):

USBH_MTP_GetObjectHandles(&hUSBHost, 0, PTP_OFC_EXIF_JPEG, 0xFFFFFFFF, &WavHandles)

 

No positive results...

 

Pavel A.
Evangelist III

Can you see the file that you've added in the interface of the camera itself?

Unfortunately it seems that you can only preview images/videos but not the file list on the camera itself...

If I change the "object format code" by PTP_OFC_Association I can get the directories list on the SD card.

At least the Canon answers/understands some requests...

Capture d'écran 2024-03-06 092447.png

I tried with Object format code between 0x3000 and 0x3810 without success.

May be the Canon restricts the access on root and allows on DCIM directory.

Is it possible in USB-PTP to navigate in subdirectories?