Android file transfert: MTP support has always been half broken in KDE

I’m using KDE Plasma (NixOs unstable a4bf4434570), and I always had bad experience when I want to transfert files from my android phone to my device (this is not new, nor specific to NixOs… I think I never got much chance with MTP in KDE).

On maybe half of the phones I try on my computer (including mine, which is a Samsung), I get an error when I try to open it in the Dolphin file manager:

The file or the folder udi=/org/kde/solid/udev/sys/devices/pci0000:00/0000:00:14.0/usb1/1-4 does not exist.

On the other hand, I never got any trouble with the “Android File Transfer (MTP)” app (android-file-transfer). Unfortunately, it is not super easy to use compared to a well integrated Dolphin solution.

Hence my questions:

  1. Am I doing something really wrong that break KDE’s MTP?
  2. Is it something that could easily be solved on NixOs side? I can see this bug report 387454 – MTP doesn't work in KDE with Linux 4.14 that reports in 2018 that changing udev rules into ACTION!="bind", ACTION!="add", GOTO="libmtp_rules_end" can help. Apparently, some operating systems fixed it that way but in NixOs there is no file for libmtp in the udev folder. However, if I manually install libmtp I get a file with nearly the same rule, except that bind and add are exchanged. I also tried on NixOs to add services.udev.packages = [ pkgs.android-udev-rules ]; but it does not solve my issue (note that this issue was reported on nixpkgs but is supposed to be solved since quite some time Connecting an Android MTP device fails · Issue #71509 · NixOS/nixpkgs · GitHub).
  3. Otherwise, if the issue really comes from libmtp, can I ask Dolphin to use a more reliable library?

EDIT
Seems like troubles with MTP has been reported on NixOs, with no solution so far libmtp 1.1.19 upgrade breaks GVFS mounting (MTP, Android Devices, etc) · Issue #145824 · NixOS/nixpkgs · GitHub but I’m not sure if it’s exactly the same issue.

EDIT
Journalctl reports a missing program:

$ journalctl -e | grep mtp
déc. 20 09:37:21 bestos dbus-daemon[6065]: [session uid=1000 pid=6065] Activated service 'org.kde.kmtpd5' failed: Failed to execute program org.kde.kmtpd5: No such file or directory
1 Like

Fixed by fix MTP support on KDE Plasma and Dolphin by olegkapitonov · Pull Request #155405 · NixOS/nixpkgs · GitHub?

After a system upgrade, I can confirm it works now (I got a strange thing once, but now it seems to work reliably)

1 Like