how to write file into my android phone?

Grant Edwards invalid at invalid.invalid
Mon Aug 11 18:58:52 EDT 2014


On 2014-08-10, Marko Rauhamaa <marko at pacujo.net> wrote:
> Christian Gollwitzer <auriocus at gmx.de>:
>
>> Am 10.08.14 11:39, schrieb Steven D'Aprano:
>>> Android phones don't mount as storage devices?
>>> Oh well, that's Android crossed off my list.
>>
>> Not any longer. They used to, but the support for mass storage was
>> dropped in favour of MTP
>
> I don't see anything inherently wrong with an open protocol like MTP.
>
>> to allow concurrent access from both the computer and the phone.
>
> I don't know MTP at all, but
>
>    MTP allows no parallelism; unlike USB mass storage, MTP has been
>    built to only allow a single operation at a time (for example, read,
>    write or delete operation), while no other operation can be executed
>    until the previous operation is complete.
>    <URL: http://en.wikipedia.org/wiki/Media_Transfer_Protocol#Drawbacks>

That's the within MTP protocol itself, and that's not the "prallel
access" problem which MTP was intended to address.

What MTP allows is parallel access between the MTP protocol server in
the phone and the rest of the phone (OS and apps).  In order to mount
a partition as a USB mass storage device, it has to first be unmounted
by the Android system.  That's OK for an SD card that doesn't contain
anything important required by the Android system, but it means that
you can't mount the "system" partition without shutting down the phone
completely.

For phones that don't have an SD card, there is nothing _but_ the
system partition, and to mount it as a USB storage device you would
have to completely shut down the phone.  People don't like that.  They
want to keep the phone on while their doing <whatever> with their MP3
files and JPEG files and whatnot.

The only practical way to do that is to define a file transfer
protocol that doesn't require the entire parition be unmounted by the
phone.  Hence MTP.  It's something Microsoft came up with, so it of
course has their usual level of "broken-as-designed" about it, but in
general it works fairly well.  For Linux systems there's a user-space
MTP filesystem implementation that has always worked fine for me.

So in practice, it works just like as somewhat slow USB mass storage
device.

-- 
Grant Edwards               grant.b.edwards        Yow! Now I understand the
                                  at               meaning of "THE MOD SQUAD"!
                              gmail.com            



More information about the Python-list mailing list