diff --git a/bootstrap/www/action b/bootstrap/www/action index de76c76..0728891 100755 --- a/bootstrap/www/action +++ b/bootstrap/www/action @@ -108,6 +108,10 @@ if [ -n "$F_cmd" ]; then echo "Rebooting device...
" /sbin/reboot ;; + poweroff) + echo "Powering off...
" + /sbin/poweroff + ;; telnetd) echo "Starting default telnetd (port 23)...
" start_telnetd diff --git a/bootstrap/www/cfg_rtsp b/bootstrap/www/cfg_rtsp new file mode 100644 index 0000000..c8be8e8 --- /dev/null +++ b/bootstrap/www/cfg_rtsp @@ -0,0 +1,73 @@ +#!/bin/sh + +echo "Content-type: text/html" +echo "" + +CMDLINE="`grep -m 1 "_server" /media/mmcblk0p2/data/etc/scripts/20-rtsp-server`" + +cat << EOF + + + +Fang Hacks + + + +

Configure RTSP

+
+ + + + + +
+
+
+ Command line:
+ +
+
Command line options:
+Availability of some options depends on the program/version that is installed
+        -A username:password: username and password for authentication
+        -Q length: Number of frame queue  (default 10)
+        ZXF options :
+        -D frame delay: Number of frames to delay  (default 0)
+        -R record thresh: Motion detection threshold to record (default -1, <0 for off)
+        -L record length: Number of frames to record per file (must be >= 10*fps)
+        -B record buffer: Number of frames to record prior to motion (must be <= 60)
+        RTSP options :
+        -u url     : unicast url (default unicast)
+        -m url     : multicast url (default multicast)
+        -M addr    : multicast group   (default is a random address)
+        -P port    : RTSP port (default 554)
+        -T port    : RTSP over HTTP port (default 0)
+        V4L2 options :
+        -F fps     : V4L2 capture framerate (default 30)
+        -i isp_fps : ISP capture framerate (default 30)
+        -W width   : V4L2 capture width (default 1280)
+        -H height  : V4L2 capture height (default 720)
+        V4L2 H264 options :
+        -b bitrate : V4L2 capture bitrate kbps(default 1024 kbps)
+        -g gop     : V4L2 capture gop (default 30 )
+        device     : V4L2 capture device (default /dev/video1)
+        V4L2 MJPEG options :
+        -j mjpeg_qp : MJPEG streaming and qp (default is 60)
+        -c capture path enable (default is disable)
+        -s encoder scale (1/2/4) (default is 1)
+        -a         : enable A-law pcm streaming
+EOF +#note: to display command line options, following works in shell but does not work in script, needs to be improved +#eval "$(grep -m 1 "_server" /media/mmcblk0p2/data/etc/scripts/20-rtsp-server | awk '{ print $1 }') -h" +cat << EOF +
+ + +EOF diff --git a/bootstrap/www/cfg_rtsp_save b/bootstrap/www/cfg_rtsp_save new file mode 100644 index 0000000..263cc4b --- /dev/null +++ b/bootstrap/www/cfg_rtsp_save @@ -0,0 +1,49 @@ +#!/bin/sh + +echo "Content-type: text/html" +echo "" + +cat << EOF + + + +Fang Hacks + + + +

Save RTSP Config

+
+ + + + + + +
+
+EOF +CMDLINE=$(echo $QUERY_STRING | sed 's/^.....//' | sed -e "s/\+/ /g" | sed -e "s/\%3E/>/g" | sed -e "s/\%26/\&/g" | sed -e "s/\%24/\$/g") +#don't save the file if it doesn't include _server in the command +if [ -z "${CMDLINE##*_server*}" ]; then + sed -i '/_server/c\'"$CMDLINE" /media/mmcblk0p2/data/etc/scripts/20-rtsp-server 2>&1 + echo "File saved, 20-rtsp-server script must be restarted for changes to take effect" +else + echo "error" +fi +cat << EOF +
+
+ +
+ + +EOF + diff --git a/bootstrap/www/network b/bootstrap/www/network index ec0f8a2..f75ac02 100755 --- a/bootstrap/www/network +++ b/bootstrap/www/network @@ -205,16 +205,20 @@ function apply_config() { function connect_ssid() { var ssid = document.getElementById('ssid_name').textContent; var enc = document.getElementById(ssid + '_ENC').value; - if (enc != "WPA") { alert("Sorry, " + enc + " encryption is not supported!"); return; } + if ((enc != "WPA") && (enc != "None")) { alert("Sorry, " + enc + " encryption is not supported!"); return; } var data = { action: 'connect', ssid: ssid, key: document.getElementById('ssid_key').value }; - if (data['key'].length >= 8 && data['key'].length <= 63) { + if ((data['key'].length >= 8 && data['key'].length <= 63) || (data['key'].length == 0 && enc == "None")) { postData('/cgi-bin/network', data); } else { - alert("Passphrase must be between 8 and 63 chars!"); + if (enc == "None") { + alert("Passphrase must be blank!"); + } else { + alert("Passphrase must be between 8 and 63 chars!"); + } } } diff --git a/bootstrap/www/status b/bootstrap/www/status index 0558ef1..bf7aad5 100755 --- a/bootstrap/www/status +++ b/bootstrap/www/status @@ -95,8 +95,10 @@ cat << EOF
+ +
diff --git a/data/etc/scripts/01-network b/data/etc/scripts/01-network index ad5c942..cc3d6a4 100755 --- a/data/etc/scripts/01-network +++ b/data/etc/scripts/01-network @@ -125,7 +125,7 @@ connect() do_connect() { # temporary connect to ssid - if [ -z "$2" -o -z "$3" ]; then + if [ -z "$2" ]; then echo "Usage: $0 connect [ssid] [passphrase]" return 1 fi @@ -133,6 +133,15 @@ do_connect() ctrl_interface=/var/run/wpa_supplicant update_config=1 EOF +echo "network={" >> /tmp/wpa_tmp.conf +printf "ssid=\"" >> /tmp/wpa_tmp.conf +echo "$2"\" | tr '+' ' ' >> /tmp/wpa_tmp.conf +if [ -z "$3" ]; then +echo "key_mgmt=NONE" >> /tmp/wpa_tmp.conf +else +echo "psk=\"$3\"" >> /tmp/wpa_tmp.conf +fi +echo "}" >> /tmp/wpa_tmp.conf if [ -e "/var/run/wpa_supplicant.pid" -o -d "/var/run/wpa_supplicant" ]; then echo "Terminating wpa_supplicant" killall wpa_supplicant @@ -141,6 +150,10 @@ EOF echo "Terminating udhcpc" killall udhcpc fi + if [ -e "/var/run/udhcpd.pid" ]; then + echo "Terminating udhcpd" + killall udhcpd + fi if pidof hostapd >/dev/null; then echo "Terminating hostapd" killall hostapd @@ -153,10 +166,15 @@ EOF if [ "$status" != "OK" ]; then echo "wpa_cli ssid failed: $status"; return 1; fi status="$(wpa_cli -iwlan0 set_network $id scan_ssid 1)" if [ "$status" != "OK" ]; then echo "wpa_cli scan_ssid failed: $status"; return 1; fi - status="$(wpa_cli -iwlan0 set_network $id key_mgmt WPA-PSK)" - if [ "$status" != "OK" ]; then echo "wpa_cli key_mgmt failed: $status"; return 1; fi - status="$(wpa_cli -iwlan0 set_network $id psk \"$3\")" - if [ "$status" != "OK" ]; then echo "wpa_cli psk failed: $status"; return 1; fi + if [ -z "$3" ]; then + status="$(wpa_cli -iwlan0 set_network $id key_mgmt NONE)" + if [ "$status" != "OK" ]; then echo "wpa_cli key_mgmt failed: $status"; return 1; fi + else + status="$(wpa_cli -iwlan0 set_network $id key_mgmt WPA-PSK)" + if [ "$status" != "OK" ]; then echo "wpa_cli key_mgmt failed: $status"; return 1; fi + status="$(wpa_cli -iwlan0 set_network $id psk \"$3\")" + if [ "$status" != "OK" ]; then echo "wpa_cli psk failed: $status"; return 1; fi + fi status="$(wpa_cli -iwlan0 enable_network $id)" if [ "$status" != "OK" ]; then echo "wpa_cli psk failed: $status"; return 1; fi else