As hondvatec ask, it will be nice to have a second virtual usb.
I could record on first vitual usb (sdb) and read on second virtual usb (sdc ?).
Cyrille
#!/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
trappa wrote:i'm also interested in a second virtual usb device
greetz
insmod g_file_storage.ko file=file1,file2,file3
arris69 wrote:why you not search for documentation of the g_file_storage modules?
Denny wrote:coz your automount scripts 0x_0x_zzzzzmount.init scans your whole network (at me completly disabled)
. /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
Users browsing this forum: No registered users and 2 guests