If you have a USB webcam, it is very possible your hardware has at least some support in Linux. There are two ways of supporting USB devices in Linux. One is the more tradtional kernel support, and the other is through libusb. If you would prefer the more conventional kernel support for USB devices, go on to Section 2.1.2.
Libusb is a library that allows access to the USB functions in linux through userspace and without the need to enable kernel support and insert modules. Most distributions, at this point, are offering libusb in their stable branches (and some install it by default), so if you don't already have kernel support for USB devices, then you may only have to install the libusb package in order to access your device. You must have USB device filesystem support enabled in your kernel, which most distributions do. To find out for sure, issue the following at the command line:
$ cat /proc/filesystems |
You should see (among others):
nodev usbdevfs nodev usbfs |
You may need to mount usbdevfs to enable it and see the device files, which you can do at the command line with mount -t usbdevfs none /proc/bus/usb. Don't try to use libusb while your particular kernel webcam support is enabled either statically or the module loaded; you can only use one at at time.
You can obtain the libusb package in .rpm, .tgz or .deb format from your Linux distribution.
Kernel support is required for USB webcam support (if not using libusb). Your stock kernel may already have support for what you need and the way to tell is to use the dmesg command and look for an acknowledgement that the driver in question was loaded at bootup. In general, USB webcams require the module usbvideo to function. If you don't see it, the driver may be present (but not necessarily loaded) as a module. To find out, you can type the following at the command line:
$ ls -R /lib/modules/X.XX/kernel/drivers |
Where 'X.XX' is your kernel version number. The following output is an example of what you might find in a USB webcam-ready kernel, where everything is loaded as a module (though all but the relevant lines have been edited for brevity):
./usb: usbvideo.o usbcore.o ibmcam.o |
(A hint for newbies: if the info in dmesg or the above module list scrolls by too fast, you might try piping the output into 'less' (or 'more' if you don't have less): ls -R /lib/modules/X.XX/kernel/drivers | less or alternatively catching it in a file: ls -R /lib/modules/X.XX/kernel/drivers > file.txt, where 'file.txt' will contain the info that can then be accessed with cat [file] | less.)
If your kernel doesn't contain the necessary support, you can always recompile your kernel. If you are unfamiliar with the process of compiling your own kernel, I direct you to the Kernel HOWTO for more information.
For generic USB bus support in Linux, you will need USB subsystem support in your kernel, whether usb-ohci, usb-ehci, or whatever flavor of USB driver your system prefers. USB subsystem support has been present in the Linux kernel since the late 2.2 series. For a more in-depth discussion of USB support in general, I direct you to the linux-usb project site. If you want to find out which modules are loaded, at the command line or in an xterm, type the following:
# lsmod |
As shown by the prompt above, you will need to have root privileges to do this. You should get output similar to the following:
cdrom 29312 0 (autoclean) [sr_mod] usb-ohci 17888 0 (unused) usbcore 56768 0 [scanner ibmcam usbvideo usb-ohci] ibmcam 39680 0 |
If you don't have the particular module you're seeking loaded and you know you have it included as a module in your kernel, try loading it directly (using the usb ibmcam module as an example):
# modprobe -v ibmcam |
...at which point you should see something like the following:
Using /lib/modules/2.4.20/kernel/drivers/usb/ibmcam.o |
By placing the entry ibmcam (for example) in /etc/modules (note that this varies by distribution), you can have the module load at boot-time automatically. You can then confirm the module was loaded by checking the syslog or in the boot-time record with dmesg | less), where you should see an entry such as the following:
Oct 18 12:43:12 K7 kernel: hub.c: new USB device 00:02.3-2, assigned address 3 Oct 18 12:43:12 K7 kernel: ibmcam.c: IBM PC Camera USB camera found (model 2, rev. 0x030a) Oct 18 12:43:12 K7 kernel: usbvideo.c: ibmcam on /dev/video1: canvas=352x240 videosize=352x240 |
IEEE 1394 webcams require an IEEE 1394 PCI card in your computer for access. The IEEE interface has been supported in Linux since the early 2.4-series kernel. If you are lucky enough to own such a device, generic information on support of the IEEE 1394 bus in Linux can be found at www.linux1394.org. If you have a kernel older than 2.4.2, you will need to patch your kernel with one of the patches found on this page matched to your kernel version. In addition, you will require libraw1394. The previously referenced linux1394.org site has a great installation guide.
The IEEE1394 Digital Camera List, by Damien Douxchamps, offers an outstanding summary of the capabilities of IEEE 1394 cameras as well as the current status of support for individual models.
For 2.2 and 2.4 kernel systems, parallel-port support must be enabled statically or as a module (stock kernels usually have this enabled by default). You may want to read more generic info about parallel-port device support under the Linux kernel before starting this process. To find out for sure if the module parport is loaded, you can check the dmesg file or use lsmod as outlined above. Using dmesg | less, you should see (among many other lines) the following:
Mar 3 08:00:25 K7 kernel: parport0: PC-style at 0x378 (0x778) [PCSPP,TRISTATE] Mar 3 08:00:25 K7 kernel: parport0: irq 7 detected |
If you are compiling your own kernel, enable 'Parallel Port support'. You should enable 'IEEE 1284 transfer modes', and if you have x86 type architecture, you should also enable 'PC-style hardware'.
If modprobe returns an error when you attempt to load the module, note that you may need to determine and supply the hardware address when invoking modprobe. The most common address is 0x378 for an x86 system; 0x278 and 0x3BC are other possibilities for integrated or ISA parallel ports. Add-in PCI parallel ports may have unusual base addresses. You can also arrange multiple devices with either the parport_pc or parport_arc modules, though that topic is beyond the scope of this document. WARNING: Be sure you have the correct address before entering this information at the command line or else your machine may become unstable, crash or otherwise implode.
Your parallel port should be set to preferably "EPP" mode, or alternatively ECP/EPP. "Bidirectional" (also known as "BPP" or "PS/2") may work, albeit much more slowly. "Unidirectional" mode is unsuitable for scanning. The above setting can usually be accessed through your BIOS menu, at least on x86 systems.