Bug 1095822

Summary: cant connect mtp device
Product: [openSUSE] openSUSE Distribution Reporter: Axel Braun <axel.braun>
Component: KDE Workspace (Plasma)Assignee: E-Mail List <opensuse-kde-bugs>
Status: RESOLVED DUPLICATE QA Contact: E-mail List <qa-bugs>
Severity: Normal    
Priority: P5 - None CC: axel.braun, mischa.salle, wbauer
Version: Leap 15.0   
Target Milestone: ---   
Hardware: Other   
OS: Other   
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Attachments: journalctl -f
journalctl on current Tumbleweed 20180530
result of mtp-detect on Leap 15

Description Axel Braun 2018-06-04 13:54:05 UTC
Created attachment 772358 [details]
journalctl -f

Attach an Android phone to a fully patched Leap 15.
In the device notifier you get 2 entries, camera and media player.
Chose one entry in media player to open with Dolphin: The access dialog on the phone pops up, grant access.
Now open the device again with dolphin, 2 entries are shown below the mtp device: 
phone and card
Trying to open DCIM device under 'Card' results in error message (device could not be opened)

Expected behaviour: 'Card' device can be accessed (not only storage_* device)

Trying the opther dolphin entry in the device notifier under 'Media Player': the entries are storage_0001 and storage_0002 -> DCIM (or other) entry *can* be accessed in that case.
Copying into the folder (although dolphin shows RW access for 'other') is not possible. Error message: Could not read. Reason: Konnte das USB-Gerät nicht beanspruchen

Expected behaviour: Writing to card storage is possible

please find journalctl -f output attached.
Comment 1 Mischa Salle 2018-06-07 07:38:34 UTC
Just to verify, have you given the right access from your Android?
On my Android 7.1, if typically specify "Transfer files" on my Android, and then get several options from my KDE Device Notifier, incl. 2 "Open with File Manager". They both can successfully open my device (but as a different type).
I did notice that I had problems when amarok was running (I think this is new for Leap15, I never noticed this under 42.{2,3}), as amarok also tried to claim the device.
Eventually I found out with lsof, looking for PIDs using /usr/lib64/libmtp.so.9.4.0
I also found that debugging using mtp-detect (or other mtp-* from mtp-tools) or simple-mtpfs is easier.
Comment 2 Axel Braun 2018-06-07 11:05:48 UTC
Created attachment 772943 [details]
journalctl on current Tumbleweed 20180530

under current Tumbleweed, using libmtp-1.1.15 it is broken as well. I attach a journalctl output as well.
If you let me know what debugging output from mtp-tools you are looking at I'm happy to provide
Comment 3 Mischa Salle 2018-06-07 11:43:33 UTC
(In reply to Axel Braun from comment #2)
> Created attachment 772943 [details]
> journalctl on current Tumbleweed 20180530
> 
> under current Tumbleweed, using libmtp-1.1.15 it is broken as well. I attach
> a journalctl output as well.
> If you let me know what debugging output from mtp-tools you are looking at
> I'm happy to provide

actually very straight forward just the error returned (if any) by e.g. mtp-detect and / or simple-mtpfs.

For mtp-detect, in my case (with amarok already opening the mtp), the error is
 "error returned by libusb_claim_interface() = -6LIBMTP PANIC: Unable to initialize device"
Googling the combination of libusb_claim_interface() and -6 lead me to https://stackoverflow.com/questions/6365314/libusb-interface-already-claimed
and then it was easy.

simple-mtpfs only gives the more cryptic
"LIBMTP PANIC: Trying to dump the error stack of a NULL device!"
which is too generic.

I had tried patching libmtp with the different suggested patches from the stackoverflow page above and those in https://github.com/phatina/simple-mtpfs/issues/37 but none worked. Now it's simply making sure amarok doesn't run (which is mildly annoying but acceptable).

I don't know whether your issue is at all related, it seems more like the actual android doesn't let you access the device.
Comment 4 Axel Braun 2018-06-08 07:17:15 UTC
Created attachment 773126 [details]
result of mtp-detect on Leap 15

Here is the result of mtp-detect.
On the device, access permission was given. Trying to open the device with dolphin ended finally in a timeout of the mtp device and an 'unkonwn error code 150' in dolphin (wow....).
Afterwards, mtp-detect gives:

axel@southpole:~> mtp-detect
libmtp version: 1.1.15

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 6
Attempting to connect device(s)
LIBMTP PANIC: Could not open session! (Return code 8194)
  Try to reset the device.
Unable to open raw device 0
OK.
Comment 5 Mischa Salle 2018-06-08 11:45:12 UTC
(In reply to Axel Braun from comment #4)
> Created attachment 773126 [details]
> result of mtp-detect on Leap 15
It looks basically like your device is not fully understood )-: But that's odd when it did under 42.3 (with libmtp 1.1.13 instead of 1.1.15).
The 8194 (0x2002) is a PTP_RC_GeneralError, which can be all kinds of things.
I presume that neither simple-mtpfs nor mtp-folders work (before you start dolphin) ?

I don't think I can help you any further...

Mischa

> Here is the result of mtp-detect.
> On the device, access permission was given. Trying to open the device with
> dolphin ended finally in a timeout of the mtp device and an 'unkonwn error
> code 150' in dolphin (wow....).
> Afterwards, mtp-detect gives:
> 
> axel@southpole:~> mtp-detect
> libmtp version: 1.1.15
> 
> 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 6
> Attempting to connect device(s)
> LIBMTP PANIC: Could not open session! (Return code 8194)
>   Try to reset the device.
> Unable to open raw device 0
> OK.
Comment 6 Axel Braun 2018-06-09 07:50:03 UTC
(In reply to Mischa Salle from comment #5)

> I don't think I can help you any further...
 
Thank you Mischa.
I have reported this upstream in between: https://bugs.kde.org/show_bug.cgi?id=395130
Comment 7 Wolfgang Bauer 2018-10-10 19:38:07 UTC
Could this be related to bug#1110868 ?
Comment 8 Wolfgang Bauer 2019-02-26 12:14:43 UTC
(In reply to Wolfgang Bauer from comment #7)
> Could this be related to bug#1110868 ?

An libmtp update has been released meanwhile that should fix bug#1110868, so is there still a problem?
Comment 9 Axel Braun 2019-03-01 16:47:55 UTC
Just checked it with the Z2, works perfectly!
Thanks!
Comment 10 Axel Braun 2019-03-01 16:48:49 UTC
PS - I had tested on actual TW!
Comment 11 Wolfgang Bauer 2019-03-01 17:07:21 UTC
(In reply to Axel Braun from comment #10)
> PS - I had tested on actual TW!

Tumbleweed got the libmtp update as well of course. ;-)

Thanks for the confirmation, let's mark it as duplicate then.

*** This bug has been marked as a duplicate of bug 1110868 ***