blob: efdba27a3a73836104bf95612d8749b0137bb3e8 [file] [log] [blame]
Linus Walleij0dd71e92006-05-04 18:47:07 +00001Building and Installing
2-----------------------
Linus Walleij6fd2f082006-03-28 07:19:22 +00003
Linus Walleij0dd71e92006-05-04 18:47:07 +00004See the "INSTALL" file.
5
6
7Heritage
8--------
9
10libmtp 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 Walleijfcf88912006-06-05 13:23:33 +000029 on before libmtp. When Linus took Richards initial port
Linus Walleij0dd71e92006-05-04 18:47:07 +000030 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
36Compiling programs for libmtp
37-----------------------------
38
39libmtp has support for the pkg-config script by adding a libmtp.pc
40entry in $(prefix)/lib/pkgconfig. To compile a libmtp program,
41"just" write:
42
43gcc -o foo `pkg-config --cflags --libs libmtp` foo.c
44
45This also simplifies compilation using autoconf and pkg-config: just
46write e.g.
47
48PKG_CHECK_MODULES(MTP, libmtp)
49AC_SUBST(MTP_CFLAGS)
50AC_SUBST(MTP_LIBS)
51
52To have libmtp LIBS and CFLAGS defined. Needless to say, this will
53only work if you have pkgconfig installed on your system, but most
54people have nowadays.
55
56If your library is installed in e.g. /usr/local you may have to tell
57this to pkgconfig by setting the PKG_CONFIG_PATH thus:
58
59export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
60
61
62Documentation
63-------------
64
65Read the API documentation that can be generated with doxygen.
66It will be output in doc/html if you have Doxygen properly
67installed. (It will not be created unless you have Doxygen!)
68
69For information about the Media Transfer Protocol, see:
70http://en.wikipedia.org/wiki/Media_Transfer_Protocol
71
72
73Contributing
74------------
75
76See the project page at http://libmtp.sourceforge.net/
Linus Walleijee73ef22006-08-27 19:56:00 +000077We always need your help. There is a mailinglist and a
78bug report system there.
Linus Walleij6fd2f082006-03-28 07:19:22 +000079
Linus Walleija1b66f22007-05-10 20:02:16 +000080
81New Devices
82-----------
83
Linus Walleijfcf88912006-06-05 13:23:33 +000084If you happen upon a device which libmtp claims it cannot
85autodetect, please submit the vendor ID and device ID
86as a bug, patch or feature request on the Sourceforge
Linus Walleijda558be2007-03-10 21:42:25 +000087bug tracker at our homepage. If it gives a sensible
88output from "mtp-detect" then please attach the result as
Linus Walleija1b66f22007-05-10 20:02:16 +000089well as it teach us some stuff about your device. If you've
90done some additional hacking, join our mailinglist and
91post your experiences there.
Linus Walleijda558be2007-03-10 21:42:25 +000092
Linus Walleija1b66f22007-05-10 20:02:16 +000093If you want to be able to hack some more and you're not
94afraid of C hacking, add an entry for your device's
95vendor/product ID and a descriptive string to the database
96in the file src/libusb-glue.c. It is close to the top of the
97file.
98
99If you want to poke around to see if your device has some
100special pecularities, you can test some special device
101flags (defined in src/libusb-glue.h) by inserting them
102together with your device entry in src/libusb-glue.c.
103Flags can be tested in isolation or catenated with "|"
104(binary OR). If relatives to your device use a certain
105flag, chances are high that a new device will need it
106too, typically from the same manufacturer.
107
108The most common flag that needs to be set is the
109DEVICE_FLAG_UNLOAD_DRIVER that detach any Linux kernel
110drivers that may have attached to the device making
111MTP access impossible.
112
113If your device is very problematic we are curious of how it
Linus Walleijda558be2007-03-10 21:42:25 +0000114works under Windows, so we enjoy reading USB packet sniffs
115that reveal the low-level traffic carried out between
116Windows Media Player and your device. This can be done
117using the trial version of HHD Softwares software-only
118USB monitor. You need to get a copy of version 2.37 since
119the newer trial versions won't let you carry out the
120needed packet sniffs. (As of 2007-03-10 a copy can be found
121at: http://www.cobbleware.com/files/usb-monitor-237.exe)
122There are other USB monitors as well, some more expensive
123alternatives use hardware and even measure electronic
124characteristics of the traffic (which is far too much
125detail for us).
126
Linus Walleija1b66f22007-05-10 20:02:16 +0000127If you are a device vendor, please consider assigning one
128of your employees as a contact person for libmtp, have them
129sign up to the libmtp development list and answer questions
130and post new device ID:s as they are released to our
131mailing list. By the way: do you have spare devices you
132can give us? Send them to Richard (Mac support) or Linus
133(Linux support). (So far nobody did that except for Microsoft
134who sent us a Zune by proxy!)
Linus Walleijfcf88912006-06-05 13:23:33 +0000135
Linus Walleij6fd2f082006-03-28 07:19:22 +0000136
Linus Walleij15def332006-09-19 14:27:02 +0000137Calendar and contact support:
138-----------------------------
Linus Walleijd3bdf762006-02-20 22:21:56 +0000139
Linus Walleij3c16fe42006-04-30 07:53:41 +0000140The Creative Zen series can read VCALENDAR2 (.ics) files
Linus Walleij15def332006-09-19 14:27:02 +0000141and VCard (.vcf) files from programs like for example
142Evolution with the following limitations/conditions:
Linus Walleijd3bdf762006-02-20 22:21:56 +0000143
Linus Walleij3c16fe42006-04-30 07:53:41 +0000144- The file must be in DOS (CR/LF) format, use the unix2dos
145 program to convert if needed
Linus Walleij15def332006-09-19 14:27:02 +0000146
147- Repeat events in calendar files do not seem to be supported,
148 entries will only appear once.
149
150- Calendar (.ics) files should be stored in the folder "My Organizer"
151 when sent to the device (this directory should be autodetected
Linus Walleij80b2c722006-06-22 17:57:17 +0000152 for use with calendar files, otherwise use the option
Linus Walleij15def332006-09-19 14:27:02 +0000153 -f "My Organizer" to sendfile for this) Apparently this file can
154 also contain tasklists.
155
156- Contact (.vcf) files should be stored in the folder "My Contacts"
157 when sent to the device. (-f "My Contacts")
158
159- Some devices are picky about the name of the calendar and
160 contact files. For example the Zen Microphoto wants:
161
Linus Walleijb1318d12006-09-25 14:59:26 +0000162 Calendar: My Organizer/6651416.ics
163 Contacts: My Organizer/6651416.vcf
164
165
166Syncing in with Evolution and Creative Devices
167----------------------------------------------
168
169Evolution can easily export .ics an .vcf files, but you currently
170need some command-line hacking to get you stuff copied over in
171one direction host -> device. The examples/ directory contains a script
172created for the Creative Zen Microphoto by Nicolas Tetreault.
173
Linus Walleij6e8cef42006-12-03 20:45:04 +0000174
175It's Not Our Bug!
176-----------------
177
178Some MTP devices have strange pecularities. We try to work around
179these whenever we can, sometimes we cannot work around it or we
180cannot test your solution.
181
182* The Zen Vision:M (possibly more Creative Zens) has a firmware bug
183 that makes it drop the last two characters off a playlist name.
184 It is fixed in later firmware.
185
Linus Walleijc41f2e82007-03-12 22:26:00 +0000186* For Creative Technology devices, there are hard limits on how
187 many files can be put onto the device. For a 30 GiB device (like
188 the Zen Xtra) the limit is 6000, for a 60 GiB device the limit
189 is 15000 files. For further Creative pecularities, see the
190 FAQ sections at www.nomadness.net.
191
Linus Walleijd24a7ab2007-03-07 21:48:43 +0000192* Sandisk sansa c150 and probably several other Sandisk devices
193 (and possibly devices from other manufacturers) have a dual
194 mode with MTP and USB mass storage. The device will initially
195 claim to be mass storage so udev will capture is and make the
Linus Walleijda558be2007-03-10 21:42:25 +0000196 use of MTP mode impossible. One way of avoiding it could be to
Linus Walleijd24a7ab2007-03-07 21:48:43 +0000197 be to blacklist the "usb-storage" module in
198 /etc/modprobe.c/blacklist with a row like this:
Linus Walleijda558be2007-03-10 21:42:25 +0000199 "blacklist usb-storage". Some have even removed the
200 "usb-storage.ko" (kernel module file) to avoid loading.
Linus Walleijd24a7ab2007-03-07 21:48:43 +0000201
Linus Walleijda558be2007-03-10 21:42:25 +0000202* The iriver devices (possibly all of them) cannot handle the
Linus Walleij6e8cef42006-12-03 20:45:04 +0000203 enhanced GetObjectPropList MTP command (0x9805) properly. So
204 they have been banned from using it.
205
Linus Walleijda558be2007-03-10 21:42:25 +0000206* iriver devices have problems with older versions of libmtp and
Linus Walleij82265222007-03-04 19:47:08 +0000207 with new devices libmtp does not know of as of yet, since it
208 has an oldstyle USB device controller that cannot handle zero
Linus Walleijda558be2007-03-10 21:42:25 +0000209 writes. (Register your device with us!) All their devices are
210 likely to need a special device flag in the src/libusb-glue.c
211 database.
Linus Walleij82265222007-03-04 19:47:08 +0000212
Linus Walleij6e8cef42006-12-03 20:45:04 +0000213* The Samsung Yepp T9 has several strange characteristics, some
214 that we've managed to work around. (For example it will return
215 multiple PTP packages in a single transaction.)
216
Linus Walleijf2711b32007-02-26 20:18:40 +0000217* The early firmware for Philips HDD players is known to be
218 problematic. Please upgrade to as new firmware as you can get.
219 (Yes this requires some kind of Windows Installation I think.)
220
Linus Walleij6e8cef42006-12-03 20:45:04 +0000221* Very few devices that implement GetObjectPropList (0x9805) will
222 return the entire object list if you request a list for object
223 0xffffffffu. (But they should.) So we're currently not using
224 that feature.
Linus Walleijd132d8e2007-04-03 23:24:54 +0000225
226
227Lost symbols
228------------
229
230Shared libraries can be troublesome to users not experienced with
231them. The following is a condensed version of a generic question
232that has appeared on the libmtp mailing list from time to time.
233
234> PTP: Opening session
235> Queried Creative Zen Vision:M
236> gnomad2: relocation error: gnomad2: undefined symbol:
237> LIBMTP_Get_Storageinfo
238> (...)
239> Are these type of errors related to libmtp or something else?
240
241The problem is of a generic nature, and related to dynamic library
242loading. It is colloquially known as "dependency hell".
243(http://en.wikipedia.org/wiki/Dependency_hell)
244
245The gnomad2 application calls upon the dynamic linker in Linux to
246resolve the symbol "LIBMTP_Get_Storageinfo" or any other symbol
247(ELF symbol, or link point or whatever you want to call them, a
248symbol is a label on a memory address that the linker shall
249resolve from label to actual address.)
250For generic information on this subject see the INSTALL file and
251this Wikipedia page:
252
253http://en.wikipedia.org/wiki/Library_(computing)
254
255When Linux /lib/ld-linux.so.X is called to link the symbols compiled
256into gnomad2 (or any other executable using libmtp), it examines the
257ELF file for the libmtp.so.X file it finds first and cannot resolve
258the symbol "LIBMTP_Get_Storageinfo" (or whichever symbol you have a
259problem witj) from it, since it's probably not there. There are many
260possible causes of this symbol breakage:
261
2621) You installed precompiled libmtp and gnomad2 packages (RPMs, debs
263 whatever) that do not match up. Typical cause: your gnomad2 package was
264 built against a newer version of libmtp than what's installed on your
265 machine. Another typical cause: you installed a package you found on
266 the web, somewhere, the dependency resolution system did not protest
267 properly (as it should) or you forced it to install anyway, ignoring
268 some warnings.
269
2702) You compiled libmtp and/or gnomad2 from source, installing both or
271 either in /usr/local/lib and /usr/local/bin. This means at compile-time
272 gnomad2 finds the libmtp library in /usr/local/lib but at runtime, it
273 depends on the Linux system wide library loader (/lib/ld-linux.so.X) in
274 order to resolve the symbols. This loader will look into the file
275 /etc/ld.so.conf and/or the folder /etc/ld.so.conf.d in order to find
276 paths to libraries to be used for resolving the symbols. If you have
277 some older version of libmtp in e.g. /usr/lib (typically installed by a
278 package manager) it will take precedence over the new version you just
279 installed in /usr/local/lib and the newly compiled library in
280 /usr/local/lib will *not* be used, resulting in this error message.
281
2823) You really did install the very latest versions (as of writing libmtp
283 0.1.5 and gnomad2 2.8.11) from source and there really is no
284 pre-installed package of either on your machine. In that case I'm
285 totally lost, I have no idea what's causing this.
286
287Typical remedies:
288
2891) If you don't want to mess around with your system and risk these
290 situations, only use pre-packaged software that came with the
291 distribution or its official support channels. If it still breaks,
292 blame your distribution, they're not packaging correctly. Relying on
293 properly packaged software and not installing things yourself *is* the
294 Linux solution to the "dependency hell" problem.
295
2962) Read about dynamically linked library handling until the stuff I wrote
297 about in the previous list sounds like music to your ears, inspect
298 your /lib, /usr/lib, /usr/local/lib, /etc/ld.so.conf and the
299 /etc/ld.so.conf.d, remove all pre-packed versions using RPM, APT,
300 YaST or whatever your distribution uses, compile libmtp and gnomad2
301 (or whatever) from source only and you will be enlighted.
302
303I don't know if this helps you, it's the best answer we can give.