• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps How to kick event on MTP Responder

ptaro

Lurker
Hi,

Please tell me how to kick event from MTP Responder to MTP Initiator using "RequestObjectTransfer" command? (MTP connection mode)

I would like to push data from MTP Responder(smartphone) to Initiator(WinPC) when I select any music/photo files.

In short, I want to take an event notification on PC(Initiator) when I use smartphone(Responder).
In my study, it may use "RequestObjectTransfer" command (PTP/MTP).

Could you please tell me about kick event from my App??

envirnment:
Smartphone : Android3.1 or over
PC : Windows XP/Vista/7

Thanks,
ptrao.
 
RequestObjectTransfer is an operation, not an event. And I quote section 4.1 of the MTP Spec 1.0:
The Responder may not initiate any actions, and may only send responses to operations sent by the Initiator or send events.

You could try sending an ObjectAdded event, but again I quote the MTP Spec 1.0 , this time section 4.8:
Although events may be sent by either the Initiator or the Responder, they are primarily sent by the Responder as a way of proactively transmitting information or alerts. Unlike operations, events are not acknowledged, and need not be acted upon.

So I don't know if what you want to do will be possible with MTP.


If you want to read the MTP specification for yourself, version 1.0 is available from here.
 
Hi jiminaus,

Let me check again. I alerady read "Media Transfer Protocol Rev1.1".

In this doc, "RequestObjectTransfer" command treats as "EVENT".
Please refer to this doc. (277p)
It also defined as "EVENT" on PTP spec(PIMA15740).

In this spec,
This event can be used by a responder to ask the initiator to initiate a GetObject Operation on the handle specified in the first parameter. This allows for push-mode to be enabled on devices that intrinsically use pull mode.
I still not able to understand how to use "RequestObjectTransfer" command.

How is this command used by Responder??
Can this event be called from an app??

Thanks,
ptaro.
 
You're right, I screwed that up, sorry.

You'd send an object ID up to the Initiator with the event. The Initiator would then send down a GetObject operation with that same object ID.

Object IDs are intrinsically meaningless. They're just numbers that are assigned to things by the device and only have meaning within a session. So basically you'd need to come up a numbering system.

What transport are you using? Are you using an existing MTP codebase on the Android side? What MTP service are you using on the Window side? Do you know if the MTP service on the Windows side will actually act upon a RequestObjectTransfer event?
 
Hi,

What transport are you using? Are you using an existing MTP codebase on the Android side? What MTP service are you using on the Window side? Do you know if the MTP service on the Windows side will actually act upon a RequestObjectTransfer event?

I intend to use an existing MTP codebase on the Android side(pre-installed MTP API). but, I do not know whether my app can call an existing MTP API on the Android side.

ummm...

Can I call an existing MTP API from my app?

I also refer to android.mpt package(API level12)
http://developer.android.com/reference/android/mtp/package-summary.html

OR, possibly, isn't MTP API prepared?

Thanks,
ptaro.
 
As you know there's an android.mtp package, but that's only useful for when the Android device is acting as an initiator. The Android sources include libmtp, but again that's an initiator MTP library.

I know that with introduction of Andriod 3.0, Android devices stopped presenting themselves as USB mass storage devices and instead started presenting themselves as MTP devices. So Android 3.0 is going to have kernel support for MTP being an MTP responder. I don't know (and would doubt) if the Android 2.x kernel has such support.

I don't know if you can use the likes of libusb to do this in userland. I've never used libusb.
 
Hi,

Thank you for your info.

As you know there's an android.mtp package, but that's only useful for when the Android device is acting as an initiator. The Android sources include libmtp, but again that's an initiator MTP library.

I know that with introduction of Andriod 3.0, Android devices stopped presenting themselves as USB mass storage devices and instead started presenting themselves as MTP devices. So Android 3.0 is going to have kernel support for MTP being an MTP responder. I don't know (and would doubt) if the Android 2.x kernel has such support.

I don't know if you can use the likes of libusb to do this in userland. I've never used libusb.

I tried to check about MTP Responder event by using "ICONIA Tab(Acer A500)" and USB packet capture/analyzer.
As I installed of "ES file explorer" on my tab, tried to connect to PC, and deleted my music/photo file.
And then, MTP Responder(ICONIA Tab) issues the "ObjectRemoved(0x4003)" command to PC using interrupt endpoint.
Furthermore, "ObjectAdded(0x4002)" command issues to PC when I tried to capture photo by build-in camera app.

It may be issued event.
Are these command issued from app level? middle level? OS/kernel level?
It seems to me that it is not application level, basically because, MTP Responder API does not expose by Google.

Anyone can explain of these phenomena?

Thanks,
ptaro.
 
Back
Top Bottom