Mounting an CIFS/SAMBA share on a USB device to bypass DLNA


From SamyGO
Jump to: navigation, search

This is article about mounting CIFS shares on Samsung TVs. Tested on LExxB65x.

Neither this WIKI/Forum nor the author(s) of articles and information provided accept any responsibility for damage that may be caused by use of the information provided. You do everything at your own risk. Be aware that "hacking" activities do void your warranty!

What we need?

Preperation

  • Share at least one directory (right click on directory -> sharing -> share this folder)
  • Download cifs.ko module from SamyGO Samba Kernel Module.zip
  • Unzip and copy cifs.ko file to pendrive or nfs share that is mounted or will be mounted on TV
  • Plug pendrive to TV / mount nfs share containing cifs.ko
  • Copy cifs.ko to /mtd_rwarea/
cp /dtv/usb/sdXX/[path_to_cifs.ko] /mtd_rwarea/ 

Virtual USB

  • download some SamyGO All Extensions for example this one [[1]]
  • unzip the package
  • go to the Folder .\SamyGO\lib\modules\2.6.18_SELP-ARM\kernel\drivers\usb\gadget
  • there is 2 files named dummy_hcd.ko and g_file_storage.ko, copy this files to your USB Drive
  • plug the drive to your tv and copy this files to /mtd_rwarea/
cp /dtv/usb/sdXX/dummy_hcd.ko /mtd_rwarea/
cp /dtv/usb/sdXX/g_file_storage.ko /mtd_rwarea/
  • Load Kernelmodules for VUSB
#Loading Kernelmodules for VUSB
dd if=/dev/zero of=/dtv/vusb bs=512 count=4

insmod /mtd_rwarea/dummy_hcd.ko
sleep 3

insmod /mtd_rwarea/g_file_storage.ko
sleep 3

echo -e "[sda]
Vendor : CifsMount
Product : VUSB
Serial : Q80VQLFH
Devpath : 8
Lun : 0
MountDir : /dtv/usb/sda1
FileSystem : vfat
" >> /dtv/usb/log   

Mounting cifs share

  • Load cifs.ko module once
insmod /mtd_rwarea/cifs.ko
  • Now You can mount cifs share:
mount -o user=<username>,password=<password> -t cifs //<server>/<share> /dtv/usb/sdXX/[mount_path]

Example of mounting script

  • Mounting cifs share to existing directories on connected to tv pendrive:
#!/bin/sh

#Load cifs.ko module
insmod /mtd_rwarea/cifs.ko

#Mount cifs shares (check if something is mounted already)
if [ `mount | grep -c /dtv/usb/sda1/Media` == 0 ]; then 
     mount -o user=user1,password=pw123 -t cifs //192.168.0.2/videos /dtv/usb/sda1/Media
if [ `mount | grep -c /dtv/usb/sda1/Music` == 0 ]; then
     mount -o user=otheruser,password=somepassword -t cifs //192.168.0.5/music /dtv/usb/sda1/Music
  • Mounting cifs share to virtual usb drive:
#!/bin/sh

#Load cifs.ko module
insmod /mtd_rwarea/cifs.ko

#Create directory structure on virtual usb memory:
mkdir -p /dtv/usb/sda4
mkdir -p /dtv/usb/sda4/Media
mkdir -p /dtv/usb/sda4/Music

if [ `mount | grep -c /dtv/usb/sda4/Media` == 0 ]; then 
     mount -o user=user1,password=pw123 -t cifs //192.168.0.2/videos /dtv/usb/sda4/Media
if [ `mount | grep -c /dtv/usb/sda4/Music` == 0 ]; then
     mount -o user=otheruser,password=somepassword -t cifs //192.168.0.5/music /dtv/usb/sda4/Music

# append sda4 notification to log file:                                         

echo "[sdd]                                                                    
Vendor : Linux                                                                 
Product : [name_visible_in_source_selection]                                                             
Serial : Q80VQLFL                                                              
Devpath : 4                                                                    
Lun : 0                                                                        
MountDir : /dtv/usb/sda4                                                       
FileSystem : vfat                                                              
                                                                               
" >> /dtv/usb/log                

For safety reasons it is recommended that you run these (and others) scripts with "&" at the end (this will run script at background and in case of script failure this will prevent TV system freeze). Also be sure to allow these scripts being executed:

chmod 755 cifs_mount.sh

Notes

  • Remember to be sure that windows user that You use to mount cifs share have permission to read shared directory
  • (to be checked/confirmed - my attempts to mount cifs share using windows user without password failed - there wasnt any error, mount was listed in mount list but there simply weren't any files in directory that cifs share was mounted to, but mount worked flawlessly when i mounted using user with nonblank password - can anyone confirm that this is normal? I remember i was reading somewhere that to access windows share user password is necessary but it was some time ago. So if this will be confirmed - add part below)

    Cifs share requires windows user with non-blank password (i mention it because in their homes people quite often dont use passwords). If You dont have password on all of Your windows accounts and You want to keep it that way You can create new windows account with password (in control panel -> user accounts) and to keep Your login screen clean You can hide this account from login screen:
    • Run Registry Editor (RegEdit.exe).
    • Navigate to the following registry key:

      HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\SpecialAccounts\UserList

      Special Accounts User List

      Note: If SpecialAccounts and UserList is not found, create new sub-key and name them accordingly.
    • Select UserList, and in the right pane, right click on any blank space, and point to New -> DWORD (32-bit) Value.
    • Name the new DWORD registry value name as the exact same name that match the name of the user account to be hidden.

      For example, if the user ID of the user account is John, the name the registry value as John.
    • Double click on DWORD registry value, and set the value data to 0 in oder to hide the account from Welcome Screen.

      Tip: To display the user account on Welcome Screen again so that it’s visible again, delete the registry entry, or set the value data to 1.
    • Exit Registry Editor.

Credits