Page 1 of 6

SamyGo virtual drive MOD

Posted: Mon Sep 24, 2012 2:26 pm
by pohybel
I do not take any responsibility if TV bricks, hack is available "as is".

Tested on:
- UE40D6750
- UE32C6000

Now available for D-series and C-series TVs

FOR ARM PROCESSORS ONLY!

It took me months to figure out that you may create more than one SamyGO virtual drive. However every one of them has the same name and handling them wasn't "user friendly". So, I decided to change it and I hacked a little bit g_file_storage driver.

How to install hack (adjust paths to your environment):
- Download and unpack attached file
- backup /mtd_rwcommon/widgets/user/SamyGO/SamyGO/lib/modules/2.6.30.9/kernel/drivers/usb/gadget/g_file_storage.ko
- overwrite g_file_storage.ko with unpacked version
- go into /mtd_rwcommon/widgets/user/SamyGO/SamyGO/etc/init.d/
- find 02_04_vusb.init and rename it to 02_04_vusb.init.dis
- Edit 02_04_vusb.init from unpacked file and set your drives (separated by semicolon), eg
DRIVES="Movies;Laptop;Phone;QNAP"
You may create max 8 drives, and drive name may contain max 16 characters (driver restrictions)
- copy 02_04_vusb.init to your TV to /mtd_rwcommon/widgets/user/SamyGO/SamyGO/etc/init.d/
DONE! Patch has been applied. Reboot your TV. You should see 4 SamyGo virtual drives (if you haven't change 02_04_vusb.init).

What next?

Check your /dtv/SGO.env file. You should see MOUNTH_PATH* variables:
MOUNT_PATH1="/dtv/usb/sda"
MOUNT_PATH2="/dtv/usb/sdb"
MOUNT_PATH3="/dtv/usb/sdc"
MOUNT_PATH4="/dtv/usb/sdd"
This are root folders of your virtual drives. You may mount there whatever you want. In my case I have mounted movies from my PC, few folders from laptop (few shared folder mounted to one virtual drive - in subfolders), phone's SD card (to watch photos directly on tv without DLNA) and my network storage (QNAP).
You may check it on photo:
Image
All 4 USB drives are SamyGO virtual drives.

To developers:
Right now additional parameter is required during insmod of g_file_storage.ko: "model". It should contain array of models of drives separated by comma. It should contain at least one model.
Example
insmod $MOD_DIR/kernel/drivers/usb/gadget/g_file_storage.ko file="/dtv/vusb1,/dtv/vusb2,/dtv/vusb3" model="Movies,Laptop" <= third model is omited so default will be used (SamyGo Virt)

Take look on my mount file:

Code: Select all

#!/bin/sh
#04_04_samba.init

. /dtv/SGO.env

do_mount()
{
  M_PATH=$MOUNT_PATH1
  echo "Mounting $M_PATH" >>$LOGFILE
  mkdir -p $M_PATH
  mount -o user=my_user,password=my_pass "//10.0.0.72/Movies" $M_PATH 2>>$LOGFILE

  M_PATH=$MOUNT_PATH2/Mediacenter
  mkdir -p $M_PATH
  echo "Mounting $M_PATH" >>$LOGFILE
  mount -o user=my_user,password=my_pass -t cifs "//10.0.0.2/Mediacenter" $M_PATH 2>>$LOGFILE

  M_PATH=$MOUNT_PATH2/Movies
  echo "Mounting $M_PATH" >>$LOGFILE
  mkdir -p $M_PATH
  #use prefixpath if you want to mount just subdirectory from your shared drive
  mount -o user=my_user,password=my_pass,prefixpath=download/movies -t cifs "//10.0.0.2/E" $M_PATH 2>>$LOGFILE
  
  M_PATH=$MOUNT_PATH3/Photos
  echo "Mounting $M_PATH" >>$LOGFILE
  mkdir -p $M_PATH
  #use prefixpath if you want to mount just subdirectory from your shared drive
  mount -o user=my_user,password=my_pass,prefixpath=DCIM/Camera -t cifs "//10.0.0.5/sdcard" $M_PATH 2>>$LOGFILE

  M_PATH=$MOUNT_PATH4
  mkdir -p $M_PATH
  echo "Mounting $M_PATH" >>$LOGFILE
  mount -o user=my_user,password=my_pass -t cifs "//10.0.0.1/Mediacenter" $M_PATH 2>>$LOGFILE
}

case $1 in 
	start)
    #TODO: lsmod - check if already loaded
    insmod $MOD_DIR/kernel/fs/cifs/cifs.ko
    do_mount
    ;;
	stop)
    ;;
	status)
    ;;
	*)
    echo "Usage: $0 {start|stop}" 1>&2
    exit 0
    ;;
esac
@SamyGo developers
I've noticed that oryginal g_file_storage.ko has ~35Kb and the one compiled by me ~200Kb. Could you please write how can I make this file smaller? I dont have experience with "Make" files and C compilers - I am Java developer and I've started learning C because of SamyGo MODS :)

Re: SamyGo virtual drive MOD

Posted: Tue Sep 25, 2012 3:30 pm
by juusso
Hi! I like your idea, thanks! Good for users who don`t like standard approach.

Re: SamyGo virtual drive MOD

Posted: Tue Sep 25, 2012 4:00 pm
by arris69
pohybel wrote:...
Could you please write how can I make this file smaller?..

Code: Select all

strip -g <module>.ko

Re: SamyGo virtual drive MOD

Posted: Sat Nov 17, 2012 3:03 pm
by tempinbox
Where i can find this mod for C series arm tvs?
I need this hack i try these instructions but don't work on c series:

Code: Select all

/dtv/usb/sda1/SamyGO/etc/init.d # ./02_04_vusb.init start
mkfs.vfat 2.11 (12 Mar 2005)
mkfs.vfat 2.11 (12 Mar 2005)
mkfs.vfat 2.11 (12 Mar 2005)
mkfs.vfat 2.11 (12 Mar 2005)
insmod: cannot insert '/dtv/usb/sda1/SamyGO/lib/modules/2.6.24_SELP.4.3.x-Cortex-A8/kernel/drivers/usb/gadget/dummy_hcd.ko': File exists (-1): File exists
insmod: cannot insert '/dtv/usb/sda1/SamyGO/lib/modules/2.6.24_SELP.4.3.x-Cortex-A8/kernel/drivers/usb/gadget/g_file_storage.ko': Invalid module format (-1): Exec format error
real storage device at: /sys/block/sda/device/model
real storage device at: /sys/block/sda/device/model
found gadget at: /sys/block/sda/device/model
scsidev: sda
mkdir: cannot create directory '/dtv/usb/sda': File exists
real storage device at: /sys/block/sda/device/model
/dtv/usb/sda1/SamyGO/etc/init.d #
Please help me
is necessary to recompile the g-filestorage.ko?

Re: SamyGo virtual drive MOD

Posted: Sat Nov 17, 2012 5:25 pm
by pohybel
Yeap, somebody has to recompile g_file_storage for C-series. I've enclosed source code file in first post.

Re: SamyGo virtual drive MOD

Posted: Sun Nov 18, 2012 12:05 pm
by tempinbox
Could someone recompile this for c series? please
I have no idea what i've to do for recompile this driver but i think that with the source code posted is easier.
It is a very useful mode
Maybe there is another ways to fake more than one vusb?
I like this mod because is very customizable and simple

Re: SamyGo virtual drive MOD

Posted: Sun Nov 18, 2012 6:47 pm
by pohybel
tempinbox wrote:Could someone recompile this for c series?
Could you please write which model exactly you have? I'm not promising anything but if I find some spare time to configure toolchain for C-series, I do it.

Btw, I have question to You. Where can I find such log file as you posted? I'm looking for it for some time but I can't find it :oops: .

Re: SamyGo virtual drive MOD

Posted: Sun Nov 18, 2012 7:16 pm
by tempinbox
Hi my tv is ue32c6000 but fortunately has a valdeuc fw and valencia board so now is turned into a c6900 i have activated pvr internet@tv guideplus animated menu and wireless remote (all this function aren't avaiable natively for c6000).
It has an arm processor

Code: Select all

/ # cat proc/cpuinfo
Processor       : ARMv7 Processor rev 2 (v7l)
BogoMIPS        : 798.72
Features        : swp half thumb fastmult vfp edsp
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x2
CPU part        : 0xc08
CPU revision    : 2

Hardware        : Samsung SDP92 Evaluation board
Revision        : 0000
Serial          : 0000000000000000
i've samygoextension for t-valdeuc and when i try to start your scripts i got these message from shell on telnet connection.
for the log you have to estabilish a telnet connection to your tvs
find SamyGo/etc/init.d folder where scripts are stored (you probably have it in mtd_rwcommon...)
select the script 02_04_vusb.init
use this command

Code: Select all

./script 02_04_vusb.init start
./script 02_04_vusb.init status 
and this shows the log.
the source code and the toolchain from c series are available on http://opensource.samsung.com/
but i'm not expert in compiling so i ask help here.
Great job you mod is very useful.

Re: SamyGo virtual drive MOD

Posted: Sun Nov 18, 2012 11:18 pm
by pohybel
tempinbox wrote:Hi my tv is ue32c6000 but fortunately has a valdeuc fw and valencia board so now is turned into a c6900
I'm not sure which source code should I use. I took the one for c6900. I recompile g_file_storage for it. Check it and give us your feedback. If it not work, I will try source code for c6000
tempinbox wrote: i've samygoextension for t-valdeuc and when i try to start your scripts i got these message from shell on telnet connection.
Aaaahhhhhh yes...That's why I could not find it. Telnet is not available on D-series :)

Re: SamyGo virtual drive MOD

Posted: Mon Nov 19, 2012 4:54 pm
by tempinbox
pohybel wrote:
tempinbox wrote:Hi my tv is ue32c6000 but fortunately has a valdeuc fw and valencia board so now is turned into a c6900
I'm not sure which source code should I use. I took the one for c6900. I recompile g_file_storage for it. Check it and give us your feedback. If it not work, I will try source code for c6000
tempinbox wrote: i've samygoextension for t-valdeuc and when i try to start your scripts i got these message from shell on telnet connection.
Aaaahhhhhh yes...That's why I could not find it. Telnet is not available on D-series :)
Not working arrghh

Code: Select all

/dtv/usb/sda1/SamyGO/etc/init.d # ./02_04_vusb.init start
mkfs.vfat 2.11 (12 Mar 2005)
mkfs.vfat 2.11 (12 Mar 2005)
mkfs.vfat 2.11 (12 Mar 2005)
mkfs.vfat 2.11 (12 Mar 2005)
mkfs.vfat 2.11 (12 Mar 2005)
insmod: cannot insert '/dtv/usb/sda1/SamyGO/lib/modules/2.6.24_SELP.4.3.x-Cortex-A8/kernel/drivers/usb/gadget/dummy_hcd.ko': File exists (-1): File exists
insmod: cannot insert '/dtv/usb/sda1/SamyGO/lib/modules/2.6.24_SELP.4.3.x-Cortex-A8/kernel/drivers/usb/gadget/g_file_storage.ko': Invalid module format (-1): Exec format error
real storage device at: /sys/block/sda/device/model
real storage device at: /sys/block/sda/device/model
real storage device at: /sys/block/sda/device/model
real storage device at: /sys/block/sda/device/model
real storage device at: /sys/block/sda/device/model

Code: Select all

usbcore: registered new interface driver usbhid
drivers/hid/usbhid/hid-core.c: v2.6:USB HID core driver
dummy_hcd dummy_hcd: USB Host+Gadget Emulator, driver 02 May 2005
dummy_hcd dummy_hcd: Dummy host controller
dummy_hcd dummy_hcd: new USB bus registered, assigned bus number 5
usb usb5: configuration #1 chosen from 1 choice
hub 5-0:1.0: USB hub found
hub 5-0:1.0: 1 port detected
g_file_storage: module has no symbols (stripped?)
[CIP_KERNEL] count(1), value(0x0)
[CIP_KERNEL] count(2), value(0x0)
[CIP_KERNEL] authentication success code!!
[waiterd]Success!
g_file_storage: module has no symbols (stripped?)
g_file_storage: Unknown parameter `model'
g_file_storage: Unknown parameter `model'
g_file_storage: Unknown parameter `model'
g_file_storage: Unknown parameter `model'
g_file_storage: module has no symbols (stripped?)
/dtv/usb/sda1 #
Your driver is smaller than mine why? mine is 34kb yours is 21kb ( i don't know if matter)
please help me
(On d series you can get the log by nc shell or ssh)
one qestion i have to modify the SGO.env?
Mine is :

Code: Select all

SYSROOT="/dtv/usb/sda1/SamyGO"
MOUNT_PATH="/dtv/usb/samygovirt"
export MOD_DIR=/dtv/usb/sda1/SamyGO/lib/modules/2.6.24_SELP.4.3.x-Cortex-A8
export TMPDIR=/dtv
export HOME=/mtd_wiselink
export SMB_CONF_PATH="/dtv/usb/sda1/SamyGO/etc/samba/smb.conf"
LOGFILE="/dtv/usb/sda1/SamyGO/samygo.log"
LD_LIBRARY_PATH="/dtv/usb/sda1/SamyGO/opt/privateer/lib:/dtv/usb/sda1/SamyGO/opt/privateer/usr/lib:/dtv/usb/sda1/SamyGO/lib:/dtv/usb/sda1/SamyGO/usr/lib:"
PATH="/dtv/usb/sda1/SamyGO/opt/privateer/sbin:/dtv/usb/sda1/SamyGO/opt/privateer/bin:/dtv/usb/sda1/SamyGO/opt/privateer/usr/bin:/dtv/usb/sda1/SamyGO/opt/privateer/usr/sbin:/dtv/usb/sda1/SamyGO/sbin:/dtv/usb/sda1/SamyGO/bin:/dtv/usb/sda1/SamyGO/usr/bin:/dtv/usb/sda1/SamyGO/usr/sbin:/sbin:/bin:/usr/sbin:/usr/bin"
export ENV="/dtv/.ashrc"
export FRAMEBUFFER="/dev/sam/fb0"
export DISTROOT="/dtv/usb/sda1/SamyGO/opt/privateer"
It is strange but in dtv root i have 5 Vusb

Code: Select all

/ # cd dtv
/dtv # ls -a
.                     event4                notify.tdb
..                    gencache.tdb          notify_onelevel.tdb
.ashrc                gencache_notrans.tdb  passdb.tdb
.auth_finish          hidraw0               pcm_in
PART_FLAG_0           hidraw1               pp
SGO.env               hidraw2               secrets.tdb
YWE                   hidraw3               sessionid.tdb
apache_error_log      hidraw4               smbd-smb.conf.pid
brlock.tdb            httpd.pid             usb
cgi-bin               info                  vusb1
connections.tdb       input                 vusb2
dropbear.pid          lock                  vusb3
event0                locked                vusb4
event1                locking.tdb           vusb5
event2                messages.tdb          www
event3                mutex.tdb
but in mediaplayer i can see only the real usb device