# HG changeset patch # User Christophe Lincoln # Date 1398501795 -7200 # Node ID 32e4a7121e8f333def0b4b0a4490bf47860b8f95 # Parent c10b9b20b9a5d158da04117b2bf59d0395792236 rpi: add Camera support in CG admin interface :-) diff -r c10b9b20b9a5 -r 32e4a7121e8f rpi/cgi-adm/plugins/rpi_cam/rpi_cam.cgi --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rpi/cgi-adm/plugins/rpi_cam/rpi_cam.cgi Sat Apr 26 10:43:15 2014 +0200 @@ -0,0 +1,69 @@ +#!/bin/sh +# +# TazBerry CGI Plugin - Raspberry Pi Camera tools web interface +# + +case " $(GET) " in + + *\ rpi_cam\ *) + html_header "PiCam" + export PATH="/opt/vc/bin:/bin:/usr/bin" + export LD_LIBRARY_PATH="/opt/vc/lib" + camdir="/var/www/adm/cam" + mkdir -p ${camdir} + + # CSS --> style.css + cat << EOT + +EOT + # Wen need VC Tools + if [ ! -x "/opt/vc/bin/raspivid" ]; then + echo "

VideoCore tools are missing. Please use tazberry \ + to setup the PiCam/NoIR

" && exit 0 + fi + + # raspivid + raspistill + case " $(GET rpi_cam) " in + *\ shot\ *) + notify "Executing raspistill..." + echo "$(GET options)" > ${camdir}/shot.opts + raspistill $(GET options) -o ${camdir}/shot.jpg + notify hide ;; + *\ rm_shot\ *) + rm -f ${camdir}/shot.jpg ;; + esac + + # Get last used options + if [ -f "${camdir}/shot.opts" ]; then + shot_opts="$(cat ${camdir}/shot.opts)" + else + shot_opts="--width 480 --height 320" + fi + + cat << EOT +

Raspberry Pi Camera

+ +
+
+ + + +
+
+ +EOT + # Display last shot + if [ -f "${camdir}/shot.jpg" ]; then + cat << EOT +

Latest shot

+
+ +

Remove

+
+ +EOT + fi + html_footer && exit 0 ;; +esac diff -r c10b9b20b9a5 -r 32e4a7121e8f rpi/cgi-adm/plugins/rpi_cam/rpi_cam.conf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rpi/cgi-adm/plugins/rpi_cam/rpi_cam.conf Sat Apr 26 10:43:15 2014 +0200 @@ -0,0 +1,6 @@ +# TazBerry CGI Plugin configuration + +PLUGIN="Raspberry Pi Camera" +SHORT_DESC="Raspberry PiCam and NoIR management." +MAINTAINER="pankso@slitaz.org" +WEB_SITE="http://arm.slitaz.org/rpi"