7231-4p_openwrt_视频监控
首页 > IT > Unix/Linux   作者:eehello  2014年7月11日 21:04 星期五  浏览:8931  字号:   评论:0 条
时间:2014-7-11 21:04   浏览:8931  评论:0 条 

536ba42058a408d2235b3a219b79f3d1.jpg



 因为家里离市区较远,所以治安并不是太好。想着在门口装一个视频监控,正好手里面有以前买的7231-4p,因openwrt的可扩展性强,于是就把原来的tomato刷成了openwrt,刷的最新的Attitude Adjustment 12.09版。

     估计我刷的是基本版吧?里面只有基本功能,连汉化都没有,跟中文论坛的各种汉化版比,功能貌似少很多啊。先设置好网络,使路由器能上网再说,然后就是安装中文包,在web界面里软件包管理里面有,名字就叫luci-i18n-chinese,详细步骤就不说了。

      家里正好还有一个闲置摄像头,叫小王子,估计是小牌子吧。因为固件不带usb管理,所以需要安装usb模块。

     首先声明,这不是教程,这只是我实践的记录而已。需要教程的请百度。

     1.ssh链接到路由器,安装usb驱动:

opkg install kmod-usb2
opkg install usbutils
opkg install libusb
mount -t usbfs none /proc/bus/usb/

   /** 

libusb是linux系统中,提供给用户空间访问usb设备的API,方便从linux内核中获取或设置usb设备的信息。lsusb这个用户空间程序,也正是依赖libusb提供的接口API来实现对系统当前的usb总线的扫描,从而显示当前系统存在的usb设备的。

 

在嵌入式linux中,输入lsusb命名,出现unable to initialize libusb: -99 或者没有任何输出(这个是对前面的一个bug的修复),主要的原因就是在于,在构建嵌入式linux系统的时候,对系统初始化设置不对,导致启动过程中没有挂载usbfs所致。解决办法就是在系统启动的过程中挂载usbfs。

如下命令可以完成:

mount -t usbfs none /proc/bus/usb/

更好的方法,将上面的命令写进启动脚本中,比如/etc/inittab或者/etc/init.d/rcS等。

    **/


但是还是出错,提示:mount: mounting none on /proc/bus/usb failed: Device or resource busy

原因就是我重复输了这条命令,

lsusb也是报错,经过多方搜索,最后才蛋疼的发现是这个固件少装的东西太多了。(参考自:http://www.eehello.com/?post=80)按着别人的教程走时却没考虑自己的硬件跟别人的不一样,7231的usb好像是1.1的,只装2.0的驱动肯定不行的,安装好下面的驱动就ok了

opkg install kmod-usb-ohci
opkg install kmod-usb-uhci
opkg install kmod-usb-storage
opkg install kmod-usb-storage-extras

输入lsusb后,设备清单终于出来了

blob.png


2014.7.13续写(实际上星期五就已经完成了,但是当时急于下班回家,所以写了一半就放这了,可能中间会有缺漏吧,毕竟隔了一天,貌似现在我的记性不大好......)


然后就是安装摄像头驱动了,我的摄像头主控芯片是松瀚SN9C210。

opkg install kmod-input-core
opkg install kmod-video-uvc
opkg install kmod-i2c-core
opkg install kmod-video-gspca-core
opkg install kmod-video-gspca-donixj  /** 不同型号的驱动也不同,详细请查看驱动列表 **/

然后输入

dmesg | grep usb

blob.png


看到有摄像头基本就ok了。

输入

ls /dev

如果有video0就一切正常,看别人的帖子,好像有人不会出这个,还好我的比较顺利。


最后就是安装监控端,参照别人帖子相装 Palantir ,却发现源里没有,无语。只好安装motion。

opkg install motion
vim /overlay/etc/motion.conf

我的编辑文件内容如下:

# Rename this distribution example file to motion.conf
#
# This config file was generated by motion "3.2.11.1"


############################################################
# Daemon
############################################################

# Start in daemon (background) mode and release terminal (default: off)
daemon off   #设置成off

# File to store the process ID, also called pid file. (default: not defined)
process_id_file /var/run/motion/motion.pid

############################################################
# Basic Setup Mode
############################################################

# Start in Setup-Mode, daemon disabled. (default: off)
setup_mode off

###########################################################
# Capture device options
############################################################

# Videodevice to be used for capturing   (default /dev/video0)
# for FreeBSD default is /dev/bktr0
videodevice /dev/video0

                                       
                                                                                 
# Image width (pixels). Valid range: Camera dependent, default: 352             
width 320   #(视频宽)                                                                      
                                                                                 
# Image height (pixels). Valid range: Camera dependent, default: 288             
height 240  #(视频高)                                                              
                                                                                 
                                                                        
                                                                     
                                                                                    

# Motion Detection Settings:
############################################################

# Threshold for number of changed pixels in an image that
# triggers motion detection (default: 1500)
threshold 1500  #这个是改变探测灵敏度,越小越灵敏
# Automatically tune the threshold down if possible (default: off)
threshold_tune off

# Noise threshold for the motion detection (default: 32)
noise_level 32

# Automatically tune the noise threshold (default: on)
noise_tune on







# Live Webcam Server
############################################################

# The mini-http server listens to this port for requests (default: 0 = disabled)
stream_port 8081   #远程端口
# Quality of the jpeg images produced (default: 50)
stream_quality 50

# Output frames at 1 fps when no motion is detected and increase to the
# rate given by webcam_maxrate when motion is detected (default: off)
stream_motion off

# Maximum framerate for webcam streams (default: 1)
stream_maxrate 1

# Restrict webcam connections to localhost only (default: on)
stream_localhost off       #必须改成off才能通过pc访问

# Limits the number of images per connection (default: 0 = unlimited)
# Number can be defined by multiplying actual webcam rate by desired number of seconds
# Actual webcam rate is the smallest of the numbers framerate and webcam_maxrate
stream_limit 0
target_dir /tmp/cam1       #保存目录,原文件里没有,自己添加的

############################################################
# HTTP Based Control
############################################################

# TCP/IP port for the http server to listen on (default: 0 = disabled)
control_port 8080

# Restrict control connections to localhost only (default: on)
control_localhost off #这个也得关

# Output for http server, select off to choose raw text plain (default: on)
control_html_output on

# Authentication for the http based control. Syntax username:password
# Default: not defined (Disabled)
; control_authentication username:password

##############################################################
# Thread config files - One for each camera.
# Except if only one camera - You only need this config file.
# If you have more than one camera you MUST define one thread
# config file for each camera in addition to this config file.
##############################################################

# Remember: If you have more than one camera you must have one
# thread file for each camera. E.g. 2 cameras requires 3 files:
# This motion.conf file AND thread1.conf and thread2.conf.
# Only put the options that are unique to each camera in the
# thread config files. 
thread /etc/thread1.conf
#thread /etc/thread2.conf
# thread /etc/thread3.conf
# thread /etc/thread4.conf   #如果有多个摄像头要使用这部分,否则全部注释掉


因为字符限制,上面只是把需要修改的地方写上了

修改好后,在/etc目录下 输入 motion -c motion.conf 


在PC上安装监控客户端程序“pclient”或 Firefox 。

输入地址:192.168.1.1:8081就会看到图像了。

只能用firefox看,chrome也看不成。因为是一张一张照片在拍,所以会感觉很卡。


差点忘了,附上我参考的帖子:http://www.openwrt.org.cn/bbs/forum.php?mod=viewthread&tid=2502&extra=page%3D1%26filter%3Ddigest%26digest%3D1&page=1



 您阅读这篇文章共花了: 
二维码加载中...
本文作者:eehello      文章标题: 7231-4p_openwrt_视频监控
本文地址:https://www.eehello.com/?post=78
版权声明:若无注明,本文皆为“点滴记忆---观雨亭”原创,转载请保留文章出处。

返回顶部| 首页| 手气不错| 留言板|后花园

Copyright © 2014-2023 点滴记忆---观雨亭