Page 6 of 8

Re: D series rooting (arm cpu architecture only) UPDATE!

Posted: Mon Jan 02, 2012 2:39 am
by hondavtec
Played a little with 02_04_vusb.init but can't get a second Virtual USB device to show up.
All I get is a second vusb file under /dtv

This is how it looks at the moment:

Code: Select all

#!/bin/sh
#
# ? Copyright 1996-2010, ZsoltTech.Com
#       by Ser Lev Arris <arris@ZsoltTech.Com>
#
#       donated for the SamyGo Project
#       http://samygo.sourceforge.net/
#
#       Version: SamyGO svn $Id: 02_04_vusb.init 1090 2011-01-27 18:37:07Z arris69 $
#
# TODO: more sysv style, more error handling
#
. /dtv/SGO.env

case $1 in 
	start)
	# on C series: can't open '/proc/scsi/scsi': No such file or directory?
#	if [ `cat /proc/scsi/scsi | grep -c "Type:"` -lt "1" ] ; then
		
		# create unsusable dummy device
		# dd if=/dev/zero of=/dtv/vusb bs=512 count=4

		# create usable vfat image
		# we don't need to mess around with log and usblog
		# also no limits to usb mounts
		# we need to find mount point, on most devices it's sda
		# but it will differ in some situations
		mkfs.vfat -C /dtv/vusb 500
		mkfs.vfat -C /dtv/vusb2 500
		# mkfs.vfat -C /dtv/vusb $(($(df -k /dtv | grep dtv | sed -e 's,^\(.*\) \(.*\) \( .*% /dtv\),\2,') / 3 ))
		
		# TODO: for recording on c series xfs stuff.
		# /dev/stl0/21            392.3M    142.9M    249.4M  36% /mtd_rwcommon
		# needs to be adapted:
		# http://sourceforge.net/apps/phpbb/samygo/viewtopic.php?f=12&p=10567#p10567
		#
		# dd if=/dev/zero of=/mtd_rwcommon/vusb bs=1M count=16
		# /sbin/mkfs.xfs -f -d name=/mtd_rwcommon/vusb
		# ln -s /mtd_rwcommon/vusb /dtv/
		# OBSOLETE: gone to 80_80_record_to_nwshare.init 

		# create usable virtual device (don't store data on it what you need tomorrow too!!)
		# dd if=/dev/zero of=/dtv/vusb bs=1M count=2
		# mkfs.ext3 -q -F -m 0 -b 1024 /dtv/vusb

		# insmod $SYSROOT/lib/modules/treasure/dummy_hcd.ko
		insmod $MOD_DIR/kernel/drivers/usb/gadget/dummy_hcd.ko || \
		insmod $MOD_DIR/kernel/drivers/usb/gadget/dummy_hcd2.ko || \
		insmod $MOD_DIR/kernel/drivers/mstar/usb/gadget/dummy_hcd.ko
		insmod $MOD_DIR/kernel/drivers/mstar/usb/gadget/dummy_hcd2.ko
		sleep 2
		# insmod $SYSROOT/lib/modules/treasure/g_file_storage.ko
		insmod $MOD_DIR/kernel/drivers/usb/gadget/g_file_storage.ko || \
		insmod $MOD_DIR/kernel/drivers/usb/gadget/g_file_storage2.ko || \
		insmod $MOD_DIR/kernel/drivers/mstar/usb/gadget/g_file_storage.ko
		insmod $MOD_DIR/kernel/drivers/mstar/usb/gadget/g_file_storage2.ko
		sleep 3
		
		# find vusb in /sys
		# and set a variable for mount point
		dev1="sda1" # set fallback if someting wrong with modules
		for i in /sys/block/sd?/device/model ; do
			if [ `cat $i | grep -c "SamyGO Virt"` -gt "0" ] ; then
				echo "found gadget at: $i"
				dev1=`echo $i | sed 's/^\/.*\(sd.\)\/.*/\1/g'`
				echo "scsidev: $dev1"
			else
				echo "real storage device at: $i"
			fi
		done
		# find vusb in /sys
		# and set a variable for mount point
		dev2="sdb1" # set fallback if someting wrong with modules
		for i in /sys/block/sd?/device/model ; do
			if [ `cat $i | grep -c "SamyGO Virt"` -gt "0" ] ; then
				echo "found gadget at: $i"
				dev2=`echo $i | sed 's/^\/.*\(sd.\)\/.*/\1/g'`
				echo "scsidev: $dev2"
			else
				echo "real storage device at: $i"
			fi
		done
#	else
#		echo "Storage Device is present"
#	fi
	sed -i -e "s,MountPlaceholder,/dtv/usb/$dev1," /dtv/SGO.env
	sed -i -e "s,MountPlaceholder,/dtv/usb/$dev2," /dtv/SGO.env
	;;
	stop)
	# what's about umount?
	rmmod g_file_storage
	rmmod g_file_storage2
	# 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
I think it's fine until it comes to mount dev2
Any hint would be much appreciated :roll:

Re: D series rooting (arm cpu architecture only) UPDATE!

Posted: Mon Jan 02, 2012 3:10 am
by trappa
i'm also interested in a second virtual usb device

greetz

Re: D series rooting (arm cpu architecture only) UPDATE!

Posted: Mon Jan 02, 2012 9:48 am
by arris69
trappa wrote:i'm also interested in a second virtual usb device

greetz
why you not search for documentation of the g_file_storage modules?
http://www.linux-usb.org/gadget/file_storage.html

Code: Select all

insmod g_file_storage.ko file=file1,file2,file3
should work.
but what not works is loading the module multiple times...

Re: D series rooting (arm cpu architecture only) UPDATE!

Posted: Mon Jan 02, 2012 10:50 am
by hondavtec
arris69 wrote:why you not search for documentation of the g_file_storage modules?
Well for my part I can only say I pretty much don't have any command line knowledge so don't know what to look for...
However, I'm giving up on this as it's probably good enough for me to just set up one samba and a second nfs share for recording.

Thanks anyways arris for the hint, it opened my eyes that it's not as easy as I hoped.

Re: D series rooting (arm cpu architecture only) UPDATE!

Posted: Tue Jan 03, 2012 2:24 pm
by hondavtec
Denny wrote:coz your automount scripts 0x_0x_zzzzzmount.init scans your whole network (at me completly disabled)
Hi Denny, could you please tell me how you've done that?
... I hope this is easy?

Re: D series rooting (arm cpu architecture only) UPDATE!

Posted: Tue Jan 03, 2012 9:27 pm
by pepsuncho66
I've done some modifications on the 02_04_vusb.init file to make it possible to create two virt. usb. It works for me so i did not do much erroe handling. I uses the g_file_storage as proposed by arris69. Here is the modified code:

Code: Select all

. /dtv/SGO.env

case $1 in 
	start)

		mkfs.vfat -C /dtv/vusb 500
                mkfs.vfat -C /dtv/vusb1 500

		insmod $MOD_DIR/kernel/drivers/usb/gadget/dummy_hcd.ko || \
		insmod $MOD_DIR/kernel/drivers/mstar/usb/gadget/dummy_hcd.ko
		sleep 2
		insmod $MOD_DIR/kernel/drivers/usb/gadget/g_file_storage.ko file=/dtv/vusb,/dtv/vusb1 || \
		insmod $MOD_DIR/kernel/drivers/mstar/usb/gadget/g_file_storage.ko file=/dtv/vusb,/dtv/vusb1
		sleep 3
		
		dev="sda1" # set fallback if someting wrong with modules
                count=-1
		for i in /sys/block/sd?/device/model ; do
			if [ `cat $i | grep -c "SamyGO Virt"` -gt "0" ] ; then
                                let count=count+1
				echo "found gadget at: $i"
				dev=`echo $i | sed 's/^\/.*\(sd.\)\/.*/\1/g'`
				echo "scsidev: $dev"
                                if [ "$count" -eq "0" ] ; then
                                      sed -i -e "s,MountPlaceholder,/dtv/usb/$dev," /dtv/SGO.env
                                      first_dev=$dev
                                else
                                      sed -i -e "s,/dtv/usb/$first_dev\",/dtv/usb/$first_dev\"\nMOUNT_PRV$count=\"/dtv/usb/$dev\"," /dtv/SGO.env
                                fi
			else
				echo "real storage device at: $i"
			fi
		done
	  ;;
	stop)
		dev="sda1" # set fallback if someting wrong with modules
                count=-1
		for i in /sys/block/sd?/device/model ; do
			if [ `cat $i | grep -c "SamyGO Virt"` -gt "0" ] ; then
                                let count=count+1
				echo "found gadget at: $i"
				dev=`echo $i | sed 's/^\/.*\(sd.\)\/.*/\1/g'`
				echo "scsidev: $dev"
                                if [ "$count" -eq "0" ] ; then
                                     sed -i -e "s,/dtv/usb/$dev,MountPlaceholder," /dtv/SGO.env
                                else
                                    sed -i -e "s,MOUNT_PRV$count=\"/dtv/usb/$dev\",," /dtv/SGO.env
                                fi
			else
				echo "real storage device at: $i"
			fi
		done
           sed -i -e "/^$/d" /dtv/SGO.env
	  rmmod g_file_storage
	  ;;
	status)
	  cat /sys/block/sd?/device/model
	  ;;
	  *)
	  echo "Usage: $0 {start|stop|status}" 1>&2
	  exit 0
	  ;;
esac
Everybody can use it at their own risk. Hope this helps! May be there is more elegant way of doing it but as I sad for me it is working.
For recording one should use the $MOUNT_PATH var from SGO.env.
The second and so on virt. usbs are mounted to $MOUNT_PRV1, $MOUNT_PRV2 ... and so on (use this for smb, nfs ...).

Re: D series rooting (arm cpu architecture only) UPDATE!

Posted: Tue Jan 03, 2012 10:35 pm
by hondavtec
Really great, thanks a bunch for developing this!!!

Re: D series rooting (arm cpu architecture only) UPDATE!

Posted: Wed Jan 04, 2012 2:46 pm
by trappa
is there a way to change the name of both virtual devices for example in Media and Recordings

Re: D series rooting (arm cpu architecture only) UPDATE!

Posted: Thu Jan 05, 2012 7:57 am
by nobody
How can be 1020.0 firmware be downgraded to 1019.0 ? (55D8000 gap8deuc firmware)