can't open/modify files stored on MTP device (phone)

If none of the specific sub-forums seem right for your thread, ask here.
Post Reply
Message
Author
maze
Posts: 2
Joined: 2022-01-01 10:32

can't open/modify files stored on MTP device (phone)

#1 Post by maze »

I have an Android phone that connects to my computer through the MTP protocol. in general it works well. using my file explorer (Thunar), I can browse folders, move, copy and delete stuff. however, opening files doesn't work. I either get an empty file (e.g. when I try to open pictures with GIMP or Nomacs), or get an error (e.g. when I try to open a PDF with Evince: "Unable to open document “file:///tmp/evince-2/document.KKDQF1-documentname.pdf”, libmtp error: Could not create file.").

this is really annoying, because I need to copy each file separately to my local drive if I want to open it, and even copy it back and overwrite it if I want to modify it.

how can I open and edit files on an MTP device?

I'm using Debian 11.1.

MTP-related packages installed:
gmtp/stable,now 1.3.11-3 amd64 [installed]
go-mtpfs/stable,unstable,testing,now 1.0.0-1+b5 amd64 [installed]
libmtp-common/stable,stable,now 1.1.17-3 all [installed]
libmtp-runtime/stable,now 1.1.17-3 amd64 [installed]
libmtp9/stable,now 1.1.17-3 amd64 [installed]
libnet-smtp-ssl-perl/stable,stable,unstable,unstable,testing,testing,now 1.04-1 all [installed,automatic]
mtp-tools/stable,now 1.1.17-3 amd64 [installed]

User avatar
pylkko
Posts: 1802
Joined: 2014-11-06 19:02

Re: can't open/modify files stored on MTP device (phone)

#2 Post by pylkko »

AFAIK Microsoft deliberately designed mtp to work like that. There can be only one connection at a time and you cannot open the files in place.. this is to prevent problems in case of accidental disconnection. So, for example in Windows, when you use the drive, the OS copies the entire content to a temp location in the machine.
see: https://www.2brightsparks.com/resources ... tocol.html

Because MTP is implemented in different phones in different ways, has some strange bugs (such as the files now showing bug since 2012), I tend to think that it is just simple to not use MTP. There is even an app called mtp alternative, becasue MTP is so annoying to use.

Other ways to access files on the phone include using ADB shell, or even simpler, installing a file manager that can create an ftp server. There is a open source app called "Amaze", but there are many many different alternatives. Once you have this, all you need to do is access the files wirelessly with ftp. This can be done over LAN, but also over an ad hoc network (i.e the phone as an access point). All that you need is a computer with WIFI antenna

Post Reply