This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Need help with MTP device

Tags: None
(comma "," separated)
cyrus007
Registered Member
Posts
42
Karma
0

Need help with MTP device

Fri Jan 26, 2007 8:56 am
I have an MTP device which is failing when trying to transfer the file from my collections to the device. The different software versions are: libmtp-0.1.3 and amarok-1.4-SVN

Here are some details about what is happening. I have connected the device using 'MTP Media Device' option and the mediadevice browser shows the playlists from the device. After that I selected a file from my collections and told it to 'Transfer to Media Device' at which point it queues it up in media devices Transfer Queue . Next when I try to 'Start Transfer' it gives an error message saying 'Failed to copy track ...' Here is the debugging ouput:

amarok: BEGIN: virtual bool MtpMediaDevice::openDevice(bool)
PTP: Opening session
amarok:  [MtpMediaDevice] setting default parent : 0
amarok: END__: virtual bool MtpMediaDevice::openDevice(bool) - Took 3s
amarok: [MtpMediaDevice] Parent folder could not be found. Going to use top level.
amarok: BEGIN: virtual MediaItem* MtpMediaDevice::copyTrackToDevice(const MetaBundle&)
amarok:  [MtpMediaDevice] filetype : 1
amarok:  [MtpMediaDevice] Parent folder could not be found. Going to use top level.
amarok:  [MtpMediaDevice] Creating new folder 'S. D. Burman - Guide' as a child of 0
amarok:  [MtpMediaDevice] New folder ID: 7682168
amarok:  [MtpMediaDevice] Folder path : S. D. Burman - Guide/
amarok:  [MtpMediaDevice] Parent id : 7682168
amarok:  [MtpMediaDevice] Sending track... /media/music/mp3/Hindi/Guide/Aaj Phir Jeene Ki.mp3
PTP: Invalid Object Handle
LIBMTP_Send_Track_From_File_Descriptor: Could not send object info.
Return code: 0x2009 (look this up in ptp.h for an explanation).                            --------> #define PTP_RC_InvalidObjectHandle      0x2009
amarok:  [MtpMediaDevice] Could not write file -1
amarok: END__: virtual MediaItem* MtpMediaDevice::copyTrackToDevice(const MetaBundle&) - Took 0.68s
amarok: BEGIN: void MtpMediaDevice::updateAlbumArt(QPtrList*)
amarok: END__: void MtpMediaDevice::updateAlbumArt(QPtrList*) - Took 0.0013s
<...>
amarok: BEGIN: bool MediaDevice::disconnectDevice(bool)
amarok:  [MediaBrowser] disconnecting: hook=true
amarok:  [MediaBrowser] disconnecting: ok
amarok: BEGIN: virtual bool MtpMediaDevice::closeDevice()
amarok:    [MtpMediaDevice] Folders destroyed
PTP: Closing session
amarok:    [MtpMediaDevice] Device released

and the capabilities of the device are:
Supported operations:
  1001: get device info
  1002: Open session
  1003: Close session
  1004: Get storage IDs
  1005: Get storage info
  1006: Get number of objects
  1007: Get object handles
  1008: Get object info
  1009: Get object
  100b: Delete object
  100c: Send object info                              --------------------> it is failing in doing this
  100d: Send object
  1010: Reset device
  1014: Get device property description
  1015: Get device property value
  1016: Set device property value
  9801: Get object properties supported
  9802: Get object property description
  9803: Get object property value
  9804: Set object property value
  9810: Get object references
  9811: Set object references
  9201: Report Added/Deleted Items
  9202: Report Acquired Items
  9203: Get type of playlists that are allowed to be transfered
  9101: Get secure time challenge
  9102: Get secure time response
  9103: Set license response
  9104: Get sync list
  9105: Send meter challenge query
  9106: Get meter challenge
  9107: Get meter response
  9108: Clean data store
  9109: Get license state
  910a: Send WMDRM-PD Command
  910b: Send WMDRM-PD Request
Playable File (Object) Types and Object Properties Supported:
  3009: MP3
      dc01: StorageID
      dc02: ObjectFormat
      dc03: ProtectionStatus
      dc04: ObjectSize
      dc07: ObjectFileName
      dc4e: DateAdded
      dc08: DateCreated
      dc09: DateModified
      dc0b: ParentObject
      dc41: PersistantUniqueObjectIdentifier
      dc44: Name
      dc4f: NonConsumable
      dc46: Artist
      dc89: Duration
      dc8b: Track
      dc8c: Genre
      dc96: Composer
      dc99: OriginalReleaseDate
      dc9a: AlbumName
      dc9d: DRMStatus
      dc48: Description
      de9a: AudioBitRate
      de93: SampleRate
      de94: NumberOfChannels
      de99: AudioWAVECodec

Any hints in how to tackle the problem ? I went as deep as looking up ptp_sendobjectinfo and ptp_transaction but don't see any problem with the code in the library. So does it mean the hardware is broken ? The device works fine in MS environment.
cyrus007
Registered Member
Posts
42
Karma
0

Re: Need help with MTP device

Fri Jan 26, 2007 10:03 am
OK, did some more digging. Looks like there is some authorization related issue. Here is some info from mtp-detect:

Special directories:
  Default music folder: 0x00000000
  Default playlist folder: 0x00000000
  Default picture folder: 0x00000000
  Default video folder: 0x00000000
  Default organizer folder: 0x00000000
  Default zencast folder: 0x00000000
  Default album folder: 0x00000000
  Default text folder: 0x00000000
libmtp supported (playable) filetypes:
  ISO MPEG-1 Audio Layer 3
  Microsoft Windows Media Audio
  Microsoft Advanced Systems Format
  RIFF WAVE file


When using mtpfs from http://www.adebenham.com/mtpfs/ , I can mount and do any activity only as root. The device permissions are fine:
crw-rw-rw- 1 root root 189, 9 2007-01-26 04:00 /dev/bus/usb/001/010  <===========> /dev/libmtp-usbdev1.10 -> bus/usb/001/010

-cyrus
User avatar
deloco
Registered Member
Posts
71
Karma
0

Re: Need help with MTP device

Sat Jan 27, 2007 7:40 am
Hm... Do you have the libmtp.rules-file in /etc/udev/rules.d/?

I don't know if this file is needed in recent libmtp-versions, but for version 0.0.20 it was, so it is available on my System since then and maybe libmtp 0.1.3 needs it too?
It has to have the following content:
deloco says wrote:SUBSYSTEM!="usb_device", ACTION!="add", GOTO="libmtp_rules_end"

# Creative Zen VisionSpecial:Recentchanges
SYSFS{idVendor}=="041e", SYSFS{idProduct}=="411f", SYMLINK+="libmtp-%k", MODE="666"
# Creative Portable Media Center
SYSFS{idVendor}=="041e", SYSFS{idProduct}=="4123", SYMLINK+="libmtp-%k", MODE="666"
# Creative Zen Xtra (MTP mode)
SYSFS{idVendor}=="041e", SYSFS{idProduct}=="4128", SYMLINK+="libmtp-%k", MODE="666"
# Second generation Dell DJ
SYSFS{idVendor}=="041e", SYSFS{idProduct}=="412f", SYMLINK+="libmtp-%k", MODE="666"
# Creative Zen Micro (MTP mode)
SYSFS{idVendor}=="041e", SYSFS{idProduct}=="4130", SYMLINK+="libmtp-%k", MODE="666"
# Creative Zen Touch (MTP mode)
SYSFS{idVendor}=="041e", SYSFS{idProduct}=="4131", SYMLINK+="libmtp-%k", MODE="666"
# Dell Pocket DJ (MTP mode)
SYSFS{idVendor}=="041e", SYSFS{idProduct}=="4132", SYMLINK+="libmtp-%k", MODE="666"
# Creative Zen Sleek (MTP mode)
SYSFS{idVendor}=="041e", SYSFS{idProduct}=="4137", SYMLINK+="libmtp-%k", MODE="666"
# Creative Zen MicroPhoto
SYSFS{idVendor}=="041e", SYSFS{idProduct}=="413c", SYMLINK+="libmtp-%k", MODE="666"
# Creative Zen Sleek Photo
SYSFS{idVendor}=="041e", SYSFS{idProduct}=="413d", SYMLINK+="libmtp-%k", MODE="666"
# Creative Zen Vision:M
SYSFS{idVendor}=="041e", SYSFS{idProduct}=="413e", SYMLINK+="libmtp-%k", MODE="666"
# Creative Zen V Plus
SYSFS{idVendor}=="041e", SYSFS{idProduct}=="4152", SYMLINK+="libmtp-%k", MODE="666"
# Samsung:YH-820
SYSFS{idVendor}=="04e8", SYSFS{idProduct}=="502e", SYMLINK+="libmtp-%k", MODE="666"
# Samsung YH-925
SYSFS{idVendor}=="04e8", SYSFS{idProduct}=="502f", SYMLINK+="libmtp-%k", MODE="666"
# Samsung YP-T7J
SYSFS{idVendor}=="04e8", SYSFS{idProduct}=="5047", SYMLINK+="libmtp-%k", MODE="666"
# Samsung YH-999 Portable Media Center
SYSFS{idVendor}=="04e8", SYSFS{idProduct}=="5a0f", SYMLINK+="libmtp-%k", MODE="666"
# Intel Bandon Portable Media Center
SYSFS{idVendor}=="045e", SYSFS{idProduct}=="00c9", SYMLINK+="libmtp-%k", MODE="666"
# iRiver Portable Media Center
SYSFS{idVendor}=="1006", SYSFS{idProduct}=="4002", SYMLINK+="libmtp-%k", MODE="666"
# iRiver Portable Media Center
SYSFS{idVendor}=="1006", SYSFS{idProduct}=="4003", SYMLINK+="libmtp-%k", MODE="666"
# JVC Alneo XA-HD500
SYSFS{idVendor}=="04f1", SYSFS{idProduct}=="6105", SYMLINK+="libmtp-%k", MODE="666"
# Philipps HDD6320
SYSFS{idVendor}=="0471", SYSFS{idProduct}=="01eb", SYMLINK+="libmtp-%k", MODE="666"
# Philipps HDD6320 2
SYSFS{idVendor}=="0471", SYSFS{idProduct}=="014b", SYMLINK+="libmtp-%k", MODE="666"
# Philipps HDD1630/17
SYSFS{idVendor}=="0471", SYSFS{idProduct}=="014c", SYMLINK+="libmtp-%k", MODE="666"
# SanDisk Sansa c150
SYSFS{idVendor}=="0781", SYSFS{idProduct}=="7410", SYMLINK+="libmtp-%k", MODE="666"
# SanDisk Sansa e200
SYSFS{idVendor}=="0781", SYSFS{idProduct}=="7420", SYMLINK+="libmtp-%k", MODE="666"
# SanDisk Sansa e260
SYSFS{idVendor}=="0781", SYSFS{idProduct}=="7420", SYMLINK+="libmtp-%k", MODE="666"
# iRiver T10
SYSFS{idVendor}=="4102", SYSFS{idProduct}=="1113", SYMLINK+="libmtp-%k", MODE="666"
# iRiver T20 FM
SYSFS{idVendor}=="4102", SYSFS{idProduct}=="1114", SYMLINK+="libmtp-%k", MODE="666"
# iRiver U10
SYSFS{idVendor}=="4102", SYSFS{idProduct}=="1116", SYMLINK+="libmtp-%k", MODE="666"
# iRiver T10
SYSFS{idVendor}=="4102", SYSFS{idProduct}=="1117", SYMLINK+="libmtp-%k", MODE="666"
# iRiver T20
SYSFS{idVendor}=="4102", SYSFS{idProduct}=="1118", SYMLINK+="libmtp-%k", MODE="666"
# iRiver T30
SYSFS{idVendor}=="4102", SYSFS{idProduct}=="1119", SYMLINK+="libmtp-%k", MODE="666"
# iRiver H10
SYSFS{idVendor}=="4102", SYSFS{idProduct}=="2101", SYMLINK+="libmtp-%k", MODE="666"
# iRiver H10
SYSFS{idVendor}=="4102", SYSFS{idProduct}=="2102", SYMLINK+="libmtp-%k", MODE="666"
# Dell DJ Itty
SYSFS{idVendor}=="413c", SYSFS{idProduct}=="4500", SYMLINK+="libmtp-%k", MODE="666"
# Toshiba Gigabeat MEGF-40
SYSFS{idVendor}=="0930", SYSFS{idProduct}=="0009", SYMLINK+="libmtp-%k", MODE="666"
# Toshiba Gigabeat
SYSFS{idVendor}=="0930", SYSFS{idProduct}=="000c", SYMLINK+="libmtp-%k", MODE="666"

LABEL="libmtp_rules_end"


Mybe this solves your problem...


MacBook, 2GHz C2D, 3GB RAMM, 120GB HDD.

Amarok 2.0 Beta from KDE-on-Mac.
irpstrcr
Registered Member
Posts
2
Karma
0

Re: Need help with MTP device

Sat Jan 27, 2007 9:43 pm
LIBMTP_Send_Track_From_File_Descriptor: Could not send object info.
Return code: 0x2009 (look this up in ptp.h for an explanation).                            --------> #define PTP_RC_InvalidObjectHandle      0x2009
amarok:  [MtpMediaDevice] Could not write file -1


I had the same problem trying to send tracks to a Clix using libmtp from CVS just after the 0.1.2 release. 

What works for me is changing the following in the libmtp cvs source:
libmtp/src/ptp.h
//#define PTP_USB_BULK_HS_MAX_PACKET_LEN        512
#define PTP_USB_BULK_HS_MAX_PACKET_LEN        4096

As you are using amarok-1.4-SVN and it is building mtpmediadevice w/o problem I guess
MtpMediaDevice::getCapacity & MtpMediaDevice::customClicked() have been fixed.
cyrus007
Registered Member
Posts
42
Karma
0

Re: Need help with MTP device

Sun Jan 28, 2007 6:03 am
deloco, I didn't go into the details that I do have the udev rules file and /dev/libmtp... device links are being created with 666 permission and I can see the playlist in Amarok and I can delete files from my MTP device etc.

lrpstrcr, I tried your patch to increase packet length to 4096 but it still did not work (nor reducing it to 64), same error 'Failed to copy...'. I did try $mtp-sendfile under the same user as Amarok and it worked fine, no problem with authorizations, so something in Amarok. Yes, I am running SVN patch #627779 today but customClicked is creating a crash dump as it has always been doing. I was thinking of tackling that later once this is fixed.

Here is my mtp-detect output

Found non-autodetected device "Nokia XXX" on USB bus...
Connected to MTP device.
USB low-level info:
  Using kernel interface "usbfs"
  bcdUSB: 512
  bDeviceClass: 255
  bDeviceSubClass: 0
  bDeviceProtocol: 0
  idVendor: 0421
  idProduct: 04e1
  IN endpoint maxpacket: 64 bytes
  OUT endpoint maxpacket: 64 bytes
  Device flags: 0x00000000
Device info:
  Manufacturer: Nokia
  Model: Nokia XXX
  Device version: v. 1.00
  Serial number: 004400981702333
  Vendor extension ID: 0x00000006
  Vendor extension description: microsoft.com:1.0;microsoft.com/WMPPD: 11.0;microsoft.com/WMDRMPD: 10.1
Supported operations:
  1001: get device info
  1002: Open session
  1003: Close session
  1004: Get storage IDs
  1005: Get storage info
  1004: Get storage IDs
  1005: Get storage info
  1006: Get number of objects
  1007: Get object handles
  1008: Get object info
  1009: Get object
  100b: Delete object
  100c: Send object info
  100d: Send object
  1010: Reset device
  1014: Get device property description
  1015: Get device property value
  1016: Set device property value
  9801: Get object properties supported
  9802: Get object property description
  9803: Get object property value
  9804: Set object property value
  9810: Get object references
  9811: Set object references
  9201: Report Added/Deleted Items
  9202: Report Acquired Items
  9203: Get type of playlists that are allowed to be transfered
  9101: Get secure time challenge
  9102: Get secure time response
  9103: Set license response
  9104: Get sync list
  9105: Send meter challenge query
  9106: Get meter challenge
  9107: Get meter response
  9108: Clean data store
  9109: Get license state
  910a: Send WMDRM-PD Command
  910b: Send WMDRM-PD Request
Events supported:
  0x400a
  0x4004
  0x4005
Device Properties Supported:
  0xd401: Synchronization Partner
  0xd402: Device Friendly Name
  0xd404: Unknown property
  0xd102: Device Certificate
  0xd101: Secure Time
Playable File (Object) Types and Object Properties Supported:
<...>
cyrus007
Registered Member
Posts
42
Karma
0

Re: Need help with MTP device

Sun Feb 04, 2007 5:56 pm
A major problem I am facing is when I click on a track on my MTP device, it does not play the track and gives the following error message. Does this happen with other MTP devices such as Clix or Zune ?

amarok: BEGIN: virtual void UrlLoader::completeJob()
amarok:      [PlaylistLoader] The following urls were not suitable for the playlist:
amarok:      [PlaylistLoader]  file://Chiquita.mp3
amarok: END__: virtual void UrlLoader::completeJob() - Took 0.0017s

The problem is obviously putting url=file://Chiquita.mp3 where it should be something like url=mtp://Chiquita.mp3 because the file is still in the device and not mapped to any local folder. I wanted to know if this happen with other MTP devices as I don't have access to any other ?
mopoke
Registered Member
Posts
20
Karma
0

Re: Need help with MTP device

Mon Feb 05, 2007 10:25 am
cyrus007 wrote:A major problem I am facing is when I click on a track on my MTP device, it does not play the track and gives the following error message. Does this happen with other MTP devices such as Clix or Zune ?


Playing a file direct from an MTP device is not supported.
You need to copy it to your collection first.
cyrus007
Registered Member
Posts
42
Karma
0

Re: Need help with MTP device

Wed Feb 28, 2007 12:27 am
mopoke wrote:Playing a file direct from an MTP device is not supported.
You need to copy it to your collection first.


Finally got Amarok to play directly from MTP device. The code can be downloaded from here - http://amarok4kde.blogspot.com/2007/02/ ... ce_27.html

Right now it only supports doubleclick and maybe returnkey. It uses on-demand caching and providing a proxyUrl to the cached file.


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], lockheed, Sogou [Bot]