Howto USB Webcam

http://www.foto-webcam.eu/wiki/tl-mr3020

http://barbara320.gotdns.com/openwrt/WR703N-setup-Digest/

mjpg_streamer --input "input_uvc.so --help":
MJPG Streamer Version: svn rev: exported
 ---------------------------------------------------------------
 Help for input plugin..: UVC webcam grabber
 ---------------------------------------------------------------
 The following parameters can be passed to this plugin:

 [-d | --device ].......: video device to open (your camera)
 [-r | --resolution ]...: the resolution of the video device,
                          can be one of the following strings:
                          QSIF QCIF CGA QVGA CIF VGA 
                          SVGA XGA SXGA 
                          or a custom value like the following
                          example: 640x480
 [-f | --fps ]..........: frames per second
 [-y | --yuv ]..........: enable YUYV format and disable MJPEG mode
 [-q | --quality ]......: JPEG compression quality in percent 
                          (activates YUYV format, disables MJPEG)
 [-m | --minimum_size ].: drop frames smaller then this limit, useful
                          if the webcam produces small-sized garbage frames
                          may happen under low light conditions
 [-n | --no_dynctrl ]...: do not initalize dynctrls of Linux-UVC driver
 [-l | --led ]..........: switch the LED "on", "off", let it "blink" or leave
                          it up to the driver using the value "auto"mjpg_streamer --output "output_http.so --help"

 ---------------------------------------------------------------
 Help for output plugin..: HTTP output plugin
 ---------------------------------------------------------------
 The following parameters can be passed to this plugin:

 [-w | --www ]...........: folder that contains webpages in 
                           flat hierarchy (no subfolders)
 [-p | --port ]..........: TCP port for this HTTP server
 [-c | --credentials ]...: ask for "username:password" on connect
 [-n | --nocommands ]....: disable execution of commands

mjpg_streamer --output "output_file.so --help"

 ---------------------------------------------------------------  Help for output plugin..: file output plugin  ---------------------------------------------------------------  The following parameters can be passed to this plugin: [-f | --folder ]........: folder to save pictures
[-m | --mjpeg ].........: save the stream to an mjpeg file
[-d | --delay ].........: delay after saving pictures in ms
[-s | --size ]..........: size of ring buffer (max number of pictures to hold)
[-e | --exceed ]........: allow ringbuffer to exceed limit by this amount
[-c | --command ].......: execute command after saving picture
[-i | --input ].........: read frames from the specified input plugin
# Quick OpenWRT setup on WR703N With mjpg-streamer webcam and Arduino Duemillanove (FTDI).


# - 1 - on Pc download and save
http://barbara320.gotdns.com/openwrt/openwrt-trunk-backup-8May2012-webcam-OK/openwrt-ar71xx-generic-tl-wr703n-v1-squashfs-factory.bin

http://192.168.1.1 admin admin .Last menu item 3rd from top is for flashing.

# after flashing it will reboot. Connect to PC via eth cable. Or solder serial cable 115200bps.
telnet 192.168.1.1

In future can also flash new version from command line 

cd /tmp
wget http://barbara320.gotdns.com/openwrt/openwrt-trunk-backup-8May2012-webcam-OK/openwrt-ar71xx-generic-tl-wr703n-v1-squashfs-factory.bin
mtd -r write openwrt-ar71xx-generic-tl-wr703n-v1-squashfs-factory.bin firmware

# If in future need to revert to fresh version do not need to reflash just type
firstboot



# -2- Next we setup network as dhcp client

cat <<EOT > /etc/config/network
config 'interface' 'loopback'
option 'ifname' 'lo'
option 'proto' 'static'
option 'ipaddr' '127.0.0.1'
option 'netmask' '255.0.0.0'

config 'interface' 'lan'
option 'ifname' 'eth0'
option 'type' 'bridge'
option 'proto' 'dhcp'
EOT


cat /etc/config/network

/etc/init.d/network restart

# connect to home router. USe IP scanner programm  to find address. Telnet.



# -3- We change sources to point to barbara server

cp /etc/opkg.conf /etc/opkg.conf.orig
cat <<EOT > /etc/opkg.conf
src/gz attitude_adjustment http://barbara320.gotdns.com/openwrt/openwrt-trunk-backup-8May2012-webcam-OK/packages/

dest root /
dest ram /tmp
lists_dir ext /var/opkg-lists
option overlay_root /overlay
EOT

cat /etc/opkg.conf



# -4- luci webinterface is installed  in original openwrt
opkg update
opkg install luci
/etc/init.d/uhttpd enable
/etc/init.d/uhttpd start



# -5- Arduino Duemillanove with FTDI USB-serial chip
opkg update
opkg install coreutils-stty  
opkg install kmod-usb-serial
opkg install kmod-usb-serial-ftdi
# a device should appear with plugged in Arduino
ls /dev/ttyUSB0


# -7- webcam streamer 
opkg update
opkg install kmod-video-core 
opkg install kmod-video-uvc 
opkg install mjpg-streamer
# a device should appear with plugged in webcam
ls /dev/video0



# -8- Download webserver files from barbara server. Check that they work via webbrowser.
cd /www/cgi-bin
wget http://barbara320.gotdns.com/webcamwr703nRiga/data/restore.sh
chmod 777 *
./restore.sh

# -9-
Add lines to crontab -e from file /www/cgi-bin/root
Add lines to /etc/rc.local from file rc.local

# -10- last go to Luci webinterface and set up wifi AP. 
# essentials, network, wifi, enable, save. 
OpenWRT WiFi newtwork should appear. Coonect to it from PC. 
It works like a bridge, gets dhcp server address from main router. So keep ethernet cable plugged in. 
Before playing with network settings Backup settings via webinterface to PC.



df -h 
#Filesystem                Size      Used Available Use% Mounted on
#rootfs                  832.0K    756.0K     156.0K  81% /
#practically very little space left