summaryrefslogtreecommitdiffstats
path: root/scripts/rc.setup
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/rc.setup')
-rw-r--r--scripts/rc.setup163
1 files changed, 163 insertions, 0 deletions
diff --git a/scripts/rc.setup b/scripts/rc.setup
new file mode 100644
index 0000000..1cbeabc
--- /dev/null
+++ b/scripts/rc.setup
@@ -0,0 +1,163 @@
+#!/bin/zsh
+
+# this files initializes ivtv devices found
+# used inside ivysync.dyne module for initialisation
+# part of dyne:bolic GNU/Linux
+# GNU GPL v3 2006-2009 - Denis Jaromil Roio
+
+source /lib/dyne/utils.sh
+
+PATH=$PATH:/opt/$1/bin
+HOME=/root
+
+MOVIE=/opt/$1/firmware/v4l-cx2341x-init.mpg
+
+
+notice "Initializing IVTV devices"
+
+act "installing firmware"
+cp -ra /opt/$1/firmware/* /usr/lib/hotplug/firmware
+
+act "loading kernel module"
+loadmod videodev
+loadmod tveeprom
+loadmod v4l1_compat
+loadmod i2c_algo_bit
+loadmod cx2341x
+insmod /opt/$1/kernel/ivtv.ko
+
+act "detecting devices"
+
+
+#for i in 1 2 3 4; do
+# DEV="/dev/video`bc<<<$i+15`"
+# if [ -w "$DEV" ]; then
+# # kick the output devices
+# cat $MOVIE > "$DEV" & \
+# > /dev/null 2>&1
+# fi
+#done
+
+sync
+sleep 1
+sync
+
+#for pids in `ps ax|grep "$MOVIE"|awk '{print $1}'`; do
+# kill $pids > /dev/null 2>&1
+# sync
+#done
+
+# blank the screens
+ivtvfbctl /dev/fb0 --globalalpha=on --localalpha=off --alpha 0
+
+sync
+sleep 1
+sync
+
+# play test mpeg2
+for i in 1 2 3 4; do
+ DEV="/dev/video`bc<<<$i+15`"
+ if [ -w "$DEV" ]; then
+ echo " Video syncstarter device $i initialized"
+ chmod 666 "$DEV"
+# cat $MOVIE > "$DEV" &
+ fi
+done
+
+sync
+
+# setup input encoding
+### echo "Setting up video in devices 0, 1 & 2..."
+# -u 0: PAL
+# -f width=720,height=576(PAL)480(NTSC)
+# -p 0: tv-tuner input
+# -l 0: s-video and composite output
+# -c bitrate=8000000,bitrate_peak=16000000
+# -c stream_type=<#>
+# see ivtv.h IVTV_STREAM_* types (try 10 for DVD, or 0 for PS)
+
+act "setting up devices for PAL output"
+for i in 0 1 2 3; do
+ DEV="/dev/video${i}"
+ if [ -w "$DEV" ]; then
+
+ ivtvctl -d "$DEV" -p 0 -u 0 -l 0 -f width=720,height=576 \
+ -c bitrate=8000000,bitrate_peak=9000000,stream_type=10
+
+ sync
+
+ fi
+done
+
+action=`get_config ivysync`
+
+##################################
+############## run in single mode
+
+if [ "$action" = "run" ]; then
+ # setup $HOME to where we have saved the .ivysync playlists
+ HOME=/root
+ # loop indefinitely
+ while true; do
+
+ sync
+
+ ivysync-nox -d /dev/video16 -d /dev/video17 -d /dev/video18 -d /dev/video19 &
+
+ sleep 5
+
+ killall ivysync-nox
+
+ sleep 10
+
+ ivysync-nox -d /dev/video16 -d /dev/video17 -d /dev/video18 -d /dev/video19
+
+ done
+ # if loop ends then reboot
+ reboot
+fi
+
+##################################
+############## run in network mode
+if [ "`expr substr $action 1 3`" = "net" ]; then
+
+ while true; do
+
+ net="`echo $action | cut -d: -f2`"
+ if [ "`echo $action|cut -d: -f3`" = "master" ]; then
+ master=true
+ fi
+
+ # launches master
+ if [ "$master" = "true" ]; then
+ /root/offer-handshake.sh $net
+ else
+ /root/listen-handshake.sh $net
+ fi
+
+ sync
+
+ ivysync-udp -d /dev/video16 -d /dev/video17 -d /dev/video18 -d /dev/video19 &
+
+ sleep 3
+
+ if [ "$master" = "true" ]; then udpbroadcast 255.255.255.255 15500 a; fi
+
+ sleep 5
+
+ killall ivysync-udp
+
+ sleep 5
+
+ if [ "$master" = "true" ]; then
+ (sleep 5; udpbroadcast 255.255.255.255 15500 a )&
+ fi
+
+ ivysync-udp -d /dev/video16 -d /dev/video17 -d /dev/video18 -d /dev/video19
+
+ done
+ # if loop ends then reboot
+ reboot
+
+fi
+