百度空间 | 百度首页 
 
查看文章
 
Ubuntu 6.10 安装后记[十三]-Linux下的摄像头(webcam)驱动配置+WEB远程监控 2007-4-5
2007-04-05 22:13
    Ubuntu 6.10 安装后记[十三]-Linux下的摄像头(webcam)驱动配置+WEB远程监控
  
     作者: http://hi.baidu.com/uroot      2007.4.5
    适用版本:Ubuntu 6.10
    7.04 ? 7.10? 8.04 TLS ?
    更新:8.04驱动配置成功。 For 8.04新驱动下载地址无法直接访问,请到 [Linux]webcam driver spca 5xxx 下载.

     Linux做桌面的最大乐趣就是:总有问题让你去解决,很有成就感。赫赫。我要把摄像头在Linux下用起来。于是乎Google了一下。好像需要用gspca 驱动就可以了,新立得里面的版本太低,到官方网站上下载一个最新版本试一下。
作者: http://hi.baidu.com/uroot      2007.4.5
1.下载驱动并安装

作者: http://hi.baidu.com/uroot      2007.4.5
http://mxhaard.free.fr/spca50x/Download/gspcav1-20070110.tar.gz

(此网站不能访问。请使用 Tor +Firefox torbutton) 。


tar xfz gspcav1-20070110.tar.gz
cd gspcav1-20070110
make
make install
depmod -a
modprobe gspca

检查一下,是不是已经加载了这个模块,如果出现如下信息,表明正常

lsmod |grep spca

spca5xx               637648 0
gspca                 652112 0
videodev               10752 2 spca5xx,gspca
usbcore               134912 7 spca5xx,gspca,usbhid,uhci_hcd,ehci_hcd,ohci_hcd


如果设备已经加载,应该有如下信息:

ls -lh /dev/video0
crw-rw---- 1 root video 81, 0 2007-04-06 19:59 /dev/video0




相关命令:
lshal - List devices and their properties Linux

lshal |grep WebCam
info.product = 'ZC0301 WebCam' (string)
usb_device.product = 'ZC0301 WebCam' (string)


lshal -s |grep usb
lsusb



2.安装SpcaView


http://mxhaard.free.fr/spca50x/Download/spcaview-20061208.tar.gz

编译spcaview需要libsdl,libsdl-dev 到新立得里装上。


make
make install 后
装在了/usr/local/bin目录下.
运行如下命令:
spcaview -d /dev/video0 -f jpg -s 320x240

是不是出现了一个视频窗口?
也可以 试试 cat /dev/video0 > pic.jpg

--------------------------------
正常工作的输出信息:

spcaview -d /dev/video0 -f jpg -s 320x240
Spcaview version: 1.1.7 date: 06:11:2006 (C) mxhaard@magic.fr
size width: 320 height: 240
Initializing SDL.
SDL initialized.
bpp 3 format 21
Using video device /dev/video0.
Initializing v4l.
**************** PROBING CAMERA *********************
Camera found: Z-star Vimicro zc0301p
Bridge found: ZC301-2
Bridge find ZC301-2 number 13
StreamId: JPEG Camera
wrong spca5xx device
Bridge find ZC301-2 number 13
Available Resolutions width 640 heigth 480 native
Available Resolutions width 352 heigth 288 decoded
Available Resolutions width 320 heigth 240 native *
Available Resolutions width 176 heigth 144 decoded
unable to probe size !!
*****************************************************
grabbing method default MMAP asked
VIDIOCGMBUF size 2457616 frames 2 offets[0]=0 offsets[1]=1228808
VIDIOCGPICT
brightnes=32768 hue=0 color=0 contrast=32768 whiteness=0
depth=8 palette=4
VIDIOCSPICT
brightness=32768 hue=0 color=0 contrast=32768 whiteness=0
depth=24 palette=21


Used 32461ms for 670 images => 48ms/image 20fps.
Quiting SDL.
Decoded frames:670 Average decode time: 11.000000
unmapping
closing
closed
Destroy Picture thread ...
Quiting....
---------------------------------------------------------------
3.常见错误
如果运行spcaview命令后出现如下错误信息:
spcaview -d /dev/video0 -f jpg -s 320x240
Spcaview version: 1.1.7 date: 06:11:2006 (C) mxhaard@magic.fr
size width: 320 height: 240
Initializing SDL.
SDL initialized.
bpp 3 format 21
Using video device /dev/video0.
Initializing v4l.
ERROR opening V4L interface
: No space left on device
.
参考地址中对此问题的解释和解决方案是:
Problem
When other USB devices are present on the same host controller bus as the camera, the bandwidth requirements of the spca5xx driver are not being met, with some hardware configurations. The spca5xx driver is asking for more bandwidth than is available which results in the following error messages:

No space left on device
can't open /dev/video0: No space left on device.


There is a very good howto for the Spca5xx driver at https://help.ubuntu.com/community/Spca5xx
if you haven't encountered the “No space left on device” error message.
-----------------------------------------------
Solutions
  1. Solution 1 - Put the camera on a separate USB host controller bus.
  2. Solution 2 - Compile and install the modified spca5xx source code.
  3. Solution 3 - Buy an separate USB controller card. (This is a last resort solution which I wanted to avoid at all cost.)
----------------------------------------------
说明:usb总线占用带宽不够,
让摄像头独占一个usb卡可以解决。如果无条件,可以参考参考地址中的方法2解决。因为我有个USB卡,所以,简单的让摄像头独占这个卡就解决了。

------------------------------------------------------------------


4.WEB远程监控
spcaserv -s 320x240 &
spcaserv -h
usage: cdse [-h -d -g ]
-h      print this message
-d      /dev/videoX       use videoX device
-g      use read method for grab instead mmap
-f      video format default yuv others options are r16 r24 r32 yuv jpg
-s      widthxheight      use specified input size
-w      port      server port
-p      /dev/partportX       use partportX device

----
spcaserv -s 320x240 &
[1] 27621
size width: 320 height: 240
Spcaview version: 1.1.7 date: 06:11:2006 (C) mxhaard@magic.fr
video /dev/video0
Camera found: Z-star Vimicro zc0301p
VIDIOCGPICT brightnes=32768 hue=0 color=0 contrast=32768 whiteness=0depth=24 palette=4
Bridge found: ZC301-2
is_spca SPCA505
is_spca SPCA506
is_spca SPCA501
is_spca SPCA508
is_spca SPCA504
is_spca SPCA500
is_spca SPCA504B
is_spca SPCA533
is_spca SPCA504C
is_spca SPCA561
is_spca SPCA536
is_spca SN9C102
is_spca ZR364XX
is_spca ZC301-2
wrong spca5xx device
StreamId: 0 Camera
try palette 21 depth 8
Couldnt set palette first try 21
Damned second try fail
try palette 15 depth 12
Available palette 15
try palette 4 depth 24
Available palette 4
try palette 3 depth 16
Available palette 3
try palette 5 depth 32
Available palette 5
probe size in
Available Resolutions width 640 heigth 480
Available Resolutions width 384 heigth 288
Available Resolutions width 352 heigth 288
Available Resolutions width 320 heigth 240
Available Resolutions width 192 heigth 144
Available Resolutions width 176 heigth 144
Format asked 15 check 8
VIDIOCSPICT brightnes=32768 hue=0 color=0 contrast=32768 whiteness=0depth=12 palette=15
VIDIOCGPICT brightnes=32768 hue=0 color=0 contrast=32768 whiteness=0depth=12 palette=15
grabbing method default MMAP asked
VIDIOCGMBUF size 2457616 frames 2 offets[0]=0 offsets[1]=1228808
Waiting .... for connection. CTrl_c to stop !!!!

----
netstat -na|grep 7070
tcp        0      0 0.0.0.0:7070            0.0.0.0:*               LISTEN
lsof -i:7070
COMMAND    PID USER   FD   TYPE DEVICE SIZE NODE NAME
spcaserv 27621 tank    4u IPv4 63823       TCP *:7070 (LISTEN)



配置httpd server
   cp -a http-java-applet ..../htdocs/cam
注:需要JAVA支持
cd .../htdocs/cam
cp index-sample.html index.html
chmod -R 755 *
访问 http://your ip/cam/
OK

5.参考地址:

Howto Fix the “No space left on device” error message and Install the Spca5xx driver
http://ubuntuforums.org/showthread.php?t=247646
http://ubuntuforums.org/archive/index.php/t-78370.html


6.FAQ:
https://help.ubuntu.com/community/Spca5xx



-----------------------------------------------------------------------------------------

相关链接:

[Linux]Ubuntu 8.04 手写板(Tablet WP5540U)驱动配置成功 2008.8.16
ubuntu 6.10 安装后记(九)-iPod和数码摄像机在Linux上的使用初探-gtkpod和kino视频采集

类别:linux/win/server | 添加到搜藏 | 浏览() | 评论 (1)
 
网友评论:
1
2008-05-31 23:11 | 回复
NND http://mxhaard.free.fr 被墙了?法国的?
 
发表评论:
姓 名:
网址或邮箱: (选填)
内 容:
验证码: 请点击后输入四位验证码,字母不区分大小写
      

     

©2009 Baidu