Please excuse my inexperience, but I'm afraid I've run into some issues when attempting to use the file descriptor. On Tue, Sep 28, 2010 at 3:59 AM, Roger Quadros <roger.quadros@xxxxxxxxx> wrote: > Hi, > > On 09/27/2010 11:06 PM, ext Brett Werling wrote: >>> >> >> Can you describe to me how I begin to build around g_mtp in order to >> get an MTP responder up and running? It looks like I will just need >> to read and write from specified file descriptors, however I'm unable >> to determine if it is indeed that trivial. So far I have included to >> the g_mtp patches into my working tree, and now I am unsure of how to >> proceed. Can anyone give me guidance? >> > > For a reference example see > http://meego.gitorious.org/meego-middleware/buteo-mtp/trees/master/mts/transport/usb > > To summarize, > > There is only one file descriptor for the MTP interface. > > You have to use read/write/poll on the file. The first order of business as I see it is to respond to "GetDeviceInfo", correct? I assume that means I should be able to open the fd and either read the appropriate GetDeviceInfo operation code or just write the DeviceInfo dataset to the fd. I am able to successfully open "/dev/gc0", however all attempts to read, write, or poll simply hang. I have scaled back my implementation to simply get a successful read or write to the fd, but I'm wondering if I have missed a few steps. > > supported IOCTLS are listed in include/linux/usb/ptp.h The IOTCLS listed in the "ptp.h" file of buteo-mtp do not correspond completely with those in the original g_mtp patches that I found. Is it possible I am missing some key IOCTLS? > > You will get notification of events (e.g. RESET, CANCEL) via POLLPRI. Then > use the appropriate ioctl to read the event. > > To signal end of data/response block (i.e. ZLP/SLP) you need to use fsync(). > > This is pretty much all you'll need to implement the responder. > > -- > regards, > -roger > If you have any suggestions for me or resources to point me to, I would greatly appreciate it. I do not wish to waste anyone's time, however understanding how I am supposed to successfully interact with the fd really seems key to me in order to implement this responder without QT dependency. Thanks, Brett -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html