您现在的位置: 万盛学电脑网 >> 操作系统 >> Linux教程 >> 正文

Linux系统中如何正确安装摄像头驱动

作者:佚名    责任编辑:admin    更新时间:2022-06-22

class="21561">

  1、摄像头(Webcam)驱动说明;

  摄像头在Windows的驱动极为容易,最多是点几下鼠标,没有什么太大的难度。但在Linux中,驱动起来是有点困难,这并不是说Linux多高雅。只能说开发商唯利是图,没有好处的事,他们的确不怎么积极。Linux 的用户比较少,所以他们也不把用户当回事。

  目前看来摄像头(Webcam)在 Linux 中驱动基本成熟,缺少的是应用程序的支持,比如即时通讯工具支持视频的好程序比较少。有些芯片组是没有任何问题,在国内,大多摄像头的芯片组是Z-Star,也有显示为Vimmicro(和Z-Star是同样的芯片)的。在Fedora 5.0或SuSE 10.x中,已经支持了很多摄像头,应该说即插即用。对于我们来说,是不是即插即用,那是另一回事,只有幸运儿才有这个的福气。如果您的摄像头接上还是用不了,那您就有必要看一下我写的这个文档了。

  本文操作环境: Fedora Core 5.0 。由于大部份是用源码包编译 ,所以还是有通用性的;

  1.1 摄像头在Linux中是如何支持的;

  在 Linux中,硬件的驱动程序,都是由内核支持的;目前比较新内核版本也集成了一些的摄像头驱动。就是Fedora、SuSE最新版本所支持的内核也是来自由 kernel.org 。所以支持也是极为正常的。内核对硬件的支持分为内置于和外挂模块两种方便。对于摄像头来说,大多是模块支持的;

  1.2 摄像头(Webcam)驱动网址;

  http://mxhaard.free.fr

  目前最新版本的摄像头驱动,已经到了 spca5xx-20060501.tar.gz 版本;您可以在上面的地址下载;

  2、驱动摄像头详细过程;

  2.1 查看摄像头型号;

  我们用用到 lshal 工具,在老版本的Linux是没有这个工具的。在最新版本的Linux都有这个工具;

  [root@localhost ~]# lshal |grep WebCam

  info.product = 'ZC0303 WebCam' (string)

  usb_device.product = 'ZC0303 WebCam' (string)

  上面这个命令是列出系统硬件设备,然后从输出中,提取WebCam字样的信息。这说明这个摄像头是ZC0303芯片组的;如果想更详细的,就用下面的命令,找到带有ZC0303 WebCam设备的详细信息,就把所有USB设备都列出来;

  [root@localhost ~]# lshal |grep usb

  然后就找 ZC0303字样的设备 ,那一大段都要仔细的看;

  也可以这样的方法;

  [root@localhost ~]# lshal -s |grep usbusb_device_0_0_0000_00_1d_0usb_device_0_0_0000_00_1d_0_if0usb_device_4fc_3_noserialusb_device_4fc_3_noserial_if0usb_
device_4fc_3_noserial_if0_logicaldev_inputusb_device_4fc_3_noserial_usbrawusb_device_0_0_0000_00_1d_0_usbrawusb_device_
0_0_0000_00_1d_1usb_device_0_0_0000_00_1d_1_if0usb_device_ac8_303b_noserialusb_device_ac8_303b_noserial_if0usb_
device_ac8_303b_noserial_usbrawusb_device_ac8_303b_noserial_video4linuxusb_device_0_0_0000_00_1d_1_usbrawusb_
device_0_0_0000_00_1d_2usb_device_0_0_0000_00_1d_2_if0usb_device_0_0_0000_00_1d_2_usbrawusb_device_0_0_
0000_00_1d_7usb_device_0_0_0000_00_1d_7_if0usb_device_0_0_0000_00_1d_7_usbraw

  我们看到带有video4linux字样的,他的设备号是 usb_device_ac8_303b_noserial_video4linux字样的,在其前面还有几个差不多的编号的设备。比如 usb_device_ac8_303b_noserial。我们就先查这个设备,大多数这样的一组相似的设备号,查第一个就能知道是什么设备。于是用。。

  [root@localhost ~]# lshal -l -u usb_device_ac8_303b_noserial

  udi = '/org/freedesktop/Hal/devices/usb_device_ac8_303b_noserial'

  info.udi = '/org/freedesktop/Hal/devices/usb_device_ac8_303b_noserial' (string)

  linux.subsystem = 'usb' (string)

  linux.hotplug_type = 1 (0x1) (int)

  usb_device.bus_number = 3 (0x3) (int)

  usb_device.can_wake_up = false (bool)

  usb_device.is_self_powered = false (bool)

  usb_device.version_bcd = 272 (0x110) (int)

  usb_device.speed_bcd = 4608 (0x1200) (int)

  usb_device.linux.device_number = 2 (0x2) (int)

  usb_device.num_ports = 0 (0x0) (int)

  usb_device.max_power = 160 (0xa0) (int)

  usb_device.device_revision_bcd = 256 (0x100) (int)

  info.product = 'ZC0303 WebCam' (string)

  usb_device.product = 'ZC0303 WebCam' (string)

  info.vendor = 'Z-Star Microelectronics Corp.' (string)

  usb_device.vendor = 'Z-Star Microelectronics Corp.' (string)

  usb_device.product_id = 12347 (0x303b) (int)

  usb_device.vendor_id = 2760 (0xac8) (int)

  usb_device.device_protocol = 0 (0x0) (int)

  usb_device.device_subclass = 0 (0x0) (int)

  usb_device.device_class = 255 (0xff) (int)

  usb_device.num_interfaces = 1 (0x1) (int)

  usb_device.num_configurations = 1 (0x1) (int)

  usb_device.configuration_value = 1 (0x1) (int)

  usb_device.linux.sysfs_path = '/sys/devices/pci0000:00/0000:00:1d.1/usb3/3-1' (string)

  info.linux.driver = 'usb' (string)

  info.bus = 'usb_device' (string)

  info.parent = '/org/freedesktop/Hal/devices/usb_device_0_0_0000_00_1d_1' (string)

  linux.sysfs_path_device = '/sys/devices/pci0000:00/0000:00:1d.1/usb3/3-1' (string)

  linux.sysfs_path = '/sys/devices/pci0000:00/0000:00:1d.1/usb3/3-1' (string)

  这回应该详细了吧。看上面的设备是哪个厂出品的?

  usb_device.vendor_id = 2760 (0xac8) (int)

  usb_device.product_id = 12347 (0x303b) (int)

  info.product = 'ZC0303 WebCam' (string)

  info.vendor = 'Z-Star Microelectronics Corp.' (string)

  usb_device.product_id = 12347 (0x303b) (int)

  在Gnome桌面环境下,还用hal-gnome软件包工具可用;您可以通过下面的方式来安装此软件包

  [root@localhost ~]# yum install hal-gnome

  然后运行hal-device-manager工具;

  [root@localhost ~]# hal-device-manager

  点鼠标查看摄像头的详细信息还是没有问题吧。

  2.2 根据摄像头信息到驱动网站对号入座;

  请参见: http://mxhaard.free.fr/spca5xx.html

  请注意:这两个最重要的信息,也驱动网址摄像头芯片所对应地址对号入座,如果这张列表上没有摄像头,可能您得等一等了。不过也不是绝对的,给开发者捐赠一个不被支持的摄像头,肯定能解决。驱动开发者有捐赠主页,不妨捐一个看看。

  usb_device.vendor_id = 2760 (0xac8) (int)

  usb_device.product_id = 12347 (0x303b) (int)

  比如我的这款摄像头,在其网站上,显示为支持。

  2.3 摄像头驱动的选择;

  spca5xx-20060501.tar.gz

  对于Fedora Core 5.0 4.0 摄像头驱动RPM包:

  其实在Fedora Core 5.0 中已经有这款驱动的RPM包了,但我尝试后发现根本不能用。如果您也想尝试RPM包,请到下面的网址去下载;或用YUM在线安装也行,不过得设置YUM的源;

  http://mirrors.ircam.fr/pub/atrpms/fc5-i386/atrpms/RPMS.testing

  如果是Fedora 4.0的,就到下面的地址去下载;

  http://mirrors.ircam.fr/pub/atrpms/fc4-i386/atrpms/RPMS.testing/

  首先:要看自己的内核版本,然后再下载;

  [root@localhost ~]# uname -r -i

  其次:下载软件包选择;

  下载spca5xx开头的,要安装两个包左右,一个是 spca5xx-kmdl,另一个是 video4linux-kmdl,还有一个是 video4linux-kernheaders。根据软件包的时间、版本、内核版本对照下载安装。这方面不能说的太多。自己试试看,我是没有成功。

  2.4 下载并编译内核;

  由于RPM包安装上也不可用,所以我采用的是源码包安装的方法,当然因为我用的是比较新的内核,2.6.16.19。所以这个文档就是通用性了。源码包安装大多都差不多。所以其它发行版本也可以做为参考。

  2.41 下载内核;

  我测试摄像头所用的内的内核版本是 2.6.16.19;

  linux-2.6.16.19.tar.bz2

  下载内核配置文件:

  我从Slackware的FTP上,找到了2.6.16.19的配置文件。请到这里下载;kernel261619.txt

  2.42 编译内核;

  第一步:解压内核软件包;

  [root@localhost ~]# tar jxvf linux-2.6.16.19.tar.bz2

  [root@localhost ~]# mv linux-2.6.16.19 /usr/src

  把下载下来的内核配置文件改名复制到 /usr/src/linux-2.6.16.19

  [root@localhost ~]# cp kernel261619.txt /usr/src/linux-2.6.16.19/.config

  第二步:编译内核;

  [root@localhost ~]# cd /usr/src/linux-2.6.16.19/

  [root@localhost linux-2.6.16.19]# make

  [root@localhost linux-2.6.16.19]# make modules_install

  [root@localhost linux-2.6.16.19]# make install

  第三步:查看/boot/