It seems like everybody serious is only using IP cameras with ZM. USB webcams are used mostly for testing or under some other hidden limitations (e.g. all USB cameras are UVC only or, of a certain model only).
Using multiple different USB cameras (moreover, mixed with the capture cards) reveal some serious limitations of USB subsystem. To overcome these issues, the installation must be rather cleanly planned and administered.
1. The computer should have plenty of USB cards/ports.
A NEC chipset based USB card seems to be able
to serve 2 UVC cameras 640x480 and one UVC
camera 352x288. One VIA chipset card seems to
serve one 640x480 cam or two 352x288 cams only.
(anbody knows how to exclude audio bandwith?)
2. Mixing USB card vendors (e.g. NEC and VIA) could cause
configuration problems later.
3. Seems like the gspca module is not yet mature enough
to serve more than 1 camera. The issue could
be related to the fact that brightness/contrast
controls are not working for particular cameras
or creating overload on an USB bus.
4. Be clean while defining Zonemaster monitors. Better
erase all defined monitors and then start from
scratch. If not - the previous values for
brightness/control settings start messing up.
The dark side is that ZM monitor could only be
removed together with all related events.
There is a need for "restore defaults" option.
5. The boot order: Zoneminder requires you maintain the
exact order of "/dev/video*" devices. Pityfully,
there exist no clean tools to specify the
loading order of USB cameras. It's much easier to
determine the actual loading order afterwards
(/var/log/messages, /proc/bus/pci/input).
Make cold boot tests to ensure that order will
remain the same at each boot.
To be more precise, there are three depending and interconnected layers:
I The lower one forms itself via kernel modules and results in /dev/video* devices.
II The middle layer assumes at least mjpg_streamer scripts be launched with proper arguments. The more heterogeneous are the video sources, the more complex will be this step.
III The upper layer is the ZM monitor definition layer which prescribes which video devices should be addressed directly and which are accessed via mjpg_streamer.
The complexity of relationship between these
3 layers is essential and it will actually
preclude the automatic launch of ZM via rc.d scripts.
To give one example only, launching mjpg_streamer
in YUV (not MJPG) mode for a wrong /dev/video*
device which has Logitech E3500 camera connected,
means that the camera will be limited to 176x144 size
until the next plug-in. Then, the plug-out with
the followed plug-in means that the starting
order of cameras (and corresponding /dev/video*
devices) will be different. This way, the restart of
the ZM server machine is needed to correct the
situation.
6. What is wrong with USB cameras? Kernel is considering
USB devices like very important ones (HID, etc)
and will try to load these first. However, for
a Zoneminder server, video capture cards (Bt8x8)
are firmly bolted into the computer case while USB
cameras are plugged in/out more frequently.
Thus, such modules booting order - USB cameras first,
video capture card later, is faulty for the
ZM purpose.
Actually there are two ways - blacklisting the
models and then loading them manually, or,
experimenting with the natural booting order
and trying not to change it later.
7. Init sequence. S20/K20 is a very strange choice for an
rc.d script (should be S20/S80 within Debian paradigm).
The situation is even more complex because other S20
scripts are running in parallel, causing processor
load and possibly interfering the loading order of
the modules. In my case, probing scsi boot disk
halves the uvcvideo recognition process.
8. The predictability of the loading sequence needs improving.
As an example, mjpg_streamer is to be launched only
after /dev/video* device has been formed and the
permissions verified on it, and not directly after
modprobing.
There are two possible ways - using return codes
or delays. There exist no delay feature while
automagically loading modules (we would like to
use "sleep 3" like in scripts). It is not much easier
to interface to automatical modprobes to get the
success codes from there...
This way, the loading model of USB modules is very
complex and dependant from side issues.





Having spent several days with the issue, I have to conclude
that there are two possible scenarious:
A) using modules blacklisting together with manual init
and not using the ehci_hcd module (the reason is
in how this module work with /proc). this way is
more suitable for uvcvideo/gspca mixed environment,
CIF capture size and Full (12M) speed USB.
B) carefully preparing the loading order of cameras. This
will need a lot of testing. More suitable with
ehci_hcd driver and for capture sizes like VGA or up
(480M, High Speed).