--- /dev/null
+#!/bin/bash
+
+# this script is a wrapper around motion binary
+# that makes motion work with the uv4l raspi camera module
+
+MOTION_BIN=/usr/bin/motion
+UV4L_BIN=/usr/bin/uv4l
+JPEG_QUALITY=85
+
+function list_config_files() {
+ prev_arg=""
+ config_file=""
+ for arg in $*; do
+ if [ "$prev_arg" == "-c" ]; then
+ config_file=$arg
+ break
+ fi
+ prev_arg=$arg
+ done
+
+ if [ -r "$config_file" ];then
+ echo "$config_file"
+ cat motion.conf | grep thread | cut -d ' ' -f 2
+ fi
+}
+
+function find_resolution() {
+ width="640" # the defaults
+ height="480"
+
+ for file in $(list_config_files); do
+ w=$(cat "$file" | grep width | cut -d ' ' -f 2)
+ h=$(cat "$file" | grep height | cut -d ' ' -f 2)
+ if [ -n "$w" ] && [ -n "$h" ]; then
+ break
+ fi
+ done
+
+ echo $width $height
+}
+
+# find the configured resolution
+resolution=$(find_resolution)
+resolution=($resolution)
+
+# kill any previous uv4l instance
+pkill uv4l
+${UV4L_BIN} --driver raspicam --auto-video_nr --extension-presence 1 --sched-rr --width ${resolution[0]} --height ${resolution[1]} --encoding jpeg --quality $JPEG_QUALITY
+
+# start motion binary with preloaded .so
+export LD_PRELOAD=/usr/lib/uv4l/uv4lext/armv6l/libuv4lext.so
+exec ${MOTION_BIN} $*
--- /dev/null
+This folder is only meaningful for Raspberry PI devices used with the CSI camera board.
+
+1) make sure you have installed uv4l and uv4l-raspicam packages:
+ http://www.linux-projects.org/modules/sections/index.php?op=viewarticle&artid=14
+
+2) copy `motion' and `v4l2-ctl' scripts to /usr/local/bin;
+they serve as wrappers for their corresponding programs and will
+make the CSI camera work out of the box with motionEye:
+ sudo cp motion /usr/local/bin
+ sudo cp v4l2-ctl /usr/local/bin
+
+3) make the scripts executable:
+ sudo chmod +x /usr/local/bin/motion
+ sudo chmod +x /usr/local/bin/v4l2-ctl
+
--- /dev/null
+#!/bin/bash
+
+# this is a wrapper for v4l2-ctl that lists some custom resolutions
+# when called with --list-formats-ext for the raspi camera module
+
+V4L2_CTL_BIN=/usr/bin/v4l2-ctl
+
+if echo $* | grep -- '--list-formats-ext' > /dev/null; then
+ echo "ioctl: VIDIOC_ENUM_FMT"
+ echo -e "\tIndex : 0"
+ echo -e "\tType : Video Capture"
+ echo -e "\tPixel Format: 'YUYV'"
+ echo -e "\tName : YUV 4:2:2 (YUYV)"
+ echo -e "\t\tSize: Discrete 320x240"
+ echo -e "\t\tSize: Discrete 640x480"
+ echo -e "\t\tSize: Discrete 1024x768"
+ echo -e "\t\tSize: Discrete 1280x1024"
+
+ exit
+fi
+
+${V4L2_CTL_BIN} $*