Use Servfox and Spcaview to use WEBCAM in S3C2410 (applicable to zc301 chip cameras)

Source: Internet
Author: User

Source code download:
Http://www.mcuos.com/viewthread.php? Tid = 262 & extra = page % 3D1 & page = 1
Related questions:
Http://www.mcuos.com/viewthread.php? Tid = 256 & extra = & page = 1
Http://yuruxiao.blog.sohu.com/56584795.html
Http://blog.chinaunix.net/u/22630/showart_362806.html
Http://www.sduw.com/www/1/2007-09/99.html
Http://www.gd-emb.org/detail/id-46907.html

In the past few days, only the ov511 camera can be used on the Development Board. Therefore, webcam-server can be used to build an embedded video server. Now, the Development Board can use the camera of xingwei, so I want to play with this servfox. In fact, there is nothing to say about this. It is to down a servfox, and then compile it, it will all be OK ,:-).
How to use the application servfox and spcaview:

Summary:
(1) Spcaview can be either a collection side or an acceptor side. However, porting is a bit complicated. Therefore, use servfox as the collection end and port it to the arm. Modify the Makefile file in servfox, very simple, just change CC to arm-linux-gcc, SERVFLAGS =-O2-DLINUX $ (WARNINGS)-I/home/linux-2.4/include. Make.
(2) directly make Spcaview to generate the executable file spcaview.
(3) work now. On the Development Board, choose servfox-d/dev/video0-s 640x480-w 192.168.0.12: 7070.
On the PC, spcaview-w 192.168.0.12: 7070 can see the pictures collected by the camera. Servfox and spcaview also have many options, which can be viewed through spcaview-h and servfox-h.
I encountered two problems during the operation. First, the servfox device must be/dev/video0, And the/dev/v4l/video0 cannot be used directly. Why? No way, you have to satisfy it, that is, create a link. (Ln-s/dev/v4l/video0/dev/video0). The other is that I cannot use the mmap method. I must use the read method. Otherwise, the segment is incorrect. The solution is to add the parameter-g when running servfox.
The software package to be used:
Camera DRIVER:
Http://mxhaard.free.fr/spca50x/e... 31LE06.patch.tar.gz
Server video collection:
Http://mxhaard.free.fr/spca50x/e... rvfox-R1_0_0.tar.gz
Client-side video playback:
Ftp://ftp5.linuxeden.com/hardware/spcaview-20061208.tar.gz
Browser java plugs:
Http://software.lupaworld.com/da... linux-i586-rpm.bin
Refer to the post on the huaheng forum where mice are worn.

Learning Record 20070217 _ achieve arm acquisition image display on PC
My Environment
PC: FC5 for the operating system, 2.6.15 for the kernel, and 3.4.1 for the Cross Compiler
Development Board hardware: Yunfeng ruike's board, CPU is s3c2410
Development Board Software: bootloader is self transplanted u-boot, kernel is self transplanted 2.6.14.1, file system is self transplanted busybox-1.1.3
Let's talk about the overall idea first,
1. Transplant the camera driver
2. Port the server program
3. Compile the client program
1. Transplant the camera driver
Here the porting is spca5xx-le, there are a lot of articles about porting camera driver, there are 2.4 kernel, there are 2.6 kernel, I refer to this article
Http://www.ezso.cn/yyjysky/article.asp? Id = 47
Unlike him, I chose hot swapping from the very beginning.
Some errors occurred during the porting process. The most time-consuming error was a hardware problem. My Development Board had three USB ports and two main ports, one of which had a problem, after the camera is inserted, there is no response, and the other is normal. At first, I always put the camera on the outside Port, but I always didn't respond. Then I inserted the camera on the inside port.

2. Port the server program
I use servfox for server programs. download it from here.
Http://mxhaard.free.fr/spca50x/embedded/Servfox/servfox-R1_1_3.tar.gz
Download, decompress, go to the directory, and observe that no makefile exists, but there is a makefile. arm, and a makefile.386. Then, change makefile. arm to makefile, and enter the command
Make
The compilation is normal and there is no error. Copy the executable file servfox to the nfs shared directory, start the Development Board, mount the nfs server, and run servfox. If an error occurs, the system prompts you to find the command, I have encountered a similar problem in the past because the command is a dynamic link and there is no relevant library file on the Development Board, so it cannot be run and requires a static link.
Go back to the PC, open makefile, and add the parameter-static to all the places where arm-linux-gcc is used. In fact, there are three places.
Then recompile and run the command on the Development Board:
./Servfox-d/dev/video0-s 320x240-w 7070
The program is running, and the prompt is
Servfox version: 1.1.3 date: :2005 2005 (C)
Mxhaard@magic.fr
Wrong spca5xx device
Waiting... for connection. CTrl_c to stop !!!!
Got connection from 192.168.141.234
It may be a small error. Ignore it first.

3. Compile the client program
The client uses spcaview, which is:
Http://mxhaard.free.fr/spca50x/Download/spcaview-20061208.tar.gz
This program runs on a PC. After decompression, compile it directly,
Make
Generate the executable file spcaview and run it
./Spcaview-g-s 320x240-w 192.168.141.236: 7070
You can see the image, but the image is not clear. There is a screen and you can check it online. Someone has encountered the same problem and is running on the server (Development Board ).
./Servfox-d/dev/video0-s 320x240-w 7070
You can see the image.
You can also specify a resolution of 640x480, but it is not as smooth as 320x240.
I have encountered another problem in this step, that is, if the root user is used, there is no problem in running spcaview. However, if you use the cross-compiled user arm (for ease of compilation, an error occurs when an arm user is created.
Spcaview version: 1.1.7 date: (C)
Mxhaard@magic.fr
Size width: 320 height: 240
The using Server 192.168.141.236 Port 7070
Xlib: connection to ": 0.0" refused by server
Xlib: No protocol specified
Xlib: connection to ": 0.0" refused by server
Xlib: No protocol specified
Cocould not initialize SDL: No available video device.
I don't know why. I'm on hold for now. I will study it later.
The next step is to prepare a video server, so that you can directly view the image in the browser.
Contact me if you have any questions. Let's learn together. My mailbox is
Westdog@163.com

Based on the post posted on the Internet over the past two days, I have worked hard to find the required source code. The specific process is as follows:
1. Modify the drivers/usb/Makefile file
Obj-$ (CONFIG_USB_W9968CF) + = media/
Then add a row:
Obj-$ (CONFIG_USB_SPCA5XX) + = media/
2. Modify the drivers/usb/media/Kconfig file and add:
Config USB_SPCA5XX
Tristate "USB SPCA5XX Sunplus/Vimicro/Sonix jpeg Cameras"
Depends on USB & VIDEO_DEV
--- Help ---
Say Y or M here if you want to use one of these webcams:
The built-in microphone is enabled by selecting USB Audio support.
This driver uses the Video For Linux API. You must say Y or M
"Video For Linux" (under Character Devices) to use this driver.
Information on this API and pointers to "v4l" programs may be found
At.
To compile this driver as a module, choose M here:
Module will be called spca5xx.
3. Modify drivers/usb/media/Makefile and add:
Obj-$ (CONFIG_USB_SPCA5XX) + = spca5xx/
4. Create the spca5xx directory under the usb/media Directory
# Mkdir drivers/usb/media/spca5xx
5. Add the following files in drivers/usb/media/spca5xx:
Http://mxhaard.free.fr/spca50x/D
... 2.6.12.patch.tar.gz
Download
(1) cs2102.h
(2) hdcs2020.h
(3) hv7131b. h
(4), hv7131c. h
(5), icm105a. h
(6) Makefile
(7), Makefile.2.4
(8) Makefile.org
(9) pas106b. h
(10), pb0330.h
(11), sn9cxxx. h
(12), sp5xxfw2. dat
(13), sp5xxfw2. h
(14), spca5xx. h
(15), spcaCompat. h
(16), spca_core.c
(17) spcadecoder. c
(19) spcadecoder. h
(20) spcausb. h
(21), tas5130c. h
(22), zc3xx. h
6. Configure the kernel
(1) Multimedia devices --->
Video For Linux
(2) USB support --->
Support for Host-side USB
--- USB Host Controller Drivers
Ohci hcd support
(3) --- USB Multimedia devices
USB SPCA5XX Sunplus/Vimicro/Sonix jpeg Cameras
7. Compile the kernel and modules
# Make uImage
# Make modules
8. Copy the module file to the Development Board file system directory.
Walker/
Walker/module_file
The preceding two directories are manually created directories.
Cp drivers/media/video/v4l1-compat.ko/friendly-arm/rootfs_netserv/home/walker/module_file
Cp drivers/media/video/v4l2-common.ko/friendly-arm/rootfs_netserv/home/walker/module_file
Cp drivers/media/video/videodev. ko/friendly-arm/rootfs_netserv/home/walker/module_file
Cp drivers/usb/core/usbcore. ko/friendly-arm/rootfs_netserv/home/walker/module_file
Cp drivers/usb/media/spca5xx/spca5xx. ko/friendly-arm/rootfs_netserv/home/walker/module_file
9. Insert the USB camera into the Development Board (Note: you must first Insert the camera to insert the module File, otherwise the system will see the kernel oops)
10. Restart the Development Board.
11. Insert a module File (Note: The module insertion sequence must be noted here because of the module dependency)
/Sbin/insmod/home/walker/usbcore. ko
/Sbin/insmod/home/walker/ohci-hcd.ko
/Sbin/insmod/home/Walker/v4l1-compat.ko
/Sbin/insmod/home/Walker/v4l2-common.ko
/Sbin/insmod/home/Walker/videodev. Ko
/Sbin/insmod/home/Walker/spca5xx. Ko
Thank you again for writing this post in detail ..
It can be said that there is no problem. I don't know why I can't go to the French website. The source code mentioned above is from different forums in the east to the west. The file cannot be uploaded here. If you need the source code, you can send an email to me:
Dgw850329@126.com
Finally, I raised my own questions and hoped that experienced heroes could give some advice. My module loading was okay, and it was okay to run serfox after mknod/dev/video0 C 81 0, however, when the client is connected with spcaview, the system prompts that the device cannot be found. Why? I am using a cramfs file system, that is, a read-only file system. Why?
Thank you.

Oh, you can see the device node. I started to intentionally load less than one module. At this time, an error will occur when running servfox, but no error will occur when all my modules are added, you can also use CAT/dev/v4l/video0>/tmp/a.jpg to obtain the file. Therefore, it is determined that the driver is correct.
Because my host is a 2.4 kernel, and armlinux is a 2.6.1 kernel, it is not the same as trying it, so I didn't try it on the host .. Go to the Internet ..

I just went to dinner ..
This is the case. According to the previous post, the driver modules have been mounted ..
At this time, a server video collection program will be added, and the code I sent Will be servfox-r1_3_0.tar.gz.
After the code is decompressed, there is a makefile. arm, change this file to makefile, modify the cross compiler in makefile, make the file, and copy it to the/bin directory of my armlinux file system.
Mknod/dev/video0 C 81 0 create a device node ..
Servfox-G-d/dev/video0-W 7070 run the transplanted servfox in armlinux
The server is up now.
Client, I am in rh9. Remember, it must be in the X-Windows interface... the source code spcaview is used here. This is a good compilation, and make makeinstall is complete ..
Then run spcaview-g-W 192.168.0.1: 7070 on the client.
Excited... you see it ....

This time I talked about the problem of viewing on Web pages ..
Go to the spcaview installation directory on the host and check whether there is a directory called http-Java-applet.
We need to copy it to the BOA's main directory, that is, your DocumentRoot directory. But before doing this, we need to modify the permissions of this directory, chmod-r 755/home/spcaview/HTTP-Java-Applet, then start the boa server .. web Browser
Http://192.168.0.X/http-java-applet/index-sample.html
, You can see

If you display images on your website, others must constantly refresh to view new images ..
So there is a JwebPlayer program in the source program I provide. It is an applet that can be loaded to web pages to play video streams.

Thank you very much for solving this problem. Now you can see the video stream on the webpage.
The reason I couldn't see before was that the first time the website was set incorrectly, then the port in the program was inconsistent with./servfox.
However, the failure of a small application program fails, and the directory of .jarpackage and index-sample.html is not put in the same directory.
Thank you again ~~~

Required Software Package
Camera DRIVER:
Http://mxhaard.free.fr/spca50x/e
... 31LE06.patch.tar.gz
Server video collection:
Http://mxhaard.free.fr/spca50x/e
... Rvfox-R1_0_0.tar.gz
Client-side video playback:
Ftp://ftp5.linuxeden.com/hardware/spcaview-20061208.tar.gz
Browser java plugs:
Http://software.lupaworld.com/da
...-Linux-i586-rpm.bin
I. Hardware Platform:
2410 Development Board
Camera: zc301p
Ii. Software Platform:
ArmLinux
3. Drivers:
Compile the zc301 driver
The main idea is to re-compile the kernel and select the corresponding camera support module.
However, the Linux kernel does not contain the ZC301P camera driver. You need to download the corresponding kernel patch.
Http://mxhaard.free.fr/
There is a corresponding driver download, Which is used here:
Http://mxhaard.free.fr/spca50x/e
... 31LE06.patch.tar.gz. This patch is supported by the spcaxx series camera when re-encoding the kernel.
(1) copy it to/armlinux/kernel/driver/usb, decompress it, and patch it.
Tar-xvzf usb-2.4.31.patch.gz
Patch-p1
Make menuconfig in the kernel directory of arm linux,
First, select Video for linux under Multimedia device->,
Then, the USB support ---> USB Multimedia devices option should have
USB SPCA5XX Sunplus Vimicro Sonix Cameras, configure it as a module.
(3) make dep; make zImage; make modules. zImage will be generated under/armlinux/kernel/arch/arm/boot. This is the latest kernel we generated and downloaded to the Development Board through the terminal, /armlinux/kernel/driver/usb/spca5xx to generate spca5xx. o, spcadecoder. o, spca_core.o. this is what we want to drive.
(4) start with a new kernel. The three. o files insmod (you do not need to load spcadecoder. o), camera
The header is loaded successfully. You can also use the modprobe spca5xx. o command to automatically load the. o file to be supported.
If everything goes well, we will see information similar to the following,
Using/mydev/spca5xx. o
Usb. c: registered new driver spca5xx
Spca_core.c: USB SPCA5XX camera found. Type Vimicro Zc301P 0x301b
Spca_core.c: spca5xx driver 00.57.06LE registered
V4l/video0 is generated in/dev/, indicating that the camera is successfully installed.
4. Applications:
1. Transplant the video collection program servfox
Porting this program is the simplest, from
Http://mxhaard.free.fr/spca50x/e
... After the rvfox-R1_0_0.tar.gz is downloaded, decompress it and you will find a Makefile in its directory. arm file, change this file to Makefile, and then make to generate the serfox program we will use. Upload this program to our board and run it.
Before Running servfox, Run "mknod/dev/video0 c 81 0,
If you do not enter "mknod/dev/video0 c 81 0", the ERROR opening V4L interface ERROR occurs.
# Servfox-d/dev/video0-s 320x240-w 7070
Run servfox on the server. The image size is 320x240, and the port number is 7070.
2. Client spcaview
To
Ftp://ftp5.linuxeden.com/hardware/spcaview-20061208.tar.gz
Download spcaviev and make to generate the target file,
On the PC, spcaview-w 192.168.1.186: 7070 can see the pictures collected by the camera. Servfox and spcaview have many options, which can be viewed through spcaview-h and servfox-h.
Decompress the package and generate a WEB client. Upload the client to the WEB folder on the Development Board, and enter
Http: /192.168.1.186/index-sample.html
Then you can see the pictures collected by the camera.
The web SERVER port boa. The porting method is omitted.
3. Install jre in a web browser
1. Go here:
Http://software.lupaworld.com/da
...-Linux-i586-rpm.bin to download the latest self-extracting installation package, its self-extracting rpm package can not be directly used, or directly provide rpm package installation;
2. Run the following command:
Chmod + x./jre-1_5_0_09-linux-i586-rpm.bin
/Jre-1_5_0_09-linux-i586-rpm.bin
Press a space to view the following terms and enter yes. After installation is complete, proceed to the next step;
3. Go to the firefox/lugins directory (in my NeoShine-Linux,/usr/local/firefox/plugins) or ~ /. Mozilla/plugins:
Ln-s $ JAVA_HOME/jre/plugin/i386/ns7/libjavaplugin_oji.so ./
If the jre is installed, the command may be as follows:
Ln-s $ JAVA_HOME/plugin/i386/ns7/libjavaplugin_oji.so
If the jre is installed, it is the jre folder address.
This completes the installation. You can enter about: plugins in the address bar of firefox to check whether the installation is successful.
Create a connection in ~ /. Mozilla/plugins is placed under the current user. root permissions are not required and other users are not affected.
From the video effect, it is smoother and clearer, better than imagined.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.