Linus Walleij | 0dd71e9 | 2006-05-04 18:47:07 +0000 | [diff] [blame] | 1 | Building and Installing |
| 2 | ----------------------- |
Linus Walleij | 6fd2f08 | 2006-03-28 07:19:22 +0000 | [diff] [blame] | 3 | |
Linus Walleij | 0dd71e9 | 2006-05-04 18:47:07 +0000 | [diff] [blame] | 4 | See the "INSTALL" file. |
| 5 | |
| 6 | |
| 7 | Heritage |
| 8 | -------- |
| 9 | |
| 10 | libmtp is based on several ancestors: |
| 11 | |
| 12 | * libptp2 by Mariusz Woloszyn was the starting point used |
| 13 | by Richard A. Low for the initial starter port. You can |
| 14 | find it at http://libptp.sourceforge.net/ |
| 15 | |
| 16 | * libgphoto2 by Mariusz Woloszyn and Marcus Meissner was |
| 17 | used at a later stage since it was (is) more actively |
| 18 | maintained. libmtp tracks the PTP implementation in |
| 19 | libgphoto2 and considers it an upstream project. We will |
| 20 | try to submit anything generally useful back to libgphoto2 |
| 21 | and not make double efforts. In practice this means we |
| 22 | use ptp.c, ptp.h and ptp-pack.c verbatim from the libgphoto2 |
| 23 | source code. If you need to change things in these files, |
| 24 | make sure it is so general that libgphoto2 will want to |
| 25 | merge it to their codebase too. You find libgphoto2 as part |
| 26 | of gPhoto: http://gphoto.sourceforge.net/ |
| 27 | |
| 28 | * libnjb was a project that Richard and Linus were working |
Linus Walleij | fcf8891 | 2006-06-05 13:23:33 +0000 | [diff] [blame] | 29 | on before libmtp. When Linus took Richards initial port |
Linus Walleij | 0dd71e9 | 2006-05-04 18:47:07 +0000 | [diff] [blame] | 30 | and made an generic C API he re-used the philosophy and |
| 31 | much code from libnjb. Many of the sample programs are for |
| 32 | example taken quite literally from libnjb. You find it here: |
| 33 | http://libnjb.sourceforge.net/ |
| 34 | |
| 35 | |
| 36 | Compiling programs for libmtp |
| 37 | ----------------------------- |
| 38 | |
| 39 | libmtp has support for the pkg-config script by adding a libmtp.pc |
| 40 | entry in $(prefix)/lib/pkgconfig. To compile a libmtp program, |
| 41 | "just" write: |
| 42 | |
| 43 | gcc -o foo `pkg-config --cflags --libs libmtp` foo.c |
| 44 | |
| 45 | This also simplifies compilation using autoconf and pkg-config: just |
| 46 | write e.g. |
| 47 | |
| 48 | PKG_CHECK_MODULES(MTP, libmtp) |
| 49 | AC_SUBST(MTP_CFLAGS) |
| 50 | AC_SUBST(MTP_LIBS) |
| 51 | |
| 52 | To have libmtp LIBS and CFLAGS defined. Needless to say, this will |
| 53 | only work if you have pkgconfig installed on your system, but most |
| 54 | people have nowadays. |
| 55 | |
| 56 | If your library is installed in e.g. /usr/local you may have to tell |
| 57 | this to pkgconfig by setting the PKG_CONFIG_PATH thus: |
| 58 | |
| 59 | export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig |
| 60 | |
| 61 | |
| 62 | Documentation |
| 63 | ------------- |
| 64 | |
| 65 | Read the API documentation that can be generated with doxygen. |
| 66 | It will be output in doc/html if you have Doxygen properly |
| 67 | installed. (It will not be created unless you have Doxygen!) |
| 68 | |
| 69 | For information about the Media Transfer Protocol, see: |
| 70 | http://en.wikipedia.org/wiki/Media_Transfer_Protocol |
| 71 | |
Linus Walleij | 7a83e55 | 2008-07-29 21:30:43 +0000 | [diff] [blame] | 72 | The official 1.0 specification for MTP was released by the |
| 73 | USB Implementers Forum in may, 2008. Prior to this, only a |
| 74 | proprietary Microsoft version was available, and quite a few |
| 75 | devices out there still use some aspects of the Microsoft |
| 76 | version, which deviates from the specified standard. You can |
| 77 | find the official specification here: |
| 78 | http://www.usb.org/developers/devclass_docs/MTP_1.0.zip |
Linus Walleij | 0dd71e9 | 2006-05-04 18:47:07 +0000 | [diff] [blame] | 79 | |
| 80 | Contributing |
| 81 | ------------ |
| 82 | |
| 83 | See the project page at http://libmtp.sourceforge.net/ |
Linus Walleij | ee73ef2 | 2006-08-27 19:56:00 +0000 | [diff] [blame] | 84 | We always need your help. There is a mailinglist and a |
| 85 | bug report system there. |
Linus Walleij | 6fd2f08 | 2006-03-28 07:19:22 +0000 | [diff] [blame] | 86 | |
Linus Walleij | a1b66f2 | 2007-05-10 20:02:16 +0000 | [diff] [blame] | 87 | |
| 88 | New Devices |
| 89 | ----------- |
| 90 | |
Linus Walleij | fcf8891 | 2006-06-05 13:23:33 +0000 | [diff] [blame] | 91 | If you happen upon a device which libmtp claims it cannot |
| 92 | autodetect, please submit the vendor ID and device ID |
Linus Walleij | 9ee2940 | 2007-10-31 20:24:48 +0000 | [diff] [blame] | 93 | (these can be obtained from the "lsusb" and "lsusb -n" |
| 94 | commands run as root) as a bug, patch or feature request |
| 95 | on the Sourceforge bug tracker at our homepage. If it |
| 96 | gives a sensible output from "mtp-detect" then please attach |
| 97 | the result as well as it teach us some stuff about your |
| 98 | device. If you've done some additional hacking, join our |
| 99 | mailinglist and post your experiences there. |
Linus Walleij | da558be | 2007-03-10 21:42:25 +0000 | [diff] [blame] | 100 | |
Linus Walleij | a1b66f2 | 2007-05-10 20:02:16 +0000 | [diff] [blame] | 101 | If you want to be able to hack some more and you're not |
| 102 | afraid of C hacking, add an entry for your device's |
| 103 | vendor/product ID and a descriptive string to the database |
Linus Walleij | 6dc0168 | 2007-11-15 21:23:46 +0000 | [diff] [blame] | 104 | in the file src/music-players.h. |
Linus Walleij | a1b66f2 | 2007-05-10 20:02:16 +0000 | [diff] [blame] | 105 | |
| 106 | If you want to poke around to see if your device has some |
| 107 | special pecularities, you can test some special device |
Linus Walleij | 6dc0168 | 2007-11-15 21:23:46 +0000 | [diff] [blame] | 108 | flags (defined in src/device-flags.h) by inserting them |
| 109 | together with your device entry in src/music-players.h. |
Linus Walleij | a1b66f2 | 2007-05-10 20:02:16 +0000 | [diff] [blame] | 110 | Flags can be tested in isolation or catenated with "|" |
| 111 | (binary OR). If relatives to your device use a certain |
| 112 | flag, chances are high that a new device will need it |
| 113 | too, typically from the same manufacturer. |
| 114 | |
| 115 | The most common flag that needs to be set is the |
| 116 | DEVICE_FLAG_UNLOAD_DRIVER that detach any Linux kernel |
| 117 | drivers that may have attached to the device making |
Linus Walleij | 94f23d5 | 2007-08-04 19:37:28 +0000 | [diff] [blame] | 118 | MTP access impossible. This is however not expected to |
| 119 | really work: this is a problem being tracked as of |
| 120 | now (2007-08-04). See the "last resort" solutions below |
| 121 | if you really need to get your dual-mode device to work |
| 122 | with MTP. |
Linus Walleij | a1b66f2 | 2007-05-10 20:02:16 +0000 | [diff] [blame] | 123 | |
Linus Walleij | cc2cf97 | 2007-11-22 20:23:43 +0000 | [diff] [blame] | 124 | Another flag which is easy to identify is the |
| 125 | DEVICE_FLAG_NO_ZERO_READS, which remedies connection |
| 126 | timeouts when getting files, and some timeouts on e.g. |
| 127 | successive "mtp-connect" calls. |
| 128 | |
Linus Walleij | 91fb028 | 2007-09-03 21:16:08 +0000 | [diff] [blame] | 129 | If you are a device vendor, please consider assigning one |
| 130 | of your employees as a contact person for libmtp, have them |
| 131 | sign up to the libmtp development list and answer questions |
| 132 | and post new device ID:s as they are released to our |
| 133 | mailing list. By the way: do you have spare devices you |
| 134 | can give us? Send them to Richard (Mac support) or Linus |
| 135 | (Linux support). (So far nobody did that except for Microsoft |
| 136 | who sent us a Zune by proxy!) |
| 137 | |
Linus Walleij | a1b66f2 | 2007-05-10 20:02:16 +0000 | [diff] [blame] | 138 | If your device is very problematic we are curious of how it |
Linus Walleij | da558be | 2007-03-10 21:42:25 +0000 | [diff] [blame] | 139 | works under Windows, so we enjoy reading USB packet sniffs |
| 140 | that reveal the low-level traffic carried out between |
| 141 | Windows Media Player and your device. This can be done |
Linus Walleij | 61c2568 | 2007-09-04 14:46:21 +0000 | [diff] [blame] | 142 | using e.g.: |
| 143 | |
| 144 | * USBsnoop: |
| 145 | http://benoit.papillault.free.fr/usbsnoop/ |
| 146 | |
| 147 | * The trial version of HHD Softwares software-only |
| 148 | USB monitor. You need to get a copy of version 2.37 since |
| 149 | the newer trial versions won't let you carry out the |
| 150 | needed packet sniffs. (As of 2007-03-10 a copy can be found |
| 151 | at: http://www.cobbleware.com/files/usb-monitor-237.exe) |
| 152 | |
Linus Walleij | da558be | 2007-03-10 21:42:25 +0000 | [diff] [blame] | 153 | There are other USB monitors as well, some more expensive |
| 154 | alternatives use hardware and even measure electronic |
| 155 | characteristics of the traffic (which is far too much |
| 156 | detail for us). |
| 157 | |
Linus Walleij | 91fb028 | 2007-09-03 21:16:08 +0000 | [diff] [blame] | 158 | Device sniffs are an easy read since the PTP/MTP protocol |
| 159 | is nicely structured. All commands will have a structure such |
| 160 | as this in the log, we examplify with a object list request: |
| 161 | |
| 162 | PTP REQEUST: |
| 163 | 000120: Bulk or Interrupt Transfer (UP), 03.09.2007 12:49:25.9843750 +0.0 |
| 164 | Pipe Handle: 0x863ce234 (Endpoint Address: 0x2) |
| 165 | Send 0x20 bytes to the device: |
| 166 | 20 00 00 00 01 00 05 98 23 00 00 00 27 03 00 10 ......?#...'... |
| 167 | Length TYPE CMD Trans# Param1 |
| 168 | |
| 169 | 00 00 00 00 02 DC 00 00 00 00 00 00 00 00 00 00 .....Ü.......... |
| 170 | Param2 Param3 Param4 Param5 |
| 171 | |
| 172 | [OPTIONAL] DATA PHASE: |
| 173 | 000121: Bulk or Interrupt Transfer (UP), 03.09.2007 12:49:26.0 +0.0156250 |
| 174 | Pipe Handle: 0x863ce214 (Endpoint Address: 0x81) |
| 175 | Get 0x1a bytes from the device: |
| 176 | 1A 00 00 00 02 00 05 98 23 00 00 00 01 00 00 00 .......?#....... |
| 177 | Length TYPE CMD Trans# DATA |
| 178 | |
| 179 | 27 03 00 10 02 DC 04 00 00 30 '....Ü...0 |
| 180 | |
| 181 | RESPONSE: |
| 182 | 000122: Bulk or Interrupt Transfer (UP), 03.09.2007 12:49:26.0 +0.0 |
| 183 | Pipe Handle: 0x863ce214 (Endpoint Address: 0x81) |
| 184 | Get 0xc bytes from the device: |
| 185 | 0C 00 00 00 03 00 01 20 23 00 00 00 ....... #... |
| 186 | Length TYPE CODE Trans# |
| 187 | |
| 188 | * One send (OUT to the device), two reads (IN from the device). |
| 189 | |
| 190 | * All three byte chunks commands are |
| 191 | sent/recieved/recieeved by the function ptp_transaction() |
| 192 | in the file ptp.c. |
| 193 | |
| 194 | * It boils down to ptp_usb_sendreq(), optionally ptp_usb_senddata() |
| 195 | or ptp_usb_getdata() and finally ptp_usb_getresp() in the file |
| 196 | libusb-glue.c. Notice ptp_usb_sendreq() and ptp_usb_getresp() |
| 197 | are ALWAYS called. The TYPE field correspond to this, so the |
| 198 | TYPES in this case are "COMMAND" (0x0001), "DATA" (0x0002), |
| 199 | and "RESPONSE" (0x0003). |
| 200 | |
| 201 | * Notice that the byte order is little endian, so you need to read |
| 202 | each field from right to left. |
| 203 | |
| 204 | * This COMMAND has: |
| 205 | CMD 0x99805, we see in ptp.h that this is PTP_OC_MTP_GetObjPropList. |
| 206 | Transaction# 0x00000023. |
| 207 | REQUEST parameters 0x10000327, 0x00000000, 0x0000DC02, 0x00000000 |
| 208 | 0x00000000, in this case it means "get props for object 0x10000327", |
| 209 | "any format", "property 0xDC02" (PTP_OPC_ObjectFormat), then two |
| 210 | parameters that are always zero (no idea what they mean or their |
| 211 | use). |
| 212 | |
| 213 | * The DATA has: |
| 214 | CMD 0x99805, we see in ptp.h that this is PTP_OC_MTP_GetObjPropList. |
| 215 | Transaction# 0x00000023. |
| 216 | Then comes data 0x00000001, 0x10000327, 0xDC02, 0x0004, 0x3000 |
| 217 | Which means in this case, (and this is the tricky part) "here |
| 218 | you have 1 property", "for object 0x10000327", "it is property |
| 219 | 0xDC02" (PTP_OPC_ObjectFormat), "which is of type 0x0004" |
| 220 | (PTP_DTC_UINT16), "and set to 0x3000" (PTP_OFC_Undefined, it |
| 221 | is perfectly valid to have undefined object formats, since it |
| 222 | is a legal value defining this). |
| 223 | |
| 224 | * This RESPONSE has: |
| 225 | CMD 0x99805, we see in ptp.h that this is PTP_OC_MTP_GetObjPropList. |
| 226 | Return Code ("RC") = 0x2001, PTP_RC_OK, all went fine. |
| 227 | Transaction# 0x00000023. |
Linus Walleij | fcf8891 | 2006-06-05 13:23:33 +0000 | [diff] [blame] | 228 | |
Linus Walleij | d05fce6 | 2007-09-29 20:17:23 +0000 | [diff] [blame] | 229 | If you want to compare the Windows behaviour with a similar |
Linus Walleij | 6dc0168 | 2007-11-15 21:23:46 +0000 | [diff] [blame] | 230 | operation using libmtp you can go into the src/libusb-glue.c |
| 231 | file and uncomment the row that reads: |
Linus Walleij | d05fce6 | 2007-09-29 20:17:23 +0000 | [diff] [blame] | 232 | |
| 233 | //#define ENABLE_USB_BULK_DEBUG |
| 234 | |
| 235 | (I.e. remove the two //.) |
| 236 | |
| 237 | This will make libmtp print out a hex dump of every bulk USB |
| 238 | transaction. The bulk transactions contain all the PTP/MTP layer |
| 239 | data, which is usually where the problems appear. |
| 240 | |
Linus Walleij | 6fd2f08 | 2006-03-28 07:19:22 +0000 | [diff] [blame] | 241 | |
Linus Walleij | bd7624c | 2007-05-28 10:48:54 +0000 | [diff] [blame] | 242 | Devices does not work - last resort: |
| 243 | ------------------------------------ |
| 244 | |
| 245 | Some devices that are dual-mode are simply impossible to get |
| 246 | to work under Linux because the usb-storage(.ko) kernel |
| 247 | module hook them first, and refuse to release them, even |
Linus Walleij | 94f23d5 | 2007-08-04 19:37:28 +0000 | [diff] [blame] | 248 | when we specify the DEVICE_FLAG_UNLOAD_DRIVER flag. (Maybe |
| 249 | it DOES release it but the device will immediately be probed |
| 250 | at the USB mass storage interface AGAIN because it |
| 251 | enumerates.) |
Linus Walleij | bd7624c | 2007-05-28 10:48:54 +0000 | [diff] [blame] | 252 | |
Linus Walleij | e20abaf | 2007-12-10 11:20:34 +0000 | [diff] [blame] | 253 | Linux: Try this, if you have a recent 2.6.x Linux kernel, |
Linus Walleij | 584eb8d | 2007-09-05 19:51:27 +0000 | [diff] [blame] | 254 | run (as root) something like: |
| 255 | |
| 256 | > rmmod usb_storage ; mtp-detect |
| 257 | |
| 258 | You can run most any command or a client like gnomad2 or |
| 259 | Amarok immediately after the rmmod command. This works |
| 260 | sometimes. Another way: |
Linus Walleij | bd7624c | 2007-05-28 10:48:54 +0000 | [diff] [blame] | 261 | |
Linus Walleij | 94f23d5 | 2007-08-04 19:37:28 +0000 | [diff] [blame] | 262 | * Edit /etc/modprobe.d/blacklist |
Linus Walleij | bd7624c | 2007-05-28 10:48:54 +0000 | [diff] [blame] | 263 | |
| 264 | * Add the line "blacklist usb-storage" |
| 265 | |
| 266 | * Reboot. |
| 267 | |
| 268 | Now none of you USB disks, flash memory sticks etc will be |
| 269 | working (you just disabled them all). However you *can* try |
| 270 | your device, and it might have started working because there |
| 271 | is no longer a USB mass storage driver that tries to hook onto |
| 272 | the mass storage interface of your device. |
| 273 | |
Linus Walleij | 94f23d5 | 2007-08-04 19:37:28 +0000 | [diff] [blame] | 274 | If not even blacklisting works (check with |
| 275 | "lsmod | grep usb-storage"), there is some problem with |
| 276 | something else and you may need to remove or rename the file |
| 277 | /lib/modules/<VERSION>/kernel/drivers/usb/storage/usb-storage.ko |
| 278 | manually. |
| 279 | |
Linus Walleij | bd7624c | 2007-05-28 10:48:54 +0000 | [diff] [blame] | 280 | If you find the PerfectSolution(TM) to this dilemma, so you |
| 281 | can properly switch for individual devices whether to use it |
| 282 | as USB mass storage or not, please tell us how you did it. We |
| 283 | know we cannot use udev, because udev is called after-the-fact: |
| 284 | the device is already configured for USB mass storage when |
| 285 | udev is called. |
| 286 | |
Linus Walleij | e20abaf | 2007-12-10 11:20:34 +0000 | [diff] [blame] | 287 | On Mac OS there is another ugly hack: |
| 288 | |
| 289 | 1. Open up a terminal window |
| 290 | 2. Type: |
| 291 | sudo mv /System/Library/Extensions/IOUSBMassStorageClass.kext |
| 292 | /System/Library/Extensions/IOUSBMassStorageClass.kext.disabled |
| 293 | |
| 294 | and when prompted enter your password. |
| 295 | |
| 296 | 3. Restart. |
| 297 | |
| 298 | To reverse this change, just reverse the filenames: |
| 299 | |
| 300 | sudo mv /System/Library/Extensions/ |
| 301 | IOUSBMassStorageClass.kext.disabled /System/Library/Extensions/ |
| 302 | IOUSBMassStorageClass.kext |
| 303 | |
| 304 | and restart. |
| 305 | |
Linus Walleij | bd7624c | 2007-05-28 10:48:54 +0000 | [diff] [blame] | 306 | |
Linus Walleij | 15def33 | 2006-09-19 14:27:02 +0000 | [diff] [blame] | 307 | Calendar and contact support: |
| 308 | ----------------------------- |
Linus Walleij | d3bdf76 | 2006-02-20 22:21:56 +0000 | [diff] [blame] | 309 | |
Linus Walleij | 3c16fe4 | 2006-04-30 07:53:41 +0000 | [diff] [blame] | 310 | The Creative Zen series can read VCALENDAR2 (.ics) files |
Linus Walleij | 15def33 | 2006-09-19 14:27:02 +0000 | [diff] [blame] | 311 | and VCard (.vcf) files from programs like for example |
| 312 | Evolution with the following limitations/conditions: |
Linus Walleij | d3bdf76 | 2006-02-20 22:21:56 +0000 | [diff] [blame] | 313 | |
Linus Walleij | 3c16fe4 | 2006-04-30 07:53:41 +0000 | [diff] [blame] | 314 | - The file must be in DOS (CR/LF) format, use the unix2dos |
| 315 | program to convert if needed |
Linus Walleij | 15def33 | 2006-09-19 14:27:02 +0000 | [diff] [blame] | 316 | |
| 317 | - Repeat events in calendar files do not seem to be supported, |
| 318 | entries will only appear once. |
| 319 | |
| 320 | - Calendar (.ics) files should be stored in the folder "My Organizer" |
| 321 | when sent to the device (this directory should be autodetected |
Linus Walleij | 80b2c72 | 2006-06-22 17:57:17 +0000 | [diff] [blame] | 322 | for use with calendar files, otherwise use the option |
Linus Walleij | 15def33 | 2006-09-19 14:27:02 +0000 | [diff] [blame] | 323 | -f "My Organizer" to sendfile for this) Apparently this file can |
| 324 | also contain tasklists. |
| 325 | |
| 326 | - Contact (.vcf) files should be stored in the folder "My Contacts" |
| 327 | when sent to the device. (-f "My Contacts") |
| 328 | |
| 329 | - Some devices are picky about the name of the calendar and |
| 330 | contact files. For example the Zen Microphoto wants: |
| 331 | |
Linus Walleij | b1318d1 | 2006-09-25 14:59:26 +0000 | [diff] [blame] | 332 | Calendar: My Organizer/6651416.ics |
| 333 | Contacts: My Organizer/6651416.vcf |
| 334 | |
| 335 | |
| 336 | Syncing in with Evolution and Creative Devices |
| 337 | ---------------------------------------------- |
| 338 | |
| 339 | Evolution can easily export .ics an .vcf files, but you currently |
| 340 | need some command-line hacking to get you stuff copied over in |
| 341 | one direction host -> device. The examples/ directory contains a script |
| 342 | created for the Creative Zen Microphoto by Nicolas Tetreault. |
| 343 | |
Linus Walleij | 6e8cef4 | 2006-12-03 20:45:04 +0000 | [diff] [blame] | 344 | |
| 345 | It's Not Our Bug! |
| 346 | ----------------- |
| 347 | |
| 348 | Some MTP devices have strange pecularities. We try to work around |
| 349 | these whenever we can, sometimes we cannot work around it or we |
| 350 | cannot test your solution. |
| 351 | |
Linus Walleij | 67038b9 | 2008-04-16 15:01:40 +0000 | [diff] [blame] | 352 | * Generic MTP/PTP disconnect misbehaviour: we have noticed that |
| 353 | Windows Media Player apparently never close the session to an MTP |
| 354 | device. There is a daemon in Windows that "hooks" the device |
| 355 | by opening a PTP session to any MTP device, whenever it is |
| 356 | plugged in. This daemon proxies any subsequent transactions |
| 357 | to/from the device and will never close the session, thus |
| 358 | Windows simply does not close sessions at all. |
| 359 | |
| 360 | This means that device manufacturers doesn't notice any problems |
| 361 | with devices that do not correctly handle closing PTP/MTP |
| 362 | sessions, since Windows never do it. The proper way of closing |
| 363 | a session in Windows is to unplug the device, simply put. |
| 364 | |
| 365 | Since libmtp actually tries to close sessions, some devices |
| 366 | may fail since the close session functionality has never been |
| 367 | properly tested, and "it works with Windows" is sort of the |
| 368 | testing criteria at some companies. |
| 369 | |
| 370 | You can get Windows-like behaviour on Linux by running a HAL-aware |
| 371 | libmtp GUI client like Rhythmbox or Gnomad2, which will "hook" |
| 372 | the device when you plug it in, and "release" it if you unplug |
| 373 | it. |
| 374 | |
| 375 | If this bug in your device annoys you, contact your device |
| 376 | manufacturer and ask them to test their product with some libmtp |
| 377 | program. |
| 378 | |
Linus Walleij | b715ba6 | 2008-02-12 23:41:49 +0000 | [diff] [blame] | 379 | * Generic USB misbehaviour: some devices behave badly under MTP |
| 380 | and USB mass storage alike, even down to the lowest layers |
| 381 | of USB. You can always discuss such issues at the linux-usb |
| 382 | mailing list if you're using Linux: |
| 383 | http://www.linux-usb.org/mailing.html |
| 384 | |
Linus Walleij | 76b185d | 2008-02-12 23:46:14 +0000 | [diff] [blame] | 385 | If you have a problem specific to USB mass storage mode, there |
| 386 | is a list of strange behaving devices in the Linux kernel: |
| 387 | http://lxr.linux.no/linux/drivers/usb/storage/unusual_devs.h |
Linus Walleij | f7d8df1 | 2008-02-13 00:02:17 +0000 | [diff] [blame] | 388 | You can discuss this too on the mentioned list, for understanding |
| 389 | the quirks, see: |
| 390 | http://www2.one-eyed-alien.net/~mdharm/linux-usb/target_offenses.txt |
Linus Walleij | 76b185d | 2008-02-12 23:46:14 +0000 | [diff] [blame] | 391 | |
Linus Walleij | 07bb538 | 2008-07-31 20:21:09 +0000 | [diff] [blame] | 392 | * Zen models AVI file seeking problem: the Zens cannot parse the |
| 393 | files for the runlength metadata. Do not transfer file with e.g. |
| 394 | mtp-sendfile, use mtp-sendtr and set the length of the track to |
| 395 | the apropriate number of seconds and it will work. In graphical |
| 396 | clients, use a "track transfer" function to send these AVI files, |
| 397 | the Zens need the metadata associated with tracks to play back |
| 398 | movies properly. Movies are considered "tracks" in the MTP world. |
| 399 | |
Linus Walleij | 64e2e98 | 2008-08-01 21:51:13 +0000 | [diff] [blame] | 400 | * Some devices that disregard the metadata sent with the MTP |
| 401 | commands will parse the files for e.g. ID3 metadata. Some still |
| 402 | of these devices expect only ID3v2.3 metadata and will fail with |
| 403 | a modern ID3v2,4 tag writer, like many of those found in Linux |
| 404 | applications. Windows Media Player use ID3v2.3 only, so many |
| 405 | manufacturers only test this version. |
| 406 | |
Linus Walleij | 6e8cef4 | 2006-12-03 20:45:04 +0000 | [diff] [blame] | 407 | * The Zen Vision:M (possibly more Creative Zens) has a firmware bug |
| 408 | that makes it drop the last two characters off a playlist name. |
| 409 | It is fixed in later firmware. |
| 410 | |
Linus Walleij | c41f2e8 | 2007-03-12 22:26:00 +0000 | [diff] [blame] | 411 | * For Creative Technology devices, there are hard limits on how |
| 412 | many files can be put onto the device. For a 30 GiB device (like |
| 413 | the Zen Xtra) the limit is 6000, for a 60 GiB device the limit |
| 414 | is 15000 files. For further Creative pecularities, see the |
| 415 | FAQ sections at www.nomadness.net. |
| 416 | |
Linus Walleij | d24a7ab | 2007-03-07 21:48:43 +0000 | [diff] [blame] | 417 | * Sandisk sansa c150 and probably several other Sandisk devices |
| 418 | (and possibly devices from other manufacturers) have a dual |
| 419 | mode with MTP and USB mass storage. The device will initially |
| 420 | claim to be mass storage so udev will capture is and make the |
Linus Walleij | da558be | 2007-03-10 21:42:25 +0000 | [diff] [blame] | 421 | use of MTP mode impossible. One way of avoiding it could be to |
Linus Walleij | d24a7ab | 2007-03-07 21:48:43 +0000 | [diff] [blame] | 422 | be to blacklist the "usb-storage" module in |
| 423 | /etc/modprobe.c/blacklist with a row like this: |
Linus Walleij | da558be | 2007-03-10 21:42:25 +0000 | [diff] [blame] | 424 | "blacklist usb-storage". Some have even removed the |
| 425 | "usb-storage.ko" (kernel module file) to avoid loading. |
Linus Walleij | d24a7ab | 2007-03-07 21:48:43 +0000 | [diff] [blame] | 426 | |
Linus Walleij | da558be | 2007-03-10 21:42:25 +0000 | [diff] [blame] | 427 | * The iriver devices (possibly all of them) cannot handle the |
Linus Walleij | 6e8cef4 | 2006-12-03 20:45:04 +0000 | [diff] [blame] | 428 | enhanced GetObjectPropList MTP command (0x9805) properly. So |
| 429 | they have been banned from using it. |
| 430 | |
Linus Walleij | da558be | 2007-03-10 21:42:25 +0000 | [diff] [blame] | 431 | * iriver devices have problems with older versions of libmtp and |
Linus Walleij | 8226522 | 2007-03-04 19:47:08 +0000 | [diff] [blame] | 432 | with new devices libmtp does not know of as of yet, since it |
| 433 | has an oldstyle USB device controller that cannot handle zero |
Linus Walleij | da558be | 2007-03-10 21:42:25 +0000 | [diff] [blame] | 434 | writes. (Register your device with us!) All their devices are |
| 435 | likely to need a special device flag in the src/libusb-glue.c |
| 436 | database. |
Linus Walleij | 8226522 | 2007-03-04 19:47:08 +0000 | [diff] [blame] | 437 | |
Linus Walleij | 6e8cef4 | 2006-12-03 20:45:04 +0000 | [diff] [blame] | 438 | * The Samsung Yepp T9 has several strange characteristics, some |
| 439 | that we've managed to work around. (For example it will return |
| 440 | multiple PTP packages in a single transaction.) |
| 441 | |
Linus Walleij | f2711b3 | 2007-02-26 20:18:40 +0000 | [diff] [blame] | 442 | * The early firmware for Philips HDD players is known to be |
| 443 | problematic. Please upgrade to as new firmware as you can get. |
| 444 | (Yes this requires some kind of Windows Installation I think.) |
| 445 | |
Linus Walleij | b5a4f92 | 2008-05-11 20:15:00 +0000 | [diff] [blame] | 446 | * Philips HDD 1630/16 or 1630/17 etc may lock themselves up, |
| 447 | turning inresponsive due to internal corruption. This typically |
| 448 | gives an error in opening the PTP session. Apparently you can |
| 449 | do a "repair" with the firmware utility (Windows only) which |
| 450 | will often fix this problem and make the device responsive |
| 451 | again. |
| 452 | |
Linus Walleij | 9340aac | 2007-10-01 10:02:05 +0000 | [diff] [blame] | 453 | * Some devices that implement GetObjectPropList (0x9805) will |
| 454 | not return the entire object list if you request a list for object |
| 455 | 0xffffffffu. (But they should.) So they may need the special |
| 456 | DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST_ALL. |
| 457 | |
| 458 | * Some (smaller) subset of devices cannot even get all the |
| 459 | properties for a single object in one go, these need the |
| 460 | DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST. Currently only the |
| 461 | iriver devices seem to have this bug. |
| 462 | |
| 463 | * The Toshiba Gigabeat S (and probably its sibling the |
| 464 | Microsoft Zune and other Toshiba devices) will only display |
| 465 | album information tags for a song in case there is also |
| 466 | an abstract album (created with the album interface) with |
| 467 | the exact same name. |
Linus Walleij | d132d8e | 2007-04-03 23:24:54 +0000 | [diff] [blame] | 468 | |
Linus Walleij | 265b9d6 | 2007-11-25 20:08:15 +0000 | [diff] [blame] | 469 | * The Zen Vision:M has an older firmware which is very corrupt, |
| 470 | it is incompatible with the Linux USB stack altogether. The |
| 471 | kernel dmesg will look something like this, and you have to |
| 472 | upgrade the firmware using Windows: |
| 473 | usb 4-5: new high speed USB device using ehci_hcd and address 5 |
| 474 | usb 4-5: configuration #1 chosen from 1 choice |
| 475 | usb 4-5: can't set config #1, error -110 |
Linus Walleij | d132d8e | 2007-04-03 23:24:54 +0000 | [diff] [blame] | 476 | |
Linus Walleij | b715ba6 | 2008-02-12 23:41:49 +0000 | [diff] [blame] | 477 | |
Linus Walleij | d132d8e | 2007-04-03 23:24:54 +0000 | [diff] [blame] | 478 | Lost symbols |
| 479 | ------------ |
| 480 | |
| 481 | Shared libraries can be troublesome to users not experienced with |
| 482 | them. The following is a condensed version of a generic question |
| 483 | that has appeared on the libmtp mailing list from time to time. |
| 484 | |
| 485 | > PTP: Opening session |
| 486 | > Queried Creative Zen Vision:M |
| 487 | > gnomad2: relocation error: gnomad2: undefined symbol: |
| 488 | > LIBMTP_Get_Storageinfo |
| 489 | > (...) |
| 490 | > Are these type of errors related to libmtp or something else? |
| 491 | |
| 492 | The problem is of a generic nature, and related to dynamic library |
| 493 | loading. It is colloquially known as "dependency hell". |
| 494 | (http://en.wikipedia.org/wiki/Dependency_hell) |
| 495 | |
| 496 | The gnomad2 application calls upon the dynamic linker in Linux to |
| 497 | resolve the symbol "LIBMTP_Get_Storageinfo" or any other symbol |
| 498 | (ELF symbol, or link point or whatever you want to call them, a |
| 499 | symbol is a label on a memory address that the linker shall |
| 500 | resolve from label to actual address.) |
| 501 | For generic information on this subject see the INSTALL file and |
| 502 | this Wikipedia page: |
| 503 | |
| 504 | http://en.wikipedia.org/wiki/Library_(computing) |
| 505 | |
| 506 | When Linux /lib/ld-linux.so.X is called to link the symbols compiled |
| 507 | into gnomad2 (or any other executable using libmtp), it examines the |
| 508 | ELF file for the libmtp.so.X file it finds first and cannot resolve |
| 509 | the symbol "LIBMTP_Get_Storageinfo" (or whichever symbol you have a |
| 510 | problem witj) from it, since it's probably not there. There are many |
| 511 | possible causes of this symbol breakage: |
| 512 | |
| 513 | 1) You installed precompiled libmtp and gnomad2 packages (RPMs, debs |
| 514 | whatever) that do not match up. Typical cause: your gnomad2 package was |
| 515 | built against a newer version of libmtp than what's installed on your |
| 516 | machine. Another typical cause: you installed a package you found on |
| 517 | the web, somewhere, the dependency resolution system did not protest |
| 518 | properly (as it should) or you forced it to install anyway, ignoring |
| 519 | some warnings. |
| 520 | |
| 521 | 2) You compiled libmtp and/or gnomad2 from source, installing both or |
| 522 | either in /usr/local/lib and /usr/local/bin. This means at compile-time |
| 523 | gnomad2 finds the libmtp library in /usr/local/lib but at runtime, it |
| 524 | depends on the Linux system wide library loader (/lib/ld-linux.so.X) in |
| 525 | order to resolve the symbols. This loader will look into the file |
| 526 | /etc/ld.so.conf and/or the folder /etc/ld.so.conf.d in order to find |
| 527 | paths to libraries to be used for resolving the symbols. If you have |
| 528 | some older version of libmtp in e.g. /usr/lib (typically installed by a |
| 529 | package manager) it will take precedence over the new version you just |
| 530 | installed in /usr/local/lib and the newly compiled library in |
| 531 | /usr/local/lib will *not* be used, resulting in this error message. |
| 532 | |
| 533 | 3) You really did install the very latest versions (as of writing libmtp |
| 534 | 0.1.5 and gnomad2 2.8.11) from source and there really is no |
| 535 | pre-installed package of either on your machine. In that case I'm |
| 536 | totally lost, I have no idea what's causing this. |
| 537 | |
| 538 | Typical remedies: |
| 539 | |
| 540 | 1) If you don't want to mess around with your system and risk these |
| 541 | situations, only use pre-packaged software that came with the |
| 542 | distribution or its official support channels. If it still breaks, |
| 543 | blame your distribution, they're not packaging correctly. Relying on |
| 544 | properly packaged software and not installing things yourself *is* the |
| 545 | Linux solution to the "dependency hell" problem. |
| 546 | |
| 547 | 2) Read about dynamically linked library handling until the stuff I wrote |
| 548 | about in the previous list sounds like music to your ears, inspect |
| 549 | your /lib, /usr/lib, /usr/local/lib, /etc/ld.so.conf and the |
| 550 | /etc/ld.so.conf.d, remove all pre-packed versions using RPM, APT, |
| 551 | YaST or whatever your distribution uses, compile libmtp and gnomad2 |
| 552 | (or whatever) from source only and you will be enlighted. |
| 553 | |
| 554 | I don't know if this helps you, it's the best answer we can give. |