Page 1 of 6

PVR NW Share w/o USB or small image mod vusb.init

Posted: Thu Apr 12, 2012 8:31 pm
by DEUS
Please correct me if i am wrong but as far as i read in threads, Recording to NW Share without USB-Stick Connected, is not possible? (explanation will follow)
and there is also a neccesary size for the recording point arround 1,5 GB and has to be XFS (these restrictions are removed by widget)
there is nothing like iscsi or usbremote that can be mounted as a recording store. Basicaly there is no limit for the VirtualUSB exept aviable space? can it be 20MB? or should i expect any problems with a file big like this?

Got a file 16 MB size with an 1.6 GB xfs partition that works with g_file_storage and is possible to record on
dd if=/dev/zero of=XFSIMAGE bs=1M count=18 #This will be the container for the PVR Image Needs to be 18MB for formating
mkfs.xfs XFSIMAGE #Format with a FS that Supports Sparsefile
dd if=/dev/zero of=PVRIMAGE bs=1M count=1 seek=1536 #Create a Sparsefile (12 MB after formatting)
dd if=/dev/zero of=PVRIMAGE bs=1 count=1 seek=1536000000 #Create a Sparsefile smallest size (11 MB after formatting)
mkfs.xfs PVRIMAGE -L PVRIMAGE #Formats it with XFS for recording
modprobe g_file_storage file=PVRIMAGE #load as VUSB

here is a mod of remi71 init script which works on my TV with the record to NW share from remi71 would some of the Devs leave a comment about possible trouble from my point its only that it will consume 17MB space
02_04_vusb.vpvrimage.init

Code: Select all

#!/bin/sh

. /dtv/SGO.env

case $1 in 
	start)
	[ -e $SYSROOT/etc/init.d/02_04_vusb.init ] && exit 1
	[ ! -e $SYSROOT/etc/init.d/03_03_nfsmount.init ] && exit 1
	[ ! -e $SYSROOT/etc/init.d/80_80_record_to_nwshare.init ] && exit 1
	mkfs.vfat -C /dtv/vusb 500
	insmod $MOD_DIR/kernel/drivers/usb/gadget/dummy_hcd.ko || \
	insmod $MOD_DIR/kernel/drivers/mstar/usb/gadget/dummy_hcd.ko

	XFSIMAGE=""$SYSROOT"/xfsimage"
	XFSMOUNT="/dtv/xfsmount"
	PVRIMAGE=""$XFSMOUNT"/pvrimage"
	PVRMOUNT=""$XFSMOUNT"/pvrmount"
	GFILESTORAGE="/dtv/vusb"

	[ ! -d $XFSMOUNT ] && mkdir $XFSMOUNT
	[ ! -f $XFSIMAGE ] && dd if=/dev/zero of=$XFSIMAGE bs=1M count=17 status=noxfer 2>/dev/null
	mkfs.xfs -qf $XFSIMAGE
	cat /proc/mounts | grep -q "$XFSMOUNT" || /bin/busybox mount -o loop $XFSIMAGE $XFSMOUNT
	if [ ! -f $PVRIMAGE ]; then
		dd if=/dev/zero of="$PVRIMAGE" bs=1M count=1 seek=1536 status=noxfer 2>/dev/null
		mkfs.xfs "$PVRIMAGE"
		mkdir -p "$PVRMOUNT"
		/bin/busybox mount -o loop "$PVRIMAGE" "$PVRMOUNT"
		touch ""$PVRMOUNT"/.PlaceHolderDO-NOT-REMOVE"
		/bin/busybox umount "$PVRMOUNT"
	fi
	[ -e $PVRIMAGE ] && GFILESTORAGE="$GFILESTORAGE,$PVRIMAGE"
	
	insmod $MOD_DIR/kernel/drivers/usb/gadget/g_file_storage.ko file="$GFILESTORAGE" || \
	insmod $MOD_DIR/kernel/drivers/mstar/usb/gadget/g_file_storage.ko file="$GFILESTORAGE"
	sleep 3

	FOUND=false
	SAMYGODEVS=''
	for i in /sys/block/sd?/device/model ; do
		if [ `cat $i | grep -c "SamyGO Virt"` -gt "0" ]; then
			CURDEV="`echo $i | sed 's/^\/.*\(sd.\)\/.*/\1/g'`"
			SAMYGODEVS="$SAMYGODEVS /dev/$CURDEV"
			if [ $FOUND = false ]; then
				echo "found gadget at: $i"
				dev=$CURDEV
				echo "scsidev: $dev"
				FOUND=true
			fi
		else
			echo "real storage device at: $i"
		fi
	done
	SAMYGODEVS=`echo $SAMYGODEVS|sed 's/^[[:space:]]//'`

	sed -i -e "s,MountPlaceholder,/dtv/usb/$dev," /dtv/SGO.env
	echo "SAMYGODEVS=\"$SAMYGODEVS\"" >> /dtv/SGO.env
	;;
	stop)
	rmmod g_file_storage
	# some troubles if we mess around with dummy_hcd, so not remove on stop
	# rmmod dummy_hcd
	;;
	status)
	cat /sys/block/sd?/device/model
	;;
	*)
	echo "Usage: $0 {start|stop|status}" 1>&2
	exit 0
	;;
esac

AW: Record NW Share without USB mod vusb.init

Posted: Sat Apr 14, 2012 9:32 pm
by DEUS
Ok some problems i experience by my self already. Will try to get arround it. Manually it works on boot or seccond try errors. Utility sparesfile basically works maybe will recreate file each boot.

Re: Record NW Share without USB mod vusb.init

Posted: Sun Apr 15, 2012 12:41 am
by DEUS
Script in 1. post updated, removed sleep because reformating takes also time, this also prevents FS coruption issues, another posibility is maybe to mount ro instead of rw needs to be tested, works with standard 03_03_nfsmount.init and 80_80_record_to_nwshare.init from remi71, on my TV

PVR NW Share w/o USB or small image mod vusb.init

Posted: Tue Apr 24, 2012 6:06 pm
by Rohel
I have to look If i can do it
If i understand what You have done Is a mod of one init script
But, How do you do to create the xfs file? Another init script??

Re: PVR NW Share w/o USB or small image mod vusb.init

Posted: Tue Apr 24, 2012 7:07 pm
by DEUS
it gets created every time you boot with
dd if=/dev/zero of="$PVRIMAGE" bs=1M count=1 seek=1536 status=noxfer 2>/dev/null
and then formated with xfs
but you need to disable $SYSROOT/etc/init.d/02_04_vusb.init
and configure remis 03_03_nfsmount.init and 80_80_record_to_nwshare.init
if you use this keep an eye on this thread

Re: PVR NW Share w/o USB or small image mod vusb.init

Posted: Tue Apr 24, 2012 8:55 pm
by Rohel
it seems that its working properly on my TV too, but im not able to mount the NFS
maybe its because im using a Mac laptop instead of a true NAS...

do you have replaced the rcSGO file like on remi's mod????

this is the log i found, and i have lost sammy virtual USB when i applyed your vusb.init

19700101-000020 Start Record to Network Share script (80_80_record_to_nwshare.init)
19700101-000020 Check if server 192.168.0.11 is reachable and NFS service available... OK
19700101-000020 Search for mount point of pvrimage...
19700101-000045 No virtual device found ready for PVR or already mounted
19700101-000045 End Record to Network Share script (80_80_record_to_nwshare.init)

if i exec vusb.init without a pen drive attached i see this in the web-cgi

Code: Select all

/mtd_rwcommon/widgets/user/SamyGO/SamyGO/etc/init.d/02_04_vusb.init start stop
Status:
cat: can't open '/sys/block/sd?/device/model': No such file or directory
if i do that with a pen attached, i see the name of the pen drive

Code: Select all

/mtd_rwcommon/widgets/user/SamyGO/SamyGO/etc/init.d/02_04_vusb.init start stop
Status:
TS512MJFV20 
NFS Mount seems to be ok

Code: Select all

/mtd_rwcommon/widgets/user/SamyGO/SamyGO/etc/init.d/03_03_nfsmount.init start stop
Status:
192.168.0.11:/Users/rohel/Movies/Compartido on /mtd_rwcommon/widgets/user/SamyGO/SamyGO/MountPlaceholder/nfs/192.168.0.11/_Users_rohel_Movies_Compartido type nfs (rw,relatime,vers=3,rsize=65536,wsize=65536,namlen=255,soft,nointr,nolock,proto=tcp,timeo=70,retrans=3,sec=sys,addr=192.168.0.11)
192.168.0.11:/Users/rohel/Movies/RECORD on /mtd_rwcommon/widgets/user/SamyGO/SamyGO/MountPlaceholder/nfs/192.168.0.11/_Users_rohel_Movies_RECORD type nfs (rw,relatime,vers=3,rsize=65536,wsize=65536,namlen=255,soft,nointr,nolock,proto=tcp,timeo=70,retrans=3,sec=sys,addr=192.168.0.11)
record to nfs share dont look good :S

Code: Select all

/mtd_rwcommon/widgets/user/SamyGO/SamyGO/etc/init.d/80_80_record_to_nwshare.init start stop
Status:
pls request it on forum

Re: PVR NW Share w/o USB or small image mod vusb.init

Posted: Tue Apr 24, 2012 10:34 pm
by DEUS
oh sorry lets do some clear instructions, take the code from 1. post create a file in samygo dir/etc/init.d/ called "02_04_vusb.vpvrimage.init"
rename 02_04_vusb.init to 02_04_vusb.init.dis, 03_03_nfsmount.init needs to be there and 80_80_record_to_nwshare.init from remi71 should be there (just rename it) and configure it, thats it when tv boots you should have 2 Virtual USB and on one you are able to record

Re: PVR NW Share w/o USB or small image mod vusb.init

Posted: Wed Apr 25, 2012 6:09 pm
by Rohel
ok now i have two shares on my TV, one for recording and other for everything else
seems to be OK, but i have to test to connect the computer without wifi to ensure tu pass performance test

or, are there any way to bypass performance test?

Re: PVR NW Share w/o USB or small image mod vusb.init

Posted: Wed Apr 25, 2012 6:51 pm
by DEUS
not sure but i think you need this file in contents name: ".PVRPfmChkLog" and content is "1" no ""

Re: PVR NW Share w/o USB or small image mod vusb.init

Posted: Wed Apr 25, 2012 8:59 pm
by Rohel
DEUS wrote:not sure but i think you need this file in contents name: ".PVRPfmChkLog" and content is "1" no ""
this doesnt work
i have created that file on the NFS Record root, and also in a folder called CONTENTS
maybe i have to create that file on the XFS image mounted on the script???