blob: 951b4b986c9f56829925748e6da960cf6147c6b3 [file] [log] [blame]
Linus Walleij6c04caa2006-03-29 17:33:51 +00001INSTALLATION OVERVIEW
2=====================
3
Linus Walleij0dd71e92006-05-04 18:47:07 +00004Once libmtp is built and installed, you will have the following files
5($PREFIX is the --prefix option given to the "configure" script and
6defaults to /usr/local/):
Linus Walleij6c04caa2006-03-29 17:33:51 +00007
Linus Walleij0dd71e92006-05-04 18:47:07 +00008 $PREFIX/lib/libmtp.a Static C library
9 $PREFIX/lib/libmtp.so.x.y.z Dynamic C library
10 $PREFIX/lib/libmtp.so.x A link to the library
11 $PREFIX/lib/libmtp.so A link to the library
12 $PREFIX/include/libmtp.h C header file for libmtp API
13 $PREFIX/lib/pkgconfig/libmtp.pc pkg-config configuration file
Linus Walleij6c04caa2006-03-29 17:33:51 +000014
Linus Walleij0dd71e92006-05-04 18:47:07 +000015Sample programs will be built in the "example" directory, and should
16help you get used to using the libmtp API, as well as provide some
17immediate gratification. Links to other programs using the libmtp
18API may be found at the homepage: http://libmtp.sourceforge.net/
Linus Walleij6c04caa2006-03-29 17:33:51 +000019
Linus Walleij0dd71e92006-05-04 18:47:07 +000020Shared Library Support
21----------------------
22
23Shared library linking is supported. You will need to 'make install'
24the library before you can execute the sample binaries, and add the
25libmtp install directory to your shared library search path.
26
27On Linux, you would add the line "/usr/local/lib" to your
28"/etc/ld.so.conf" or as a oneliner in for example a
29"/etc/ld.so.conf.d/local.conf" file and run the
30program "ldconfig" to scan in the shared libraries at
31the new path. This is a part of the Linux shared library
32loader actually.
33
34To access the library from real odd locations you can use
35the LD_LIBRARY_PATH environment variable by setting it before
36you run your program, for example:
37
38 % export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
39 % my_program
40
41This way of enabling the library to link is a workaround hack.
42Note that the LD_LIBRARY_PATH is actually supposed to be used for
43testing, not production systems or distributions. It is commonly
44used as a workaround when a user is installing libraries in her/his
45home directory however. Read more about this environment variable
46here: http://www.visi.com/~barr/ldpath.html
47
48The shared library comes with different interface version numbers,
49for example libmtp.so.4, libmtp.so.5 and so forth. This is used so
50that both old and new libmtp libraries shall be able to coexist on
51the same system. When you compile your programs they will typically
52bind to the latest version of the shared library. A link to the
53latest version is always provided as $PREFIX/lib/libmtp.so.
54
55libusb Support
56--------------
57
58This package depends on libusb. Get libusb from sourceforge at:
59
60 http://www.sourceforge.net/projects/libusb/
61
Linus Walleij63a92582006-06-03 20:36:35 +000062On Linux, please use the very latest version you can get, between
630.1.8 and 0.1.12 a lot of things happened which pertains to
64the udev hotplugging support, see below.
65
Linus Walleij0dd71e92006-05-04 18:47:07 +000066
67BASIC BUILD PROCEDURE
68=====================
69
70To build the package:
71
72 % ./configure
73 % make
74 % make install
75
76By default, libmtp will add the program-prefix "mtp-" to all the
77example programs prior to installation. The program-prefix option
78makes libmtp sample programs avoid collision with other programs like
79sox' "play" program. On Linux you should then typically type (see
80below for details):
81
82 % ./hotplug.sh
83
84you can achieve the same with
85
86 % ./configure --enable-hotplugging
87
88you can turn off some speed enhancements (for testing) with:
89
90 % ./configure --no-turbo
91
92if you want to install the documentation type:
93
94 % make install-docs
95
96if you checked out the sources from CVS, you must first run the
97autogen.sh script that generates all the GNU autotools files.
98Notice that this requires GNU autoconf, automake and libtool. This
99is done with:
100
101 % ./autogen.sh
102
103
104Linux hotplugging
105-----------------
106
107After compilation and installation you may (and should) add hotplugging
108support by running the hotplug script, if your distribution supports
109hotplugging (all do). This typically means you have something
110in /etc/hotplug and that hotplugging is started when you boot your
111machine in a script named /etc/init.d/hotplug or similar.
112
113Activate hotplugging by running:
114
115 %./hotplug.sh
116
117Hotplug will (typically) use the device map file installed by hotplug.sh
118at /etc/hotplug/usb/libmtp.usermap to lift the device to userspace for the
119current user by running the script /etc/hotplug/usb/libmtp.sh. If
120you have the program "resmgr" installed (currently used only by SuSE to
121our knowledge) that program will be used for enabling desktop user
122access, otherwise the current user of the desktop will be determined
123from files in /var/run. (See the script "libmtp.sh" for details.)
124
125
126Linux udev hotplugging
127----------------------
128
129Newer Linux distributions have dropped support for the old hotplug system
130and rely solely on udev, and rules stored below /etc/udev/rules.d to
131handle permissions and actions on device connections. It's quite solid
132but the whole thing is rather shaky when it comes to such things as
133custom devices handled solely by libusb, which is what libmtp and for
134example SANE backends use.
135
136The libmtp.rules file that comes with libmtp can be used as a starter.
137
138First you need a crazy rule that creates a device node in the
139/dev/bus/usb hierarchy whenever any USB device is connected. The
140script has this at the top, you can comment it in if your
141distribution does not already create these device nodes.
142
143Then libusb may need to be patched to recognize this hierarchy.
144The 0.1.12 version is the first which is properly fixed.
145
146The script sets the device access to "666" which is rather nasty
147(not that big security issue, unless you think someone will break
148into your jukebox) some systems prefer to let PAM do this by placing
149a configuration file in /etc/security/ somewhere. See the Fedora Extras
150SRPM source package in case you're interested in how it is handled
151there.
152
153
154If you cannot run hotplugging
155-----------------------------
156
157If you have a distro without hotplugging enabled try this as root:
158
159 % chmod -R a+w /proc/bus/usb
160
161You have to do this again every time you unplug/replug your USB cable
162or restart the jukebox, every time you quit libnjb and restart it,
163etc etc etc an alternative is to run libmtp as root which works just fine.
164The problem is to somehow assure that you (ie the current user) always
165has write access on /proc/bus/usb/*
166
167You can find the Linux hotplug project at:
168http://linux-hotplug.sourceforge.net/