---restore content starts---
1, simple description
MTP, the new transmission rules set by Microsoft (literally supposed to be a protocol, but feel more like a rule, set up basically all the lines, the rest is what you want to choose, and the user is completely unlikely to build anything else in its frame). MTP applies not only to USB (a device that transmits data on a USB port), but also to IP. But mostly on USB devices. Many mobile phones are now supported.
2, basic principle of operation
For the MTP documentation, I'll list it in the reference file. For your reference only.
MTP protocol itself, specifies the USB device all information, file read mode, transmission mode, read mode and even the name of the API.
Simply put, everything is defined by a specific value. To understand the meaning of a value, you need to look at the content of the MTP protocol.
The rest is called through the API.
Using Linux a little bit, I basically understand how a computer reads a file.
Basically we want to read the file, we need the following several elements.
>1, device information
>2, the stored files of the device
>3, path to the file
>4, file attributes (size, read-only, etc.)
>5, check your own memory size, go to read
Like the above, we are the active initiator, we want to do, are we started, USB is waiting for our command.
We send a command that responds to what we want. This will reduce the functionality of mobile devices.
(after all, the advantages of mobile devices are small, too much functionality, it is physically difficult to have a small possibility.)
Of course, there are some additions to the device itself in order to share the operation of the main device. )
MTP protocol is also based on the above idea, so that the host (usually refers to the computer) as the initiator, the USB port is the respondent.
The following "(API)" place refers to the presence of the corresponding API
> Connect devices, Initialize (API), log in device (API), read device information (API)
> then starts to connect the device (API) in the program sense, generates a task, and all subsequent data exchanges are generated in the event that the task is valid
> Next, start viewing the device's stored files (API)
> View Path (API)
Properties of the > file (API)
> Read (API)
Almost all of the operations are done through the API, and are read in the same way as the file package.
The reason why you don't write a specific API name is that you have to read it yourself, and here's just a brief introduction to it. But you know a little English, it is estimated not to read the specific introduction can read, use.
Will basically deal with the following nouns.
1,handle. This can be interpreted directly as "pointing". Whether it's devicehandle, or objecthandle, it's pointing to the device, or pointing to the file.
2,object. Files, folders
3,get. API, gets the meaning. Getxxxinfo, is to obtain information, GETXXX is read.
4,format. This needs to look at the document, corresponding to the corresponding meaning.
Introduction to MTP (Media Transfer Protocol (Transfer Protocol))