Bug 300958 - Amarok won't connect to my iPod Touch
Summary: Amarok won't connect to my iPod Touch
Status: RESOLVED NOT A BUG
Alias: None
Product: amarok
Classification: Applications
Component: Collections/iPod iPhone (show other bugs)
Version: 2.5.90 (2.6 beta)
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: 2.6
Assignee: Amarok Developers
URL:
Keywords: regression, release_blocker
Depends on:
Blocks:
 
Reported: 2012-05-31 18:34 UTC by madcatx
Modified: 2012-06-04 18:24 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Crash on ejecting backtrace (8.65 KB, text/plain)
2012-06-02 20:10 UTC, madcatx
Details
Crash on ejecting console output (5.87 KB, text/x-log)
2012-06-02 20:11 UTC, madcatx
Details
Console output of unreliable iPod detection (313.41 KB, text/x-log)
2012-06-04 13:45 UTC, madcatx
Details
solid-hardware details (329 bytes, text/plain)
2012-06-04 14:04 UTC, madcatx
Details
udevadm info (1.42 KB, text/plain)
2012-06-04 14:04 UTC, madcatx
Details
Console output with no MTP plugin and no gtkPod udev rule (208.47 KB, text/plain)
2012-06-04 14:10 UTC, madcatx
Details

Note You need to log in before you can comment on or make changes to this bug.
Description madcatx 2012-05-31 18:34:37 UTC
After upgrading to Amarok 2.5.90, every time I connect my iPod Touch 1G (jailbroken, FW 3.1.3), I get an error message box which says "Connecting iPhone, iPod or iPod touch failed". Problem is not with the iPod itself, gtkPod, Clementine and Amarok 2.5 work with it just fine.
Amarok creates "/tmp/kde-madcat/amarok/imobiledevice_uuid_7745856d27a424032b54f315ef4125e3712a76d0" directory, but when I manually cd to "/tmp/kde-madcat/amarok/" and run "ls", I get "ls: cannot access imobiledevice_uuid_7745856d27a424032b54f315ef4125e3712a76d0: Input/output error" message in the terminal. "ls -l" in that directory returns "d????????? ? ? ? ?             ? imobiledevice_uuid_7745856d27a424032b54f315ef4125e3712a76d0". Running "ifuse -u IPODS_UUID /some/dir" manually mounts the iPod correctly.
When I close the message box, Amarok displays "Apple iPod" in the left panel with track count showing zero. Amarok 2.5 displayed "MadCatZ iPod" which is the correct name of the device.

Reproducible: Always

Steps to Reproduce:
1. Start Amarok
2. Connect iPod Touch
3. An error message box appears
Actual Results:  
iPod Touch collection fails to load with error message described above

Expected Results:  
iPod Touch collection should be loaded and displayed in Amarok.

Output of "amarok -debug" which seems relevant:

amarok:     Device supported PMP protocols: ("mtp") 
amarok:     Device "/org/kde/solid/udev/sys/devices/pci0000:00/0000:00:1d.7/usb8/8-2" identified iPod-like using vendor and product name 
amarok:   END__: bool IpodCollectionFactory::identifySolidDevice(const QString&) const [Took: 0s] 
amarok:   BEGIN: void IpodCollectionFactory::createCollectionForSolidDevice(const QString&) 
amarok:     device "/org/kde/solid/udev/sys/devices/pci0000:00/0000:00:1d.7/usb8/8-2" has no StorageAccess interface, treating as iPhone/iPad 
amarok:     Above device suports mtp/usb protocol/driver combo, treating as iPhone (kdelibs <= 4.8.2 work-around) 
amarok:     creating iPod collection, mount-point or uuid: "7745856d27a424032b54f315ef4125e3712a76d0" 
amarok:     BEGIN: IpodCollection::IpodCollection(const QString&) 
amarok:       IpodCollection: IphoneMountPoint: "determined mount-point path to /tmp/kde-madcat/amarok/imobiledevice_uuid_7745856d27a424032b54f315ef4125e3712a76d0" 
amarok:       IpodCollection: IphoneMountPoint: "created /tmp/kde-madcat/amarok/imobiledevice_uuid_7745856d27a424032b54f315ef4125e3712a76d0 directory" 
amarok:       IpodCollection: IphoneMountPoint: "calling `ifuse "-u" "7745856d27a424032b54f315ef4125e3712a76d0" "-ofsname=afc://7745856d27a424032b54f315ef4125e3712a76d0" "/tmp/kde-madcat/amarok/imobiledevice_uuid_7745856d27a424032b54f315ef4125e3712a76d0"` with timeout of 10s" 
amarok:       IpodCollection: IphoneMountPoint: "ifuse: There was an error accessing the mount point: Input/output error" 
amarok:       IpodCollection: IphoneMountPoint: "ifuse: " 
amarok:       IpodCollection: IphoneMountPoint: "command exited with non-zero return code 1" 
amarok:       IpodCollection: IphoneMountPoint: "Failed to mount iPhone on /tmp/kde-madcat/amarok/imobiledevice_uuid_7745856d27a424032b54f315ef4125e3712a76d0" 
LIBMTP WARNING: no MTP vendor extension on device 9 on bus 8LIBMTP WARNING: VendorExtensionID: 00000000LIBMTP WARNING: VendorExtensionDesc: Device has no vendor extensionsLIBMTP WARNING: this typically means the device is PTP (i.e. a camera) but not an MTP device at all. Trying to continue anyway.LIBMTP PANIC: could not inspect object property descriptions!
LIBMTP PANIC: could not inspect object property descriptions!
LIBMTP PANIC: could not inspect object property descriptions!
amarok:       [MtpHandler] Correct device found 
amarok:     END__: bool Meta::MtpHandler::iterateRawDevices(int, LIBMTP_raw_device_t*) [Took: 0.26s] 
amarok:     BEGIN: void Meta::MtpHandler::slotDeviceMatchSucceeded(ThreadWeaver::Job*) 
amarok:       BEGIN: void Meta::MtpHandler::getDeviceInfo() 
amarok:         [MtpHandler] Unknown battery level 
amarok:         [MtpHandler] setting default parent :  4294967295 
amarok:         [MtpHandler] Device supports:  "jpg" 
amarok:         [MtpHandler] Device supports:  "png" 
amarok:         [MtpHandler] Device supports:  "tiff" 
amarok:       END__: void Meta::MtpHandler::getDeviceInfo() [Took: 0.007s] 
amarok:       BEGIN: void Collections::MediaDeviceCollection::slotAttemptConnectionDone(bool) 
amarok:         [MediaDeviceCollection] starting full scan 
amarok:         BEGIN: virtual void Collections::MediaDeviceCollection::startFullScanDevice() 
amarok:         END__: virtual void Collections::MediaDeviceCollection::startFullScanDevice() [Took: 0s] 
amarok:       END__: void Collections::MediaDeviceCollection::slotAttemptConnectionDone(bool) [Took: 0s] 
amarok:       BEGIN: bool Meta::MediaDeviceHandler::privateParseTracks() 
amarok:       BEGIN: virtual void Meta::MtpHandler::prepareToParseTracks() 
amarok:       END__: virtual void Meta::MtpHandler::prepareToParseTracks() [Took: 0s] 
amarok:       BEGIN: Playlists::MediaDeviceUserPlaylistProvider::MediaDeviceUserPlaylistProvider(Collections::MediaDeviceCollection*) 
amarok:       END__: Playlists::MediaDeviceUserPlaylistProvider::MediaDeviceUserPlaylistProvider(Collections::MediaDeviceCollection*) [Took: 0s] 
amarok:       BEGIN: virtual Playlists::PlaylistList Playlists::MediaDeviceUserPlaylistProvider::playlists() 
amarok:       END__: virtual Playlists::PlaylistList Playlists::MediaDeviceUserPlaylistProvider::playlists() [Took: 0s] 
amarok:     END__: bool Meta::MediaDeviceHandler::privateParseTracks() [Took: 0s] 
amarok:       END__: void Meta::MtpHandler::slotDeviceMatchSucceeded(ThreadWeaver::Job*) [Took: 0.007s] 
amarok:     BEGIN: void PlaylistsByProviderProxy::slotProviderAdded(Playlists::PlaylistProvider*, int) 
amarok:       BEGIN: virtual Playlists::PlaylistList Playlists::MediaDeviceUserPlaylistProvider::playlists() 
amarok:       END__: virtual Playlists::PlaylistList Playlists::MediaDeviceUserPlaylistProvider::playlists() [Took: 0s] 
amarok:     END__: void PlaylistsByProviderProxy::slotProviderAdded(Playlists::PlaylistProvider*, int) [Took: 0s] 
amarok:     BEGIN: void PlaylistsByProviderProxy::slotProviderAdded(Playlists::PlaylistProvider*, int) 
amarok:     END__: void PlaylistsByProviderProxy::slotProviderAdded(Playlists::PlaylistProvider*, int) [Took: 0s] 
amarok:     [PlaylistDock] Adding provider:  "Media Device playlists" 
amarok:     [PlaylistBrowserModel] 3  playlists for category  1 
amarok:     BEGIN: virtual Playlists::PlaylistList Playlists::MediaDeviceUserPlaylistProvider::playlists() 
amarok:     END__: virtual Playlists::PlaylistList Playlists::MediaDeviceUserPlaylistProvider::playlists() [Took: 0s] 
amarok:     [PlaylistBrowserModel] 3  playlists for category  1 
amarok:     BEGIN: void CollectionManager::slotNewCollection(Collections::Collection*) 
amarok:     END__: void CollectionManager::slotNewCollection(Collections::Collection*) [Took: 0s] 
amarok:     BEGIN: virtual void CollectionTreeItemModel::collectionAdded(Collections::Collection*) 
amarok:       [CollectionTreeItemModel] Added collection id: "/org/kde/solid/udev/sys/devices/pci0000:00/0000:00:1d.7/usb8/8-2" 
amarok:     END__: virtual void CollectionTreeItemModel::collectionAdded(Collections::Collection*) [Took: 0s] 
amarok:     BEGIN: virtual float Meta::MtpHandler::totalCapacity() const 
amarok:     END__: virtual float Meta::MtpHandler::totalCapacity() const [Took: 0s] 
amarok:     BEGIN: void MediaDeviceCache::slotAddSolidDevice(const QString&) 
amarok:       [MediaDeviceCache] Found new Solid device with udi =  "/org/freedesktop/UPower/devices/media_player_8_2" 
amarok:       [MediaDeviceCache] Device name is =  "iPod"  and was made by  "Apple_Inc." 
amarok:       [MediaDeviceCache] udi "/org/freedesktop/UPower/devices/media_player_8_2" is AFC cabable (Apple mobile device) 
amarok:       BEGIN: void MountPointManager::deviceAdded(const QString&) 
amarok:         [MountPointManager] looking for udi  "/org/freedesktop/UPower/devices/media_player_8_2" 
amarok:         [MountPointManager] Did not find device from Solid for udi  "/org/freedesktop/UPower/devices/media_player_8_2" 
amarok:       END__: void MountPointManager::deviceAdded(const QString&) [Took: 0.009s] 
amarok:       BEGIN: void MediaDeviceMonitor::deviceAdded(const QString&) 
amarok:         BEGIN: void MediaDeviceMonitor::checkDevice(const QString&) 
amarok:           BEGIN: virtual bool AudioCdConnectionAssistant::identify(const QString&) 
amarok:           END__: virtual bool AudioCdConnectionAssistant::identify(const QString&) [Took: 0s] 
amarok:           BEGIN: virtual bool MtpConnectionAssistant::identify(const QString&) 
amarok:             Not a PMP 
amarok:           END__: virtual bool MtpConnectionAssistant::identify(const QString&) [Took: 0s] 
amarok:         END__: void MediaDeviceMonitor::checkDevice(const QString&) [Took: 0s] 
amarok:       END__: void MediaDeviceMonitor::deviceAdded(const QString&) [Took: 0s] 
amarok:     END__: void MediaDeviceCache::slotAddSolidDevice(const QString&) [Took: 0.019s] 
amarok:     BEGIN: bool IpodCollectionFactory::identifySolidDevice(const QString&) const 
amarok:       Device "/org/freedesktop/UPower/devices/media_player_8_2" identified iPod-like using vendor and product name 
amarok:     END__: bool IpodCollectionFactory::identifySolidDevice(const QString&) const [Took: 0s] 
amarok:     BEGIN: void IpodCollectionFactory::createCollectionForSolidDevice(const QString&) 
amarok:       device "/org/freedesktop/UPower/devices/media_player_8_2" has no StorageAccess interface, treating as iPhone/iPad 
amarok:       Ignoring above device as it doesn't have PortableMediaPlayer interface 
amarok:     END__: void IpodCollectionFactory::createCollectionForSolidDevice(const QString&) [Took: 0s] 

Amarok was built from source by hand with GCC 4.7.0 with -DCMAKE_BUILD_TYPE=debugfull. The machine runs Arch Linux 64bit with KDE 4.8.3, Qt 4.8.2 and kernel 3.4.0.
Comment 1 Matěj Laitl 2012-06-01 18:25:28 UTC
Hi, from the log I see a couple of problems:
> amarok:     Device supported PMP protocols: ("mtp") 
and
> amarok:     Above device suports mtp/usb protocol/driver combo, treating as iPhone (kdelibs <= 4.8.2 work-around) 

Old versions of kdelibs + udev rules by gphoto2 cause that iPods are misidentified as MTP devices. It seems that Amarok's MTP plugin gets int the way. Could you please try to disable it in Amaork config and retest?

> amarok:       IpodCollection: IphoneMountPoint: "determined mount-point path to /tmp/kde-madcat/amarok/imobiledevice_uuid_7745856d27a424032b54f315ef4125e3712a76d0" 
> amarok:       IpodCollection: IphoneMountPoint: "created /tmp/kde-madcat/amarok/imobiledevice_uuid_7745856d27a424032b54f315ef4125e3712a76d0 directory" 
> amarok:       IpodCollection: IphoneMountPoint: "calling `ifuse "-u" "7745856d27a424032b54f315ef4125e3712a76d0" "-ofsname=afc://7745856d27a424032b54f315ef4125e3712a76d0" "/tmp/kde-madcat/amarok/imobiledevice_uuid_7745856d27a424032b54f315ef4125e3712a76d0"` with timeout of 10s" 
> amarok:       IpodCollection: IphoneMountPoint: "ifuse: There was an error accessing the mount point: Input/output error" 
> amarok:       IpodCollection: IphoneMountPoint: "ifuse: " 
> amarok:       IpodCollection: IphoneMountPoint: "command exited with non-zero return code 1" 

This is really strange. Do you have write acces to /tmp/kde-madcat/amarok/? Can you create imobiledevice_uuid_7745856d27a424032b54f315ef4125e3712a76d0 directory below it? You may want to delete /tmp/kde-madcat/amarok/ and let Amaork to re-create it for you.
Comment 2 madcatx 2012-06-01 21:47:29 UTC
Hi,

I toyed with this a bit more and I got the iPod syncing working... well, sort 
of. I
- did a full system update
- rebuilt Amarok from source again
- deleted /tmp/kde-madcat dir
- commented out iThingies related lines in /usr/lib/udev/rules.d/40-
gphoto.rules (see below)
- rebooted

When I disabled the MTP plugin in Amarok, it didn't pick my iPod up at all, 
complaining that the device doesn't have PortableMediaPlayer interface. When I 
re-enabled the MTP plugin, the iPod was finally detected . However, any 
operation performed on the iPod (counting tracks, uploading music etc.) seems 
to take unusually long now - Amarok needs like 30 secs to probe ~ 700 tracks 
that I have on the iPod. When new tracks are being copied onto the iPod, 
"Syncing" message is displayed on its screen for the duration of copying, 
which also isn't the case of other iPod management software or Amarok 2.5.

All other ways of accessing the iPod - gtkPod, Clementine, afc via 
Dolphin+kio-afc - work normally and I have full access to /tmp/kde-madcat dir. 
The linked archive contains output of "amarok -debug 2> log" with and without 
MTP plugin disabled (I'm sorry for the huge size of  "amarok_withMTP.log" 
file). My current gphoto udev rules file is also included.

https://dl.dropbox.com/u/37342755/amarokDbg.tar.bz2
Comment 3 Matěj Laitl 2012-06-02 17:47:58 UTC
(In reply to comment #2)
> When I disabled the MTP plugin in Amarok, it didn't pick my iPod up at all, 
> complaining that the device doesn't have PortableMediaPlayer interface.

How did you disable the MTP plugin? I suppose not the way I told you, because that would have no effect on whether PortableMediaPlayer interface is attached to iPod or not. I think you disabled it in a way that resulted in libmtp being uninstalled, here's why:

kdelib's solid attaches PortableMediaPlayer interface to every udev device that has non-empty ID_MEDIA_PLAYER property. ID_MEDIA_PLAYER gets set by udev rules of following packages:
1. libmtp that (mistakenly) sets it to 1 even for iPods
2. gphoto2 that tou tweaked and that (mistakenly) sets it to 1 even for iPods
3. media-player-info, the _only_ package that _should_ set it for iPods, it sets it to "ipod", which is the only correct value for ipods

Amarok decides based on supportedProtocols() attribute of the PortableMediaPlayer:
a) kdelibs <= 4.8.2 always return "mtp" for all values of ID_MEDIA_PLAYER
b) kdelibs >= 4.8.3 return "mtp" if ID_MEDIA_PLAYER == 1 and correctly query media-player-info if ID_MEDIA_PLAYER is textual, this results in "ipod" for iPods.

> When I re-enabled the MTP plugin, the iPod was finally detected.

Side-effect of pulling libmtp.

> However, any  operation performed on the iPod (counting tracks, uploading
> music etc.) seems  to take unusually long now - Amarok needs like 30 secs
> to probe ~ 700 tracks  that I have on the iPod.

Please be specific here. I see 2 possible reasons why operations with iPod may feel slow to you:
1. when iPod is connected, Amarok reads cover arts of all albums. (other players probably don't do this) If every of your 700 tracks is from different album, that may be the culprit. I'm interested in improving this, perhaps by reading covers in a background job.
2. when copying tracks to iPod, Amarok calls fsync() after each track to ensure the write buffers have been written back to the device (see bug 139454). This causes that copying in Amarok looks slower, but this is in fact the true speed, other methods give false indication by emplying large write buffer.

> When new tracks are being copied onto the iPod, 
> "Syncing" message is displayed on its screen for the duration of copying, 
> which also isn't the case of other iPod management software or Amarok 2.5.

This is not a bug, this is a feature of the new iPod collection!

> The linked archive contains output of "amarok -debug 2> log" with and
> without MTP plugin disabled (I'm sorry for the huge size of  "amarok_withMTP.log" 
> file). My current gphoto udev rules file is also included.

Plase don't link external storage sites next time, attach files to bugzilla directly.

To summarise:
1. the "iPod not connected" problem is caused by missing media-player-info package
2. the "iPod misidentified as MTP device" problem is caused by a bug in kdelibs <= 4.8.2

You may want to bug your distribution to include kdelibs >= 4.8.3 in its update channels, that also should pull in media-player-info package if kelibs are packaged right.
Comment 4 madcatx 2012-06-02 20:10:51 UTC
Created attachment 71522 [details]
Crash on ejecting backtrace
Comment 5 madcatx 2012-06-02 20:11:41 UTC
Created attachment 71523 [details]
Crash on ejecting console output
Comment 6 madcatx 2012-06-02 20:13:32 UTC
I did some extra testing to make sure I didn't report any bogus info. For the record, I have kdelibs 4.8.3 and media-player-info package is also installed. There is a "/usr/share/media-player-info/" dir and an udev rules file in the correct place.

I disabled the MTP plugin in Settings->Configure Amarok->Plugins by unticking the "MTP Collection". Now I'm certain that both "MTP Collection" and "iPod & co. Collection" have to be enabled in order for my iPod to be detected. I tried to comment out all entries with "idVendor" set to "05ac" in gphoto and libmtp udev rules, but that made no difference.
Is there something else possibly misconfigured in my system?

You are probably right about the album covers causing the speed issues.

On a slightly unrelated note, Amarok crashed 3 times upon ejecting the iPod. In two cases I didn't modify its collection in any way, in the 3rd instance I changed an album name of one track.
Comment 7 Matěj Laitl 2012-06-03 09:11:15 UTC
(In reply to comment #6)
> I disabled the MTP plugin in Settings->Configure Amarok->Plugins by
> unticking the "MTP Collection". Now I'm certain that both "MTP Collection"
> and "iPod & co. Collection" have to be enabled in order for my iPod to be
> detected. I tried to comment out all entries with "idVendor" set to "05ac"
> in gphoto and libmtp udev rules, but that made no difference.
> Is there something else possibly misconfigured in my system?

Hmm, very strange, please post the output of:
1. `udevadm info --export-db | grep -A70 /devices/pci0000:00/0000:00:1d.7/usb8/8-2`
2. `solid-hardware details /org/kde/solid/udev/sys/devices/pci0000:00/0000:00:1d.7/usb8/8-2`
3. `amarok --debug` with MTP plugin disabled not recognizing your iPod.
You may need to replace /devices/pci0000:00/0000:00:1d.7/usb8/8-2 with updated path, see `amarok --debug` output for path to device that is being probed whether it is iPod or not.

I can confirm the crash, it is caused by disconnecting the iPod while it is still reading the tracks, I'll look at it.
Comment 8 Matěj Laitl 2012-06-03 11:01:52 UTC
Git commit 5301ebef4fda42f5ded588516f8644d25caa8383 by Matěj Laitl.
Committed on 03/06/2012 at 12:51.
Pushed by laitl into branch 'master'.

IpodCollection: prevent crash on early disconnect and double-freeing

We were deleting Itdb_Playlist's twice, once in itdb_free and for the
second time in IpodPlaylist::~IpodPlaylist. Ensure we delete it only in
the second call by using trick we already do with tracks.

Also, try to prevent crashes when IpodCollection is destoryed while
IpodPlaylistProvider is still in parseItdbPlaylists() (needs testing)
FIXED-IN: 2.6

M  +7    -6    src/core-impl/collections/ipodcollection/IpodCollection.cpp
M  +3    -1    src/core-impl/collections/ipodcollection/IpodPlaylist.cpp
M  +0    -1    src/core-impl/collections/ipodcollection/IpodPlaylist.h
M  +5    -4    src/core-impl/collections/ipodcollection/IpodPlaylistProvider.cpp
M  +6    -3    src/core-impl/collections/ipodcollection/IpodPlaylistProvider.h
M  +22   -9    src/core-impl/collections/ipodcollection/support/IpodDeviceHelper.cpp
M  +3    -3    src/core-impl/collections/ipodcollection/support/IpodDeviceHelper.h

http://commits.kde.org/amarok/5301ebef4fda42f5ded588516f8644d25caa8383
Comment 9 Myriam Schweingruber 2012-06-03 12:39:33 UTC
(In reply to comment #8)
> Git commit 5301ebef4fda42f5ded588516f8644d25caa8383 by Matěj Laitl.
> Committed on 03/06/2012 at 12:51.
> Pushed by laitl into branch 'master'.
> 
> IpodCollection: prevent crash on early disconnect and double-freeing
> 
> We were deleting Itdb_Playlist's twice, once in itdb_free and for the
> second time in IpodPlaylist::~IpodPlaylist. Ensure we delete it only in
> the second call by using trick we already do with tracks.
> 
> Also, try to prevent crashes when IpodCollection is destoryed while
> IpodPlaylistProvider is still in parseItdbPlaylists() (needs testing)
> FIXED-IN: 2.6

So can this be closed?
Comment 10 Matěj Laitl 2012-06-03 22:04:06 UTC
(In reply to comment #9)
> So can this be closed?

Not really, that crash report was just a side note and didn't really have a bug number. So the proper state of this bug is that I'm wating for madcatx's info now.
Comment 11 madcatx 2012-06-04 13:45:59 UTC
Created attachment 71568 [details]
Console output of unreliable iPod detection
Comment 12 madcatx 2012-06-04 13:46:36 UTC
Amarok's behaviour is rather inconsistent. Sometimes the iPod is detected, sometimes it's not. I attached a "amarok -debug" log with three attempts to connect my iPod for syncing. First two of them failed, the third one was successful. Please note that I didn't do anything apart from unplugging the USB cable and putting it back in after a little while.

I searched through my udev rules a found a rule I added for gtkPod. The relevant part of the file contains this:
ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="05ac", ATTR{idProduct}=="129[0-9]", RUN+="/bin/mkdir -p '/media/i_%E{dir_name}'", RUN+="/usr/bin/ifuse '/media/i_%E{dir_name}' -u '%s{serial}' -o sync,allow_other"
ACTION=="remove", SUBSYSTEM=="usb", ENV{PRODUCT}=="5ac/129[0-9]/*", ENV{INTERFACE}=="255/*", RUN+="/bin/umount -l '/media/i_%E{dir_name}'", RUN+="/bin/rmdir '/media/i_%E{dir_name}'"

When I comment these lines out, the unreliable detection problems seems to disappear. When I re-enable them, the problem is back. My guess is there is some sort of clash between Amarok and that udev rule, both trying to mount the iPod at the same time.

I also had another reproducible crash related to iPod ejection, shall I open a separate bug report for it? The crash I reported before appears to be resolved though, thank you.
Comment 13 madcatx 2012-06-04 14:04:02 UTC
Created attachment 71571 [details]
solid-hardware details
Comment 14 madcatx 2012-06-04 14:04:53 UTC
Created attachment 71572 [details]
udevadm info
Comment 15 madcatx 2012-06-04 14:10:06 UTC
Created attachment 71574 [details]
Console output with no MTP plugin and no gtkPod udev rule
Comment 16 madcatx 2012-06-04 14:11:37 UTC
I just found out that the MTP plugin really must be enabled. Even if I disable the aforementioned udev rule, iPod still isn't detected unless the MTP plugin is enabled. I attached the debug log of that situation.
Comment 17 Matěj Laitl 2012-06-04 14:12:14 UTC
(In reply to comment #12)
> I searched through my udev rules a found a rule I added for gtkPod. The
> relevant part of the file contains this:
> ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="05ac",
> ATTR{idProduct}=="129[0-9]", RUN+="/bin/mkdir -p '/media/i_%E{dir_name}'",
> RUN+="/usr/bin/ifuse '/media/i_%E{dir_name}' -u '%s{serial}' -o
> sync,allow_other"
> ACTION=="remove", SUBSYSTEM=="usb", ENV{PRODUCT}=="5ac/129[0-9]/*",
> ENV{INTERFACE}=="255/*", RUN+="/bin/umount -l '/media/i_%E{dir_name}'",
> RUN+="/bin/rmdir '/media/i_%E{dir_name}'"

You should _not_ mount iPod yourself nor you should add any custom udev rules that do it. (alternatively, you can mount it to the place where Amarok would mount it, but I strongly discourage you from doing so; if you do so, you must ensure you mount it as the same user that runs Amarok, otherwise usbmuxd will be started ) Amarok is coded to work for default configuration. You should have mentioned that you have custom iPod udev rule in the first post, that would save me a lot of time I spent debugging your issue.

> I also had another reproducible crash related to iPod ejection, shall I open
> a separate bug report for it?

Yes please, open a new one. Before submitting backtrace, please install debugging symbols for: qt, glib (libglib), glibc and kdelibs.

> The crash I reported before appears to be resolved though, thank you.

Good.
Comment 18 madcatx 2012-06-04 18:17:11 UTC
 > You should _not_ mount iPod yourself nor you should add any custom udev
> rules that do it. (alternatively, you can mount it to the place where
> Amarok would mount it, but I strongly discourage you from doing so; if you
> do so, you must ensure you mount it as the same user that runs Amarok,
> otherwise usbmuxd will be started ) Amarok is coded to work for default
> configuration. You should have mentioned that you have custom iPod udev
> rule in the first post, that would save me a lot of time I spent debugging
> your issue.

Unfortunately I didn't realize that at that point. This would probably be 
worth mentioning in a wiki because a lot of "iPhone on Linux" HOWTOs suggest 
creating such a rule.

> Yes please, open a new one. Before submitting backtrace, please install
> debugging symbols for: qt, glib (libglib), glibc and kdelibs.

Reported as bug 301166.

This issue can be marked as resolved now, thanks for your assistance.
Comment 19 Matěj Laitl 2012-06-04 18:24:22 UTC
(In reply to comment #18)
>  > You should _not_ mount iPod yourself nor you should add any custom udev
> > rules that do it. (alternatively, you can mount it to the place where
> > Amarok would mount it, but I strongly discourage you from doing so; if you
> > do so, you must ensure you mount it as the same user that runs Amarok,
> > otherwise usbmuxd will be started ) Amarok is coded to work for default
> > configuration. You should have mentioned that you have custom iPod udev
> > rule in the first post, that would save me a lot of time I spent debugging
> > your issue.
> 
> Unfortunately I didn't realize that at that point. This would probably be 
> worth mentioning in a wiki because a lot of "iPhone on Linux" HOWTOs suggest 
> creating such a rule.

Good point, please go and do it yourself. (that's the area where users can help busy developers) Amarok manual from userbase.kde.org gets compiled into handbook released Amarok, so if you add a mention there, it would be great.

> > Yes please, open a new one. Before submitting backtrace, please install
> > debugging symbols for: qt, glib (libglib), glibc and kdelibs.
> 
> Reported as bug 301166.

Thanks. Please select correct component next time.

> This issue can be marked as resolved now, thanks for your assistance.

Glad it helped.