For some reason mtp-getfile
and mtp-connect --getfile
and also mtp-connect
are very slow. Why? Is this a bug?
time mtp-connect --getfile 3158 IMG_20160826_093251.jpg libmtp version: 1.1.12 Device 0 (VID=12d1 and PID=1082) is a Huawei Ascend P8 . Android device detected, assigning default bug flags Get file 3158 Getting 3158 to IMG_20160826_093251.jpg Unknown options: IMG_20160826_093251.jpg real 0m10.146s user 0m0.244s sys 0m0.356s
When trying with go-mtpfs
it only takes 500ms to mount the mtp device and transfer the file, compared to 10 seconds which mtp-connect
needs. So it doesn't seem to be a hardware limited problem.
fusermount -u mtp && time ( go-mtpfs mtp & sleep 0.1s && cp 'mtp/SD card/DCIM/Camera/IMG_20160826_094255.jpg' . ) 2016/08/28 15:27:27 FUSE mounted real 0m0.503s user 0m0.000s sys 0m0.004s
Anonymous
go-mtpfs might have a different directory read strategy. libmtp tries to get all fileinformations on startup.
does copying a second file in the same instances also have thisdelay?
this seems worthy investigating
What do you mean with same instance? Something like this?:
In that case, yes it is just as fast as copying only one file:
I'm not sure why "Getting 117" suddenly changes to "Get file 11786391".
Btw: When omitting the target, the file is written to a file named
WM_LINK_LANGUAGE=c++
:Lastly, I by chance noticed, that
mtp-filetree
list all the files on the internal drive with almost no latency, then it stops, waits for several (10?) seconds at the lineStorage: Internal storage
and then prints the rest. I think this is caused by the number of files:yes, it means it probably caches in all file information of the whole device on first call (likely per storage medium) .