Bug 415241 - Trouble opening an MTP device
Summary: Trouble opening an MTP device
Status: RESOLVED FIXED
Alias: None
Product: kio-extras
Classification: Frameworks and Libraries
Component: MTP (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Elvis Angelaccio
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-12-16 11:56 UTC by vytas
Modified: 2022-01-06 13:08 UTC (History)
9 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description vytas 2019-12-16 11:56:16 UTC
SUMMARY
When trying to mount a Samsung A3 2017 phone via an USB3 port, roughly 9/10 times I get error messages:
1) 
Unknown error code 150
Bad parameters
Please send a full bug report at https://bugs.kde.org.
URI string looks like: camera:/Samsung%2520Galaxy%2520models%2520(MTP)@usb:001,006/

2) No storage media found. Make sure your device is unlocked and has MTP enabled in its USB connection settings.

Rare times it mounts successfully, but it takes a lot of tries. MTP is enabled, phone is unlocked and allows sharing. For comparison reasons, tried on Windows 10, which always mounts the phone successfully taking the same steps.



SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Fedora 31
Android version 8 (kernel 3.18.14)
Comment 1 Said Bakr 2020-02-02 19:44:00 UTC
I have another issues with connecting my computer operated by Kubuntu 18.04 to my Android device, Redmi Note7, while the process is not smooth.

The file manager able to access files on the device, but trying to browse files using the open file dialog of any application such as web browsers e.g. Firefox, Vivaldi, etc. is not succeeded.

I posted a question on Ask Ubuntu that describes the issue at the following URL:

https://askubuntu.com/questions/1207350/could-not-able-to-find-android-device-photo-through-applications-open-file
Comment 2 yourjunkhere14 2020-05-03 00:23:51 UTC
I've seen this problem with a Samsung S7.

Possible related: https://bugs.kde.org/show_bug.cgi?id=411489
Comment 3 Guirauton 2020-06-23 08:20:35 UTC
HI,
I have the same problem with the message "Code d'erreur 150 inconnu
Mauvais param�tres
Veuillez envoyer un rapport de bogue détaillé à https://bugs.kde.org."

OS : Mozilla/5.0 (X11; Linux 5.6.14-desktop-2.mga7 x86_64; French) KHTML/5.57.0 (like Gecko) Konqueror/5 KIO/5.57
Portable : SAMSUNG GALAXY Notes 5

Best regards?
Comment 4 vytas 2020-06-28 09:37:51 UTC
Here's a udevadm monitor during the opening. In the example, I plug/unplug the cable 2 times. The results are identical, yet the second one is working. Only thing I did was close Dolphin as per suggestion from elsewhere - sounds stupid, but it didn't work for atleast 50 tries before. What information should be gathered to scope in on this?

udevadm monitor:
KERNEL[157.249285] add      /devices/pci0000:00/0000:00:01.3/0000:03:00.0/usb1/1-4 (usb)
KERNEL[157.268534] add      /devices/pci0000:00/0000:00:01.3/0000:03:00.0/usb1/1-4/1-4:1.0 (usb)
KERNEL[157.268579] bind     /devices/pci0000:00/0000:00:01.3/0000:03:00.0/usb1/1-4 (usb)
UDEV  [157.272331] add      /devices/pci0000:00/0000:00:01.3/0000:03:00.0/usb1/1-4 (usb)
UDEV  [157.273408] add      /devices/pci0000:00/0000:00:01.3/0000:03:00.0/usb1/1-4/1-4:1.0 (usb)
UDEV  [157.274705] bind     /devices/pci0000:00/0000:00:01.3/0000:03:00.0/usb1/1-4 (usb)
KERNEL[163.617649] unbind   /devices/pci0000:00/0000:00:01.3/0000:03:00.0/usb1/1-4/1-4:1.0 (usb)
KERNEL[163.617690] remove   /devices/pci0000:00/0000:00:01.3/0000:03:00.0/usb1/1-4/1-4:1.0 (usb)
KERNEL[163.619585] unbind   /devices/pci0000:00/0000:00:01.3/0000:03:00.0/usb1/1-4 (usb)
KERNEL[163.619617] remove   /devices/pci0000:00/0000:00:01.3/0000:03:00.0/usb1/1-4 (usb)
UDEV  [163.620509] unbind   /devices/pci0000:00/0000:00:01.3/0000:03:00.0/usb1/1-4/1-4:1.0 (usb)
UDEV  [163.621156] remove   /devices/pci0000:00/0000:00:01.3/0000:03:00.0/usb1/1-4/1-4:1.0 (usb)
UDEV  [163.621933] unbind   /devices/pci0000:00/0000:00:01.3/0000:03:00.0/usb1/1-4 (usb)
UDEV  [163.622359] remove   /devices/pci0000:00/0000:00:01.3/0000:03:00.0/usb1/1-4 (usb)
KERNEL[164.641550] add      /devices/pci0000:00/0000:00:01.3/0000:03:00.0/usb1/1-4 (usb)
KERNEL[164.660366] add      /devices/pci0000:00/0000:00:01.3/0000:03:00.0/usb1/1-4/1-4:1.0 (usb)
KERNEL[164.660404] bind     /devices/pci0000:00/0000:00:01.3/0000:03:00.0/usb1/1-4 (usb)
UDEV  [164.663582] add      /devices/pci0000:00/0000:00:01.3/0000:03:00.0/usb1/1-4 (usb)
UDEV  [164.665348] add      /devices/pci0000:00/0000:00:01.3/0000:03:00.0/usb1/1-4/1-4:1.0 (usb)
UDEV  [164.666988] bind     /devices/pci0000:00/0000:00:01.3/0000:03:00.0/usb1/1-4 (usb)

mtp-detech shows the following:
libmtp version: 1.1.16

Listing raw device(s)
Device 0 (VID=04e8 and PID=6860) is a Samsung Galaxy models (MTP).
   Found 1 device(s):
   Samsung: Galaxy models (MTP) (04e8:6860) @ bus 1, dev 10
Attempting to connect device(s)
error returned by libusb_claim_interface() = -6LIBMTP PANIC: Unable to initialize device
Unable to open raw device 0
OK.


When it wasn't working, the folliwng line was "Samsung: Galaxy models (MTP) (04e8:6860) @ bus 1, dev 7" instead of dev 10, even though neither port nor anything else changed.
Comment 5 Enrico Tagliavini 2020-10-01 12:21:03 UTC
This looks like a problem possibly generated in the KIO module.

Running mtp-detect:

$ mtp-detect
libmtp version: 1.1.16

Listing raw device(s)
Device 0 (VID=2a70 and PID=f003) is a OnePlus OnePlus 2 A2005.
   Found 1 device(s):
   OnePlus: OnePlus 2 A2005 (2a70:f003) @ bus 1, dev 17
Attempting to connect device(s)
error returned by libusb_claim_interface() = -6LIBMTP PANIC: Unable to initialize device
Unable to open raw device 0
OK.


Running the android file transfer utrility claims the device is already in use:

# aft-mtp-mount $HOME/mtpfs/
Device::Find failed:Device is already used by another process
Device::Find failed:Device is already used by another process
Device::Find failed:Device is already used by another process
Device::Find failed:Device is already used by another process
Device::Find failed:Device is already used by another process
Device::Find failed:Device is already used by another process
Device::Find failed:Device is already used by another process
Device::Find failed:Device is already used by another process
Device::Find failed:Device is already used by another process
Device::Find failed:Device is already used by another process
connect failed: no MTP device found


stracing mtp-detect shows
ioctl(3, USBDEVFS_CLAIMINTERFACE, 0x7ffd33ff178c) = -1 EBUSY (Device or resource busy)


so it looks like the KDE kio module is locking the USB device and not releasing it at some point early right after the USB cable is connected


killall kiod5, seems to help, after running it the MTP file system is accessible with any libmtp based software (e.g. mtp-detect, gvfs-mtp, jmtpfs and so on) except the KDE one. Trying to access the phone with a KIO based application causes the device to be locked again and kiod5 needs to be killed again to make it accessible.
Comment 6 vytas 2020-10-02 07:44:24 UTC
For anyone else stumbling upon this in an effort to find a workaround atleast, a thing that fixes it every time is, after confirming popup on the phone, close and reopen dolphin.
Comment 7 Enrico Tagliavini 2020-10-02 07:52:12 UTC
(In reply to vytas from comment #6)
> For anyone else stumbling upon this in an effort to find a workaround
> atleast, a thing that fixes it every time is, after confirming popup on the
> phone, close and reopen dolphin.

Doesn't help me, still get the error, even if I kill the dolphin daemon in the background
Comment 8 Christoph Feck 2020-10-02 14:47:19 UTC
Do you have any other application that links to libmtp running? This library unfortunately only allows to be used by one client at a time.
Comment 9 Enrico Tagliavini 2020-10-07 09:22:19 UTC
(In reply to Christoph Feck from comment #8)
> Do you have any other application that links to libmtp running? This library
> unfortunately only allows to be used by one client at a time.

As I said I have to killall kiod5, which seems to be the one keeping the device busy. If I do that, I can then use other libmtp based tools, but not KDE based one. As soon as I try to access the phone with dolphin I get the error again.

Ultimately this is a design limitation in libmtp I think. Not having multiplexing is like the ALSA days before pulse.
Comment 10 Enrico Tagliavini 2020-11-04 08:27:56 UTC
Seems to be working for me now. There were a few updates since my last comment and probably some KDE libraries / frameworks was included too.

For reference I'm running Fedora 32, Plasma 5.18.5
Comment 11 Christoph Feck 2020-12-01 21:46:50 UTC
So can this ticket get closed?
Comment 12 Enrico Tagliavini 2020-12-01 22:36:40 UTC
(In reply to Christoph Feck from comment #11)
> So can this ticket get closed?

It looks like the problem was solved for Fedora 32, so I think it can be close. Possibly wait a few days for the original reporter to give a feedback.

Thank you.
Comment 13 Christoph Feck 2020-12-16 14:12:51 UTC
vytas, can you confirm the fix with recent versions?
Comment 14 Bug Janitor Service 2020-12-31 04:34:16 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 15 Bug Janitor Service 2021-01-15 04:33:47 UTC
This bug has been in NEEDSINFO status with no change for at least
30 days. The bug is now closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

Thank you for helping us make KDE software even better for everyone!
Comment 16 Daniele Scasciafratte 2021-06-23 10:07:44 UTC
I have this bug in Debian Sid with Plasma 5.22.
I saw that I need to kill kiod5 manually and mount the device with jmtpfs manually.
Otherwise dolphin as root or normal user will lag and doesn't work.
When this happens mtp-detect write this:

libmtp version: 1.1.17

Listing raw device(s)
Device 0 (VID=2717 and PID=ff40) is a Xiaomi Mi-2s (id2) (MTP).
   Found 1 device(s):
   Xiaomi: Mi-2s (id2) (MTP) (2717:ff40) @ bus 3, dev 19
Attempting to connect device(s)
error returned by libusb_claim_interface() = -6LIBMTP PANIC: Unable to initialize device
Unable to open raw device 0
OK.
Comment 17 Harald Sitter 2022-01-06 13:08:41 UTC
Dolphin should now correctly show devices, so long as the device can actually be opened, which as mentioned isn't always the case if you use multiple different apps because MTP does not do multiplexing.