Bug 325335

Summary: kio-mtp fails with Windows Phone 8X
Product: [Unmaintained] kio Reporter: Karsten König <remur>
Component: mtpAssignee: Philipp Schmidt <kde-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: brice.saugnac, cyberbeat, demonmusic, ervin, fabstz-it, pepko94, perry.alex, residue, richard.llom, warthogdj, zx_master
Priority: NOR    
Version: 4.11.1   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In: Applications 16.04
Sentry Crash Report:
Attachments: Patch to enable MTP for Windows Phone base devices
Patch made by residue@xmail.net updated to work with KF5 kio-extras
Proper patch format
Backport of patch for kio-mtp 0.75+git20140304

Description Karsten König 2013-09-26 15:57:17 UTC
My windows phone 8X can't be browsed with mtp, always says the respective udi does not exist


kio slave debug output:

kio_mtp(27834)/kio MTPSlave::MTPSlave: Slave started
kio_mtp(27834)/kio MTPSlave::MTPSlave: Caches created
kio_mtp(27834)/kio MTPSlave::listDir: "udi=/org/kde/solid/udev/sys/devices/pci0000:00/0000:00:1d.7/usb2/2-1"
kio_mtp(27834)/kio MTPSlave::checkUrl: KUrl("mtp:udi=/org/kde/solid/udev/sys/devices/pci0000:00/0000:00:1d.7/usb2/2-1")
kio_mtp(27834)/kio MTPSlave::checkUrl: udi =  "/org/kde/solid/udev/sys/devices/pci0000:00/0000:00:1d.7/usb2/2-1"
dolphin(26934)/kio (KIOJob) KIO::SlaveInterface::dispatch: error  111   "udi=/org/kde/solid/udev/sys/devices/pci0000:00/0000:00:1d.7/usb2/2-1"
dolphin(26934)/kio (Scheduler) KIO::SchedulerPrivate::jobFinished: KIO::ListJob(0x2470d10) KIO::Slave(0x246fe60)
dolphin(26934)/kio (KDirListerCache) KDirListerCache::slotResult: finished listing KUrl("mtp:udi=/org/kde/solid/udev/sys/devices/pci0000:00/0000:00:1d.7/usb2/2-1")
kio_mtp(27834)/kio MTPSlave::stat: "udi=/org/kde/solid/udev/sys/devices/pci0000:00/0000:00:1d.7/usb2/2-1"
kio_mtp(27834)/kio MTPSlave::checkUrl: KUrl("mtp:udi=/org/kde/solid/udev/sys/devices/pci0000:00/0000:00:1d.7/usb2/2-1")
kio_mtp(27834)/kio MTPSlave::checkUrl: udi =  "/org/kde/solid/udev/sys/devices/pci0000:00/0000:00:1d.7/usb2/2-1"
dolphin(26934)/kio (KIOJob) KIO::SlaveInterface::dispatch: error  111   "udi=/org/kde/solid/udev/sys/devices/pci0000:00/0000:00:1d.7/usb2/2-1"
dolphin(26934)/kio (Scheduler) KIO::SchedulerPrivate::jobFinished: KIO::StatJob(0x212b590) KIO::Slave(0x246fe60)


solid-hardware details with the same udi does work though

karsten@thermoskanne:~> solid-hardware details /org/kde/solid/udev/sys/devices/pci0000:00/0000:00:1d.7/usb2/2-1
udi = '/org/kde/solid/udev/sys/devices/pci0000:00/0000:00:1d.7/usb2/2-1'
  parent = '/org/kde/solid/udev'  (string)
  vendor = 'Microsoft'  (string)
  product = 'Windows Phone 8X by HTC'  (string)
  description = 'Portable Media Player'  (string)
  Block.major = 189  (0xbd)  (int)
  Block.minor = 160  (0xa0)  (int)
  Block.device = '/dev/bus/usb/002/033'  (string)
  Camera.supportedProtocols = {'ptp'}  (string list)
  Camera.supportedDrivers = {'gphoto'}  (string list)
  PortableMediaPlayer.supportedProtocols = {'mtp'}  (string list)
  PortableMediaPlayer.supportedDrivers = {'usb'}  (string list)




Reproducible: Always

Steps to Reproduce:
Connect HTC Windows Phone 8X, try to browse



I guess this is hard to reproduce without the phone at hand, so I'll try to provide further information as you request it.
Comment 1 residue 2013-12-28 20:36:21 UTC
Created attachment 84312 [details]
Patch to enable MTP for Windows Phone base devices

Attached patches enable MTP for Windows Phone based devices and fixes a memory leak.
Tested with Nokia Lumia 820.
Comment 2 demonmusic 2015-01-02 16:50:37 UTC
Was this patch applied to kio-mtp? Still having issues trying to mount Windows Phone 8.1 devices. No problems so far using gvfs.
Comment 3 Richard Llom 2015-01-23 11:44:28 UTC
(In reply to residue from comment #1)
> Created attachment 84312 [details]
> Patch to enable MTP for Windows Phone base devices
> 
> Attached patches enable MTP for Windows Phone based devices and fixes a
> memory leak.
> Tested with Nokia Lumia 820.
> 
Hello residue@xmail.net,
can you upload this patch to reviewboard?
https://git.reviewboard.kde.org/r/

Otherwise there is no chance a developer will review & accept it...
Thanks.
Comment 4 Dominik Haumann 2015-04-01 18:35:03 UTC
Hi Kevin, can you have a look at this patch? Users with these phones pop up more and more, and it seems KDE cannot properly handle it.
Comment 5 Alex Perry 2015-06-30 03:56:49 UTC
Adding my name to the list affected by this. Lumia 1020, running latest kubuntu/kubuntu-ci ppa packages. Same behaviour as described above.
Comment 6 warthogdj 2015-08-27 16:23:13 UTC
I have tested on Kubuntu 15.04 (In reply to residue from comment #1)
> Created attachment 84312 [details]
> Patch to enable MTP for Windows Phone base devices
> 
> Attached patches enable MTP for Windows Phone based devices and fixes a
> memory leak.
> Tested with Nokia Lumia 820.

This works look :
http://pix.toile-libre.org/upload/original/1440692506.png

I'm completely stranger to submitting on source, if someone could please test it and integrate this small path, it could save many new users disappointment.
Comment 7 warthogdj 2015-08-27 16:23:59 UTC
Forgot to mention it tested with lumia 620 WP 8.1 (working)
Comment 8 retired 2015-08-28 16:10:35 UTC
Well, it seems that same issue has been transitioned has been transitioned to kf5 builds. Namely kio-extras.
Comment 9 zx_master 2015-12-11 16:18:30 UTC
Hello. I'm confirm that this bug still exist.
I'm not able to open Nokia 1020 from Dolphin and never was able.

Kubuntu 15.10, Dolphin 15.08.2, KDE Frameworks 5.15.0
Comment 10 retired 2016-01-25 21:29:12 UTC
Created attachment 96842 [details]
Patch made by residue@xmail.net updated to work with KF5 kio-extras

Tested with Lumia 630. It works but probably requires some refinement and may eat someone's kittens. God bless ABS.
Someone with more knowledge should take it from here, I don't have the knowledge.
Comment 11 retired 2016-01-26 18:39:53 UTC
Created attachment 96858 [details]
Proper patch format

WP8+ support for kio-extras
Comment 12 warthogdj 2016-02-20 15:15:42 UTC
I just complied and installed with the lastest patch using 
- https://bugsfiles.kde.org/attachment.cgi?id=96858
- http://www.linuxfromscratch.org/blfs/view/systemd/kde5/kio-extras.html

Still after reboot in dolphin is not found :
mtp:udi=/org/kde/solid/udev/sys/devices/pci0000:00/0000:00:14.0/usb3/3-3/

$ sudo mtpfs 
Mot de passe [sudo] pour kwaadpepper : 
Listing raw device(s)
Device 0 (VID=0421 and PID=06fc) is a Nokia Lumia (RM-975).
   Found 1 device(s):
   Nokia: Lumia (RM-975) (0421:06fc) @ bus 3, dev 8
Attempting to connect device
object 1 has parent 0xffffffff (-1) continuing anyway
object 2 has parent 0xffffffff (-1) continuing anyway
object 3 has parent 0xffffffff (-1) continuing anyway
object 8 has parent 0xffffffff (-1) continuing anyway
object a has parent 0xffffffff (-1) continuing anyway
object d has parent 0xffffffff (-1) continuing anyway
object e has parent 0xffffffff (-1) continuing anyway
object 958 has parent 0xffffffff (-1) continuing anyway
object 95a has parent 0xffffffff (-1) continuing anyway
object 963 has parent 0xffffffff (-1) continuing anyway
object 964 has parent 0xffffffff (-1) continuing anyway
Listing File Information on Device with name: Novae-Phone
fuse: missing mountpoint parameter

The device is unlocked ( Lumia 640 ), using kubuntu 15.04, 4.4.2-040402-generic, kio-extras 4:15.08.2-0ubuntu1 0
Comment 13 Dominik Haumann 2016-03-15 17:56:42 UTC
@Piotr: Is it intention you call checkDevice() twice?

I have created a review request here: https://git.reviewboard.kde.org/r/127386/

Please test this patch and comment there, so we can finally get proper support into the mtp kio slave.

@warthogdj: Are you really sure your newly compiled kio slave was properly picked up? Maybe it was not installed or similarly?
Comment 14 retired 2016-03-16 22:30:54 UTC
@Dominik
That was a typo, sorry. I hope you weren't  scratching your head too much about that one.

Your updated patch works for my L630 and L535 DS.
Comment 15 Dominik Haumann 2016-03-31 11:45:04 UTC
Git commit 50c52ee3795ce00779369fe152b3bc3d330e34f5 by Dominik Haumann.
Committed on 31/03/2016 at 11:39.
Pushed by dhaumann into branch 'Applications/16.04'.

kio-mtp: Better support for mtp devices

This patch removes the call of LIBMTP_Check_Specific_Device(), since
it is generally not adviced to use it at all, see [1]. Instead, it
should only be used in case LIBMTP_Detect_Raw_Devices() fails.
Looking into other mtp implementations (gvfs, smtpfs) revelas, that
LIBMTP_Check_Specific_Device() is not used at all. Therefore,
this patch brings the kio-mtp implementation more in line with
other implmentations.

It was confirmed [2] that with this patch some Windows Phones (e.g.
Lumia 630) get properly detected and work as expected.

  [1] https://sourceforge.net/p/libmtp/mailman/message/34948820/
  [2] https://www.reddit.com/r/kde/comments/4aggg0

REVIEW: 127386

M  +10   -9    mtp/devicecache.cpp

http://commits.kde.org/kio-extras/50c52ee3795ce00779369fe152b3bc3d330e34f5
Comment 16 Dominik Haumann 2016-03-31 11:51:59 UTC
Hi all, we hope the support from Windows Phones (8x, etc.) will be better from the KDE Applications 16.04 release on. However, since our hardware pool is rather limited, there may still be devices that do not properly work.

If your device does not work, it makes sense to proceed as follows:
1. does the device work with other DEs (e.g. gvfs, or simple-mtpfs) ?
2. if not, ask on the libmtp-disucss mailing list about this device: https://sourceforge.net/p/libmtp/mailman/?source=navbar

Thanks for the initially proposed patch, this was used as base for the final patch.
Comment 17 H.H. 2016-04-01 15:06:46 UTC
could this patch be backported?
Comment 18 Dominik Haumann 2016-04-01 16:50:50 UTC
You mean to KDE 4?
Comment 19 H.H. 2016-04-01 18:19:41 UTC
I mean to the current stable kde branch. Will it be in the next minor monthly release?
Comment 20 Dominik Haumann 2016-04-04 13:11:41 UTC
This fix will be in the Applications/16.04 release, that will be released in the next two weeks or so.

The fix is *not* part of the KDE Framworks releases, since the kio-mtp is just a runtime lib that is shipped with application releases, but not a framework itself.

Does that answer the question? :-)
Comment 21 H.H. 2016-04-04 13:39:01 UTC
Yes, thanks!
Comment 22 Fab Stz 2016-06-19 13:28:40 UTC
Created attachment 99605 [details]
Backport of patch for kio-mtp 0.75+git20140304

In case someone is interested, here is a Backport of commit from comment #15 
For kio-mtp 0.75+git20140304 provided in debian jessie