Index: /ipk/source/emus_mgcamd_1_35/CONTROL/control
===================================================================
--- /ipk/source/emus_mgcamd_1_35/CONTROL/control	(revision 1856)
+++ /ipk/source/emus_mgcamd_1_35/CONTROL/control	(revision 1856)
@@ -0,0 +1,10 @@
+Package: enigma2-plugin-emus-mgcamd1.35
+Version: 1.35
+Architecture: sh4
+OE: mgcamd 1.35
+Section: extra
+Priority: optional
+Maintainer: AAF
+Homepage: http://www.aaf-digital.info
+Source: http://www.aaf-digital.info
+Description: mgcamd1.35
Index: /ipk/source/emus_mgcamd_1_35/CONTROL/postinst
===================================================================
--- /ipk/source/emus_mgcamd_1_35/CONTROL/postinst	(revision 1856)
+++ /ipk/source/emus_mgcamd_1_35/CONTROL/postinst	(revision 1856)
@@ -0,0 +1,43 @@
+#!/bin/sh
+TMP=/tmp/.mgcamd
+PLUGINDIR=/var/emu
+CONFIGDIR=/var/etc
+
+if [ ! -e /var/keys/mg_cfg ]; then
+	echo "renaming mg_cfg.mgcamd -> mg_cfg"
+	mv /var/keys/mg_cfg.mgcamd /var/keys/mg_cfg
+fi
+if [ ! -e /var/keys/peer.cfg ]; then
+	echo "renaming peer.cfg.mgcamd -> peer.cfg"
+	mv /var/keys/peer.cfg.mgcamd /var/keys/peer.cfg
+fi
+if [ ! -e /var/keys/ignore.list ]; then
+	echo "renaming ignore.list.mgcamd -> ignore.list"
+	mv /var/keys/ignore.list.mgcamd /var/keys/ignore.list
+fi
+if [ ! -e /var/keys/newcamd.list ]; then
+	echo "renaming newcamd.list.mgcamd -> newcamd.list"
+	mv /var/keys/newcamd.list.mgcamd /var/keys/newcamd.list
+fi
+if [ ! -e /var/keys/cccamd.list ]; then
+	echo "renaming cccamd.list.mgcamd -> cccamd.list"
+	mv /var/keys/cccamd.list.mgcamd /var/keys/cccamd.list
+fi
+if [ ! -e /var/keys/priority.list ]; then
+	echo "renaming priority.list.mgcamd -> priority.list"
+	mv /var/keys/priority.list.mgcamd /var/keys/priority.list
+fi
+if [ ! -e /var/keys/replace.list ]; then
+	echo "renaming replace.list.mgcamd -> replace.list"
+	mv /var/keys/replace.list.mgcamd /var/keys/replace.list
+fi
+
+echo "successfully installed"
+echo "syncing disk"
+sync
+if [ `df | grep /dev/mtdblock | grep var | sed 's/ \+/ /g' | cut -d ' ' -f4 | tail -n1 | wc -l` -eq 1 ]; then
+	SPACE=`df | grep /dev/mtdblock | grep var | sed 's/ \+/ /g' | cut -d ' ' -f4 | tail -n1`
+	FREE=`expr $SPACE - 100`
+	echo new freespace size $FREE kb
+fi
+exit 0
Index: /ipk/source/emus_mgcamd_1_35/CONTROL/postrm
===================================================================
--- /ipk/source/emus_mgcamd_1_35/CONTROL/postrm	(revision 1856)
+++ /ipk/source/emus_mgcamd_1_35/CONTROL/postrm	(revision 1856)
@@ -0,0 +1,11 @@
+#!/bin/sh
+TMP=/tmp/.mgcamd
+echo "successfully removed"
+echo "syncing disk"
+sync
+if [ `df | grep /dev/mtdblock | grep var | sed 's/ \+/ /g' | cut -d ' ' -f4 | tail -n1 | wc -l` -eq 1 ]; then
+	SPACE=`df | grep /dev/mtdblock | grep var | sed 's/ \+/ /g' | cut -d ' ' -f4 | tail -n1`
+	FREE=`expr $SPACE - 100`
+	echo new freespace size $FREE kb
+fi
+exit 0
Index: /ipk/source/emus_mgcamd_1_35/CONTROL/preinst
===================================================================
--- /ipk/source/emus_mgcamd_1_35/CONTROL/preinst	(revision 1856)
+++ /ipk/source/emus_mgcamd_1_35/CONTROL/preinst	(revision 1856)
@@ -0,0 +1,32 @@
+#!/bin/sh
+#
+TMP=/tmp/.mgcamd
+echo "syncing disk"
+sync
+
+if [ `df | grep /dev/mtdblock | grep var | sed 's/ \+/ /g' | cut -d ' ' -f4 | tail -n1 | wc -l` -eq 1 ]; then
+	SPACE=`df | grep /dev/mtdblock | grep var | sed 's/ \+/ /g' | cut -d ' ' -f4 | tail -n1`
+	FREE=`expr $SPACE - 100`
+	SIZE=550
+	echo "checking freespace"
+	echo packege size $SIZE kb
+	echo freespace size $FREE kb
+	if  [ "$FREE" -lt "$SIZE" ]; then
+		echo "sorry no freespace left on device"
+		exit 1
+	else
+		echo ok
+	fi
+fi   
+echo "installing mgcamd ..."
+echo "checking OS"
+if  [ `cat /etc/motd | grep AAF | grep M | grep rev | wc -l` -eq 0 ]; then                      
+	echo ---------------------------
+	echo DONT USE this IPK Package!!
+	echo ---
+	echo Only for AAF Image!!
+	echo ---------------------------
+	exit 1
+fi
+
+exit 0
Index: /ipk/source/emus_mgcamd_1_35/CONTROL/prerm
===================================================================
--- /ipk/source/emus_mgcamd_1_35/CONTROL/prerm	(revision 1856)
+++ /ipk/source/emus_mgcamd_1_35/CONTROL/prerm	(revision 1856)
@@ -0,0 +1,32 @@
+#!/bin/sh
+#
+TMP=/tmp/.mgcamd
+echo "syncing disk"
+sync
+if [ `df | grep /dev/mtdblock | grep var | sed 's/ \+/ /g' | cut -d ' ' -f4 | tail -n1 | wc -l` -eq 1 ]; then
+	SPACE=`df | grep /dev/mtdblock | grep var | sed 's/ \+/ /g' | cut -d ' ' -f4 | tail -n1`
+	FREE=`expr $SPACE - 100`
+	echo freespace size $FREE kb
+fi
+echo "removing mgcamd"
+if [ ! -e /var/keys/mg_cfg.mgcamd ]; then
+	echo "renaming mg_cfg -> mg_cfg.mgcamd"
+	mv /var/keys/mg_cfg /var/keys/mg_cfg.mgcamd
+fi
+if [ ! -e /var/keys/ignore.list.mgcamd ]; then
+	echo "renaming ignore.list -> ignore.list.mgcamd"
+	mv /var/keys/ignore.list /var/keys/ignore.list.mgcamd
+fi
+if [ ! -e /var/keys/newcamd.list.mgcamd ]; then
+	echo "renaming newcamd.list -> newcamd.list.mgcamd"
+	mv /var/keys/newcamd.list /var/keys/newcamd.list.mgcamd
+fi
+if [ ! -e /var/keys/priority.list.mgcamd ]; then
+	echo "renaming priority.list -> priority.list.mgcamd"
+	mv /var/keys/priority.list /var/keys/priority.list.mgcamd
+fi
+if [ ! -e /var/keys/replace.list.mgcamd ]; then
+	echo "renaming replace.list -> replace.list.mgcamd"
+	mv /var/keys/replace.list /var/keys/replace.list.mgcamd
+fi
+exit 0
Index: /ipk/source/emus_mgcamd_1_35/var/etc/mgcamd.emu
===================================================================
--- /ipk/source/emus_mgcamd_1_35/var/etc/mgcamd.emu	(revision 1856)
+++ /ipk/source/emus_mgcamd_1_35/var/etc/mgcamd.emu	(revision 1856)
@@ -0,0 +1,4 @@
+emuname  =mgcamd_1.35
+binname  =mgcamd
+startcam =/var/bin/mgcamd
+stopcam  =killall -9 mgcamd
Index: /ipk/source/emus_mgcamd_1_35/var/keys/cccamd.list.mgcamd
===================================================================
--- /ipk/source/emus_mgcamd_1_35/var/keys/cccamd.list.mgcamd	(revision 1856)
+++ /ipk/source/emus_mgcamd_1_35/var/keys/cccamd.list.mgcamd	(revision 1856)
@@ -0,0 +1,1 @@
+C: 172.16.1.1 12000 user1 pass1
Index: /ipk/source/emus_mgcamd_1_35/var/keys/ignore.list.mgcamd
===================================================================
--- /ipk/source/emus_mgcamd_1_35/var/keys/ignore.list.mgcamd	(revision 1856)
+++ /ipk/source/emus_mgcamd_1_35/var/keys/ignore.list.mgcamd	(revision 1856)
@@ -0,0 +1,12 @@
+# ignore irdeto chids, nova example:
+I: { 00 28 }
+I: { 00 15 }
+I: { 00 13 }
+# ignore viaccess providers
+V: { 02 0A 10}
+V: { 02 0A 20}
+# ignore seca providers
+S: { 00 72 }
+S: { 00 84 }
+# ignore caids
+X: { 06 26 }
Index: /ipk/source/emus_mgcamd_1_35/var/keys/mg_cfg.mgcamd
===================================================================
--- /ipk/source/emus_mgcamd_1_35/var/keys/mg_cfg.mgcamd	(revision 1856)
+++ /ipk/source/emus_mgcamd_1_35/var/keys/mg_cfg.mgcamd	(revision 1856)
@@ -0,0 +1,135 @@
+# EMM messages
+#    00 don't show any EMMs (default)
+#    01 show only valid EMMs
+#    02 show valid and bad EMMs with complete data display
+M: { 00 }
+
+# ECM messages
+#    00 don't show anything about ecm
+#    01 normal mode, show pids processed, decoded ecm and cw
+#    02 verbose mode, show valid and bad ECMs with data
+C: { 01 }
+
+# AU
+#    00 disable, no emm pids processed
+#    01 enable, emm pids always processed for soft-au and shared cards
+#    02 auto, emm started only if channel cant be decoded
+#    03 process emm pids for network cards update only
+A: { 01 }
+
+# key update (sum 01 or 02 with 04)
+#    01 update only new keys, default setting
+#    02 update all keys (used for valid PMK checking)
+#    04 enable TPS au
+#    + tps SID, which pmt pid contains au pid
+U: { 01 } 0x12c0
+
+# config files folder (softcam, autoroll, ignore/priority)
+#    00 files in /var/keys
+#    01 files in /tmp
+T: { 00 }
+
+# network mode, use summ for several clients
+#    00 no network (default)
+#    01 newcamd netclient
+#    02 radegast netclient
+#    04 camd3 netclient
+#    08 gbox netclient
+#    32	cccamd netclient, card list saved as /tmp/cccamd.info 
+#    	(ECM only, supported server version up to 2.1.1, later not work)
+G: { 32 }
+
+# network retry, use summ for several options
+#    00 disable
+#    01 retry every new ecm
+#    02 try to connect to offline shares every Q: seconds
+#    04 try to detect and fast reconnect to lost (and not used atm) server
+#    + XX messages number and YY seconds to reconnect
+#    mg will reconnect to server, if no answer to last XX ecm/keepalive or
+#    if no answer for last ecm or keepalive sent for YY seconds
+#    set to 0 to disable
+N: { 07 } 5 30
+
+# network ecm timeout in seconds
+K: { 05 }
+
+# newcamd dead routes connect retry, sec
+Q: { 600 }
+
+# network shares priority
+# 00 gbox, newcamd, cccamd, radegast, camd3 (default)
+# 01 camd3, radegast, cccamd, gbox, newcamd
+# 02 cccamd, newcamd, camd3, gbox, radegast
+P: { 02 }
+
+# on screen display type
+#    00 No OSD (default)
+#    01 neutrino
+#    02 enigma
+#    03 relook
+#    + user password for http auth
+O: { 01 } root newcs
+
+# on screen display Options, summ of:
+#    01 show emu ecm 
+#    02 show network shares messages
+#    04 show decoding failed / fta
+#    08 show emm keys update
+#    + web port to use for osd
+S: { 03 } 8080
+
+# Log option, summ of:
+#    00 off
+#    01 network udp log
+#    02 log to console
+#    04 file, appended ! delete it by yourself, before it eat all your hdd
+#    + IP udp-port log-file-name
+L: { 02 } 127.0.0.1 28007 /tmp/mgcamd.log
+
+# keep ecm cache, seconds
+# every cache entry takes 28 bytes, so 24h cache will take *only* 240-400kb of memory,
+# for openbox/elanvision users with remote shares make sense to set it higher than default value, 
+# to not hammer cards while timeshifting or playing crypted recordings.
+E: { 15 }
+
+# cache option, summ of:
+#    00 Off (default)
+#    01 Ecm pids cache, store pids used to decode in /tmp/ca_cache.list at exit, load at startup, same syntax as restore.list
+#    02 Ecm data cache, remember CW for (E:) time 
+#    04 Emm cache for network cards, do not resend the same emm twice, cache not cleared until restart
+H: { 07 }
+
+# reread files, summ of: 
+#    00 No (default)
+#    01 reread config file on channel change (including priority and ignore, but not replace/cache)
+#    02 reread SoftCam.Key on channel change
+#    04 reread SoftCam.Key if file changed
+R: { 00 }
+
+# debug, summ of
+# 00 off (default)
+# 01 debug ecm
+# 02 debug emm
+# 04 debug network ecm
+# 08 debug network emm
+# 16 debug network login
+# 32 show mem/cpu stats every 1 min
+# 64 add timestamp to log messages
+D: { 00 }
+
+# box type
+# 00 autodetect, change only if you think wrong type detected.
+# 01 dbox2
+# 02 dreambox
+# 03 triple-dragon
+# 04 relook
+# 05 openbox
+# 06 dreambox/mips
+# 08 stapi/kathrein
+# 09 stapi/ipbox
+# 11 stapi/openbox
+B: { 11 }
+
+# map all 180x nagra caids to 1801
+# default is 01
+F: { 00 }
Index: /ipk/source/emus_mgcamd_1_35/var/keys/newcamd.list.mgcamd
===================================================================
--- /ipk/source/emus_mgcamd_1_35/var/keys/newcamd.list.mgcamd	(revision 1856)
+++ /ipk/source/emus_mgcamd_1_35/var/keys/newcamd.list.mgcamd	(revision 1856)
@@ -0,0 +1,4 @@
+CWS_KEEPALIVE = 300
+CWS_INCOMING_PORT = 21000
+CWS = 192.168.1.1 20000 dummy dummy 10 02 13 04 15 06 17 08 01 10 11 12 13 14 lan server1
+CWS_MULTIPLE = 192.168.1.2 20000:20005 dummy dummy 10 02 13 04 15 06 17 08 01 10 11 12 13 14 lan server2
Index: /ipk/source/emus_mgcamd_1_35/var/keys/peer.cfg.mgcamd
===================================================================
--- /ipk/source/emus_mgcamd_1_35/var/keys/peer.cfg.mgcamd	(revision 1856)
+++ /ipk/source/emus_mgcamd_1_35/var/keys/peer.cfg.mgcamd	(revision 1856)
@@ -0,0 +1,38 @@
+# sample peer.cfg for gbox client in mgcamd
+# syntax the same as in cwshare.cfg, 
+# you can just copy cwshare.cfg to this file.
+# see below for supported tags, others not supported (yet).
+
+# max cards to send ecm too + preffered cards ids (up to 32)
+X: { 05 } 1234 ABCD
+
+# max card's distance to use for ecm
+I: ( 05 }
+
+# resend after 2 seconds, re-sync (send to all) after 3 seconds
+N: { 0 0 0 0 2000 3000 }
+# same, but for NDS cards
+S: { 0 0 0 0 400 500 }
+
+# my host and password
+M: { my.dyndns.com { 1234ABCD }}
+
+# peers, unlimited number, but only up to 32 unique ports to listen
+# host, port to listen, remote port, password, levels (ignored)
+D: { peer1.dyndns.com { 2471 3471 { ABCD1234 { 9 9 }}}}
+D: { peer2.dyndns.com { 2471 3471 { 6789ABCD { 9 9 }}}}
+
+# ignore ids
+Y: { 01 02 }
+Y: { 02 03 }
+
+# always save ids, caid-id + id
+G: { 05023B00 1234 }
+G: { 01000065 5678 }
+
+# virtual cards
+V: { 01 { 05 00 7C 00 }}
+V: { 02 { 18 01 04 01 }}
+V: { 02 { 18 01 05 01 }}
+V: { 03 { 18 01 40 01 }}
+V: { 03 { 18 01 41 01 }}
Index: /ipk/source/emus_mgcamd_1_35/var/keys/priority.list.mgcamd
===================================================================
--- /ipk/source/emus_mgcamd_1_35/var/keys/priority.list.mgcamd	(revision 1856)
+++ /ipk/source/emus_mgcamd_1_35/var/keys/priority.list.mgcamd	(revision 1856)
@@ -0,0 +1,6 @@
+# use this via prov first
+V: { 00 78 00 }
+# use this seca prov first
+S: { 80 00 }
+# use this caid first
+X: ( 06 02 }
Index: /ipk/source/emus_mgcamd_1_35/var/keys/replace.list.mgcamd
===================================================================
--- /ipk/source/emus_mgcamd_1_35/var/keys/replace.list.mgcamd	(revision 1856)
+++ /ipk/source/emus_mgcamd_1_35/var/keys/replace.list.mgcamd	(revision 1856)
@@ -0,0 +1,7 @@
+# replace old with new {{ sid } { caid } { provid } { ecmpid } { newcaid } { newprovid } { newecmpid }}
+# multivision 1 example
+# R: {{ 515 } { 500 } { 7C00 } { A0 } { 500 } { 7800 } { A1 }}
+# OR put this ecm on top if new* = 0
+# R: {{ 515 } { 500 } { 7800 } { A1 } { 0 } { 0 } { 0 }}
+# replace old caid > newcaid example
+# X: {{ 624 } { 604 }}
