~ubuntu-branches/debian/wheezy/libnjb/wheezy

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
INSTALLATION OVERVIEW
=====================

Once libnjb is built and installed, you will have the following files:

   $PREFIX/lib/libnjb.a		Static C library
   $PREFIX/lib/libnjb.so	Dynamic C library
   $PREFIX/include/libnjb.h	C header file for libnjb API

Sample programs will be built in the "sample" directory, and should
help you get used to using the libnjb API, as well as provide some
immediate gratification. Links to other programs using the libnjb
API may be found at the homepage: http://libnjb.sourceforge.net/


Shared Library Support
----------------------

Shared library linking is supported. You will need to 'make install' 
the library before you can execute the sample binaries, or add the 
libnjb src directory to your shared library search path (generally 
the LD_LIBRARY_PATH environment variable). For example:

  % export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib

To make this change permanent, in Linux you would add the line
"/usr/local/lib" to your "/etc/ld.so.conf" file and run the 
program "ldconfig" to scan in the new path. (This is part of
GNU C library actually.)

If you're building a bundled application for a distribution (like
a DEB or RPM package) consider linking libnjb statically. It is
not that big.


libusb Support
--------------

This package depends on libusb.  Get libusb from sourceforge at:

   http://www.sourceforge.net/projects/libusb/

Releases of FreeBSD prior to about 4.7-RELEASE had a conflicitng, native
library named libusb.a that is NOT the libusb required by this package.
libnjb is not supported on these older FreeBSD releaeses.


BASIC BUILD PROCEDURE
=====================

To build the package:

   % ./configure
   % make
   % make install


BSD-SPECIFIC NOTES
==================

In recent versions of FreeBSD, the default shell for root has been 
changed from /bin/sh to /bin/csh. This may cause troubles. Then run:

   % ./configure
   % make SHELL=/bin/sh
   % make install SHELL=/bin/sh

Under FreeBSD, /usr/local is not included in the default search path for
include and library files when using the compiler from the ports 
collection.  You must set the CPPFLAGS and LDFLAGS environment variables
prior to running configure:

  % setenv SHELL=/bin/sh
  % setenv CPPFLAGS=-I/usr/local/include
  % setenv LDFLAGS=-L/usr/local/lib
  % ./configure
  % make
  % make install

If you build your compiler yourself, then this may not be necessary.  It
may also not be necessary on NetBSD or OpenBSD.  If the build fails because
it cannot locate the libusb header file, however, the above may be needed.


LINUX-SPECIFIC NOTES
====================

You need to have libusb installed on your system, and libusb requires that
you have the usbdevfs filesystem mounted.  If you don't know how to do this,
see http://www.linux-usb.org/FAQ.html#gs3

Linux hotplugging
-----------------

After compilation and installation you may (and should) add hotplugging 
support by running the hotplug script, if your distribution supports
hotplugging. This typically means you have something in /etc/hotplug and that 
hotplugging is started when you boot your machine in a script named 
/etc/init.d/hotplug or similar.

Activate hotplugging by runinng:

   %./hotplug.sh


If you cannot run hotplugging
-----------------------------

If you have a distro without hotplugging enabled try this as root: 

  % chmod -R a+w /proc/bus/usb

You have to do this again every time you unplug/replug your USB cable 
or restart the jukebox, every time you quit libnjb and restart it, 
etc etc etc an alternative is to run libnjb as root which works just fine. 
The problem is to somehow assure that you (ie the current user) always 
has write access on  /proc/bus/usb/*


Other distributions hotplugging
-------------------------------

This is if you don't have hotplugging enabled and do not want to set it 
up on your machine either. You want to mount the usbfs manually.

     According to Tim Pepper, this should work in your 
     /etc/fstab:

     none  /proc/bus/usb  usbdevfs noauto,devmode=0666 0 0

You can find the Linux hotplug project at:
http://linux-hotplug.sourceforge.net/