Bug 313827 - iPhone/iPod Touch/iPad not detected since Amarok 2.7 due to libmtp udev rules
Summary: iPhone/iPod Touch/iPad not detected since Amarok 2.7 due to libmtp udev rules
Status: RESOLVED UPSTREAM
Alias: None
Product: amarok
Classification: Applications
Component: Collections/iPod iPhone (show other bugs)
Version: 2.7.0
Platform: Arch Linux Linux
: NOR normal
Target Milestone: 2.8
Assignee: Amarok Developers
URL: https://sourceforge.net/p/libmtp/bugs...
Keywords:
Depends on:
Blocks:
 
Reported: 2013-01-24 14:03 UTC by madcatx
Modified: 2013-01-24 21:00 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Output from amarok --debug (178.48 KB, text/plain)
2013-01-24 14:04 UTC, madcatx
Details
solid-hardware list details output (21.72 KB, text/plain)
2013-01-24 15:17 UTC, madcatx
Details
udevadm output (1.11 KB, text/plain)
2013-01-24 17:16 UTC, madcatx
Details

Note You need to log in before you can comment on or make changes to this bug.
Description madcatx 2013-01-24 14:03:49 UTC
Ever since updating to Amarok 2.7, my iPod Touch 1G (FW 3.1.3) is not being picked up by Amarok. The device itself appears to be fine, it shows up as a camera in KDE 4 Devices widget and I can still mount and sync it through iFuse and gtkPod. I tried deleting Amarok's config from ~/.kde4 which didn't help. I had no such problems with previous versions of Amarok. I'm running KDE 4.10 RC3 and all related packages are from official Arch Linux repositories.

Reproducible: Always

Steps to Reproduce:
1. Plug in the iPod
2. Launch Amarok
Comment 1 madcatx 2013-01-24 14:04:39 UTC
Created attachment 76685 [details]
Output from amarok --debug
Comment 2 Matěj Laitl 2013-01-24 14:17:52 UTC
Looks like Arch packaging bug, please:
1) attach output of `solid-hardware list details` with the iPod connected
2) tell me whether you have media-player-info package installed
Comment 3 madcatx 2013-01-24 15:17:11 UTC
Created attachment 76687 [details]
solid-hardware list details output
Comment 4 madcatx 2013-01-24 15:18:47 UTC
media-player-info version 17-1 as per Arch Linux versioning is installed.
Comment 5 Matěj Laitl 2013-01-24 16:01:09 UTC
This is the cause:

udi = '/org/kde/solid/udev/sys/devices/pci0000:00/0000:00:1d.7/usb2/2-3'
  parent = '/org/kde/solid/udev'  (string)
  vendor = 'Apple Inc.'  (string)
  product = 'iPod'  (string)
  description = 'Portable Media Player'  (string)
  Block.major = 189  (0xbd)  (int)
  Block.minor = 136  (0x88)  (int)
  Block.device = '/dev/bus/usb/002/009'  (string)
  Camera.supportedProtocols = {'ptp'}  (string list)
  Camera.supportedDrivers = {'gphoto'}  (string list)
  PortableMediaPlayer.supportedProtocols = {'mtp'}  (string list)
  PortableMediaPlayer.supportedDrivers = {'usb', 'usbmux'}  (string list)

iPhone is not a Camera, and does not support mtp protocol at all. PortableMediaPlayer.supportedProtocols should be {'ipod'}. This looks like bug 269451 resurrected, but I'm really puzzled by this.

I think most probable cause is at udev rules level - a clash between /usr/lib/udev/rules.d/40-usb-media-players.rules and /usr/lib/udev/rules.d/40-gphoto.rules -- I also wonder why libgphoto2 adjusted (or it was Arch?) its udev rules precedence - my libgphoto2-2.4.14 (on Gentoo) names them 70-libgphoto2.rules

In any case, please post output of `udevadm info --query=all --path=/sys/devices/pci0000:00/0000:00:1d.7/usb2/2-3` (perhaps adjust to the path from corresponding solid-hardware entry)
Comment 6 madcatx 2013-01-24 17:16:51 UTC
Created attachment 76689 [details]
udevadm output
Comment 7 madcatx 2013-01-24 17:29:00 UTC
I tried to rename the gphoto rules file to 70-gphoto.rules and run "udevadm control --reload-rules", but it didn't change anything. Removing the file altogether resulted in the iPod not being detected as a camera anymore but there was no change in Amarok's behavior.

According to the package manager the update to Amarok 2.7 took place before the update to KDE 4.10 RC3, so if there is a bug in Solid, it has probably been introduced before RC3 because I remember trying the iPod sync right after the update and finding it not functional.
Comment 8 Matěj Laitl 2013-01-24 18:28:16 UTC
(In reply to comment #7)
> I tried to rename the gphoto rules file to 70-gphoto.rules and run "udevadm
> control --reload-rules", but it didn't change anything. Removing the file
> altogether resulted in the iPod not being detected as a camera anymore but
> there was no change in Amarok's behavior.

Despite the name, `udevadm control --reload-rules` often doesn't suffice, please restart the system each time after moving/removing gphoto rules file.

> According to the package manager the update to Amarok 2.7 took place before
> the update to KDE 4.10 RC3, so if there is a bug in Solid..

There is not, from your  udevadm output:
P: /devices/pci0000:00/0000:00:1d.7/usb2/2-2
E: ID_MEDIA_PLAYER=1

ID_MEDIA_PLAYER set by 40-usb-media-players.rules would be "ipod", only thing that sets it to "1" are gphoto rules. So this is a failure on Arch Linux side *again*, this time to sort out udev rules properly. (I've checked, it's distributions that determine the names)

Please report that to Arch and perhaps think about using a distro with more sane packagers. ;)

In possible future posts, please always include *inline* (in post) up-to-date output from `udevadm info --query=all --path=/sys/devices/...` and `solid-hardware details /org/kde/solid/udev/sys/devices/...` (replace ... as appropriate).
Comment 9 madcatx 2013-01-24 19:24:02 UTC
Thanks a lot for your assistance. I went through the udev rules present on my system and I traced the problem down to "69-libmtp.rules" which contains line
' ATTR{idVendor}=="05ac", ATTR{idProduct}=="1291", SYMLINK+="libmtp-%k", ENV{ID_MTP_DEVICE}="1", ENV{ID_MEDIA_PLAYER}="1" '

If I remove the last two parameters, iPod is detected nicely. I have modified the "69-libmtp.rules" and moved gphoto rules to priority 70. Such a configuration works fine now.
Comment 10 Matěj Laitl 2013-01-24 20:28:30 UTC
(In reply to comment #9)
> Thanks a lot for your assistance. I went through the udev rules present on
> my system and I traced the problem down to "69-libmtp.rules" which contains
> line
> ' ATTR{idVendor}=="05ac", ATTR{idProduct}=="1291", SYMLINK+="libmtp-%k",
> ENV{ID_MTP_DEVICE}="1", ENV{ID_MEDIA_PLAYER}="1" '

Ahh, the cause is different than I thought.

> If I remove the last two parameters, iPod is detected nicely. I have
> modified the "69-libmtp.rules" and moved gphoto rules to priority 70. Such a
> configuration works fine now.

Hmm, can you please check whether renaming 40-gphoto.rules is really needed? Perhaps Arch packagers didn't screw it up this time.

Anyways, the actual bug lies in the libmtp library, I've reported it under https://sourceforge.net/p/libmtp/bugs/759/
Comment 11 madcatx 2013-01-24 20:45:05 UTC
The gphoto rules only seem to cause the iPod to be misdetected as a camera, Amarok picks the iPod up fine even when I restore the default name of the rules file. It's the ENV{ID_MEDIA_PLAYER}="1" in 69-libmtp.rules that is the real problem.
Comment 12 Matěj Laitl 2013-01-24 21:00:51 UTC
(In reply to comment #11)
> The gphoto rules only seem to cause the iPod to be misdetected as a camera,
> Amarok picks the iPod up fine even when I restore the default name of the
> rules file. It's the ENV{ID_MEDIA_PLAYER}="1" in 69-libmtp.rules that is the
> real problem.

Right.