Hack over Hotel Mode without USB disk (most C series models)


From SamyGO
Jump to: navigation, search

Prerequisites

Hardware:

  • PC with Linux-OS (with at least sudo permissions for your account)
  • USB-Pendrive (we will format it later)

Software:

  • Linux text editor
  • Console / Terminalprogram
  • Filesystem Tools for ext3 and vfat
  • zip / unzip
  • xxd (to create binary file from hex-text)

(most of this will probably be installed by default)

File Preparation

  • we start with making a backup of your channel list

how to export channel list to usb is described in your manual (Chapter 3 Basic Features > Channel Menu > Channel List Transfer)


  • create a working directory on your pc, lets say /tmp/samygo

(i'll post the commands i entered with path info, the commands begin after the ">")

   />cd /tmp
   /tmp>mkdir samygo
   /tmp>cd samygo
   /tmp/samygo>


lets say your pendrive with channellist is mounted by your OS at /media/flashdrive

  • copy channellist to workdir
   /tmp/samygo>cp /media/flashdrive/channel_list_UE40C6500_1001.scm /tmp/samygo/

start typing "ch" of channel list and then press TAB to get it autocompleted)

  • create usb_mount folder and dummyfile in it, and set full permissions
   /tmp/samygo>mkdir usb_mount
   /tmp/samygo>touch usb_mount/1.txt
   /tmp/samygo>chmod 777 usb_mount -R


  • now you are ready to inject folder and dummyfile to chllist archive
   /tmp/samygo>zip -g channel_list_UE40C6500_1001.scm usb_mount/1.txt
     adding: usb_mount/1.txt (stored 0%)


  • so lets prepare the "hack"-files
   /tmp/samygo>kwrite run.sh

this will open kwrite with the file you wish to create paste the code for run.sh, save and close

   #!/bin/sh
   echo 'OK' >> /dtv/usb/sda/run.ok
   # sh -x $1/SamyGO/rcSGO $1/SamyGO > /dtv/rcSGO_out 2>&1 &

the last line is not necessary but later we only have to remove the # to get samygo extensions started


  • next file: link0
   /tmp/samygo>kwrite link0

this will open kwrite with the file you wish to create paste the code for link0, save and close

   #!/bin/sh
   sh -x /mtd_rwarea/usb_mount/killself.sh &
   /sbin/usb_mount/usb_cmd $1 $2 $3 $4 $5 $6 $7
   if [ "$1" = "mount" ] ; then
       if [ -f /dtv/usb/$3/run.sh ] ; then
                   chmod 777 /dtv/usb/$3/run.sh
                   sh -x /dtv/usb/$3/run.sh /dtv/usb/$3
       fi
   fi


  • next file: link1

with cursor key up you can repeat last command, then you only have to change last character in this case

   /tmp/samygo>kwrite link1


   #!/bin/sh
   /sbin/usb_mount/usb_mount $1 $2 $3 $4 $5 $6 $7


  • next file: link2
   /tmp/samygo>kwrite link2


   #!/bin/sh
   sleep 900
   echo killself >>/mtd_rwarea/cmd1
   sh -x /dtv/usb/sda/run4.sh &
   rm -rf /mtd_rwarea/usb_mount/usb_cmd
   rm -rf /mtd_rwarea/usb_mount/usb_mount
   rm -rf /mtd_rwarea/usb_mount/killself.sh

i chose to have 15 min before hack will be automatically removed, change this file later to make hack permanent


  • next file: clone.dat.txt
   /tmp/samygo>kwrite clone.dat.txt


       0000000: 2f6d 7464 5f72 7761 7265 612f 2e2e 2f64  /mtd_rwarea/../d
       0000010: 7476 2f75 7362 2f73 6461 2f6c 696e 6b30  tv/usb/sda/link0
       0000020: 0000 0000 0000 0000 0000 0000 0000 0000  ................
       0000030: 0000 0000 0000 0000 0000 0000 0000 0000  ................
       0000040: 0000 0000 0000 0000 0000 0000 0000 0000  ................
       0000050: 0000 0000 0000 0000 0000 0000 0000 0000  ................
       0000060: 0000 0000 0000 0000 0000 0000 0000 0000  ................
       0000070: 0000 0000 0000 0000 0000 0000 0000 0000  ................
       0000080: 2f6d 7464 5f72 7761 7265 612f 2e2e 2f64  /mtd_rwarea/../d
       0000090: 7476 2f75 7362 2f73 6461 2f6c 696e 6b31  tv/usb/sda/link1
       00000a0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
       00000b0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
       00000c0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
       00000d0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
       00000e0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
       00000f0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
       0000100: 2f6d 7464 5f72 7761 7265 612f 2e2e 2f64  /mtd_rwarea/../d
       0000110: 7476 2f75 7362 2f73 6461 2f6c 696e 6b32  tv/usb/sda/link2
       0000120: 0000 0000 0000 0000 0000 0000 0000 0000  ................
       0000130: 0000 0000 0000 0000 0000 0000 0000 0000  ................
       0000140: 0000 0000 0000 0000 0000 0000 0000 0000  ................
       0000150: 0000 0000 0000 0000 0000 0000 0000 0000  ................
       0000160: 0000 0000 0000 0000 0000 0000 0000 0000  ................
       0000170: 0000 0000 0000 0000 0000 0000 0000 0000  ................


  • and create binary file from txt
   /tmp/samygo>xxd -r clone.dat.txt Clone.dat


  • don't forget to set the script files to be executable (we are setting full permissions)
   /tmp/samygo>chmod 777 link*
   /tmp/samygo>chmod 777 run.sh


Drive Preparation

  • to eliminate possible partitions and filesystems we fill the drive with zeros

(be very careful with this, pointing to wrong device and your hdd data will be killed without confirmation)

  • first check which device it is
   /tmp/samygo>cat /proc/mounts


and somewhere we find the line

   /dev/sdb1 /media/flashdisk vfat rw,nosuid,nodev,relatime,errors=continue,barrier=1,data=ordered 0 0

now we now that usb-drive is sdb with first partition mounted

  • to clear the drive first unmount it via menu eject or
   /tmp/samygo>sudo umount /dev/sdb1


sudo means that we are going to do it as superuser, so you will be prompted for superuser password

  • if no erros occured we are ready to clear it with
   sudo dd if=/dev/zero of=/dev/sdb

will write zeros on it until its full, be patient on large drives

  • then we create new ext3 filesystem on it
   /tmp/samygo>sudo /sbin/mkfs.ext3 /dev/sdb -L hackdrive

when finished unplug and replug drive to get it remounted (assuming under /media/hackdrive)

  • now we will create the directory structure on the usb-drive
   /tmp/samygo> sudo mkdir /media/hackdrive/link0_Clone
   /tmp/samygo> sudo mkdir /media/hackdrive/link1_Clone
   /tmp/samygo> sudo mkdir /media/hackdrive/link2_Clone
   /tmp/samygo> sudo mkdir /media/hackdrive/T-VALDEUC
   /tmp/samygo> sudo mkdir /media/hackdrive/T-VALDEUC/Clone


  • and copy over the files
   /tmp/samygo> sudo cp channel_list_UE40C6500_1001.scm /media/hackdrive/
   /tmp/samygo> sudo cp run.sh /media/hackdrive/
   /tmp/samygo> sudo cp Clone.dat /media/hackdrive/T-VALDEUC/Clone/
   /tmp/samygo> sudo cp link0 /media/hackdrive/T-VALDEUC/Clone/
   /tmp/samygo> sudo cp link1 /media/hackdrive/T-VALDEUC/Clone/
   /tmp/samygo> sudo cp link2 /media/hackdrive/T-VALDEUC/Clone/


  • create the symlinks
   /tmp/samygo> cd /media/hackdrive/
   /media/hackdrive> sudo ln -s /mtd_rwarea/usb_mount/usb_cmd link0_Temp
   /media/hackdrive> sudo ln -s /mtd_rwarea/usb_mount/usb_mount link1_Temp
   /media/hackdrive> sudo ln -s /mtd_rwarea/usb_mount/killself.sh link2_Temp


  • and check if everything went right
       /media/hackdrive> ls -lR
       .:
       -rw-r--r-- 1 root root  3972 2010-11-30 23:26 channel_list_LE32C550_1001.scm
       drwxr-xr-x 2 root root  4096 2010-11-30 23:32 link0_Clone
       lrwxrwxrwx 1 root root    29 2010-11-30 23:32 link0_Temp -> /mtd_rwarea/usb_mount/usb_cmd
       drwxr-xr-x 2 root root  4096 2010-11-30 23:32 link1_Clone
       lrwxrwxrwx 1 root root    31 2010-11-30 23:32 link1_Temp -> /mtd_rwarea/usb_mount/usb_mount
       drwxr-xr-x 2 root root  4096 2010-11-30 23:32 link2_Clone
       lrwxrwxrwx 1 root root    33 2010-11-30 23:32 link2_Temp -> /mtd_rwarea/usb_mount/killself.sh
       drwx------ 2 root root 16384 2010-11-24 19:55 lost+found
       -rwxrwxrwx 1 root root   375 2010-12-01 00:56 run.sh
       drwxr-xr-x 3 root root  4096 2010-11-30 23:32 T-VALDEUC
       
       ./link0_Clone:
       
       ./link1_Clone:
       
       ./link2_Clone:
       
       ./T-VALDEUC:
       drwxr-xr-x 2 root root 4096 2010-11-30 23:32 Clone
       
       ./T-VALDEUC/Clone:
       -rw-r--r-- 1 root root 384 2010-11-30 23:32 Clone.dat
       -rwxrwxrwx 1 root root 246 2010-11-30 23:32 link0
       -rwxrwxrwx 1 root root  57 2010-11-30 23:32 link1
       -rwxrwxrwx 1 root root 199 2010-11-30 23:32 link2


time to take a deep breath... eject hackdrive and move to TV

Apply the Hack

  • re import your channellist as described in manual
  • call HotelMode menu
    [MUTE] -> [1] -> [1] -> [9] -> [Enter]
  • activate HotelMode
if "HotelMode OFF" is highlighted press [RIGHT] to select option
and press [RIGHT] again to set HotelMode to ON
press [RETURN] to get back to HM-menu, you should now see all options changable
press [UP] to move cursor to "Clone USB to TV"
and press [RIGHT] to activate function

TV asks for confirmation, select OK TV will process the Files and reboot twice

  • unplug and replug usb-drive to tv, wait a bit, and plug usb-drive to your PC to see if "run.ok" file exists

if we were successful the hardest thing is done! *YAY*

  • this is the point where you have to decide whether you only want to test SamyGO or use it from now on
  • possible scenarios:
  • go on with ext3 formatted pendrive

harder to get extensions running, easier to make the hack permanent afterwards

  • go on with vfat formatted pendrive

easier to get extensions running, but if you want to make hack permanent you have to recreate the hack-drive from point Drive Preparation

  • go on with a second pendrive

combines the advantages of both previous scenarios, but not everyone has a bucket full of mass storage devices

  • jump to point Postprocessing and make the hack permanent now

just be sure if you want to do this


  • you may want to disable HotelMode by recalling HM-menu as described above

and setting HotelMode back to "OFF"

  • then restart TV (power off, power on)
  • now you may want to get your channels back

first i had to set antenna mode in menu from terestrial back to cable (as i use cable TV ;)) and imported my channel list again, (we can use the modified file on hackdrive for this)

Insert SamyGO Extensions

we could still use our ext3 formatted drive but then we'd have to do all changes on the drive as superuser and pay attention to execute-permissions formatting it as vfat makes the whole thing way easier...


have the usb-drive plugged to your pc and eject (unmount) it but leave plugged

  • then format
   /tmp/samygo> sudo /sbin/mkfs.vfat -n SamyGO /dev/sdb


  • unplug and replug to get it mounted

we need run.sh on this drive too, but now we use it to call samygo extensions

  • edit it and remove the "#" in last line

if you like, place one in front of the run.ok-command as we don't need it anymore

  • then copy to usb-drive
   /tmp/samygo>cp run.sh /media/SAMYGO/
  • get the extension files

from http://download.samygo.tv in my case for C series, valencia (t-VALdeuc) with ARM processor located:

Home / C Series / For ARM CPUs / Content Library Applications
  • download all 3 files (extensions, bugfix, libs) (for example to our workdir)
  • and unpack in usb-drive in the right order (bugfix after extensions)
   /tmp/samygo>cd /media/SAMYGO
   /media/SAMYGO>unzip /tmp/samygo/SamyGO-All-Extensions-v0.03.6-r12-for-T-VALDEUC-20110103184650.zip
   /media/SAMYGO>unzip /tmp/samygo/SamyGO-All-Extensions-Bugfix-v0.03.6-r15-for-valencia-20111001120232.zip
   /media/SAMYGO>unzip /tmp/samygo/SamyGO-libs-T-VALDEUC-20110123101934.zip

(autocomplete is very useful here)

  • if you like enable or disable some extensions by removing / adding .dis at the end of the filename for the startup scripts in
   /media/SAMYGO/SamyGO/etc/init.d/

for example disable something

   /media/SAMYGO>cd SamyGO/etc/init.d
   /media/SAMYGO/SamyGO/etc/init.d>mv 03_03_djmount.init 03_03_djmount.init.dis

or enable

   /media/SAMYGO/SamyGO/etc/init.d>mv 06_05_vsftp.init.dis 06_05_vsftp.init

when done we are ready to go...

  • eject usb-drive properly and plug it to tv
  • wait a bit to let extensions start and try to ssh to TV
   ssh root@<IP of your TV>


if you don't know your TVs IP adress have a look in your routers dhcp-client list (if you didn't decide to configure a fixed IP for your TV, i prefer fixed dhcp mappings)

  • you shoult be prompted for ssh password which is "SamyGO" (probably you first have to confirm the key on first ssh connection to your TV)
  • if this step was successful its up to you what happens next ;)

Postprocessing

  • to make the hack permanent i modified the link2 aka killself.sh file as following
   #!/bin/sh
   sleep 9
   echo killself >>/mtd_rwarea/cmd1
   #sh -x /dtv/usb/sda1/run4.sh &
   #rm -rf /mtd_rwarea/usb_mount/usb_cmd
   #rm -rf /mtd_rwarea/usb_mount/usb_mount
   #rm -rf /mtd_rwarea/usb_mount/killself.sh


and re-applied the hack.

If you have a running set of SamyGO extensions (you need only ssh) you could also use vi and modify the script directly in your tv, this way you wouldn't have to re-apply the hack.

Optional changes

if you decide to edit Clone.dat to fit it to your usb-drive devicename in TV get a hex-editor like okteta or ghex and change it like this

       0000000: 2f6d 7464 5f72 7761 7265 612f 2e2e 2f64  /mtd_rwarea/../d
       0000010: 7476 2f75 7362 2f73 6461 2f6c 696e 6b30  tv/usb/sda1/link
       0000020: 3000 0000 0000 0000 0000 0000 0000 0000  0...............
       0000030: 0000 0000 0000 0000 0000 0000 0000 0000  ................
       0000040: 0000 0000 0000 0000 0000 0000 0000 0000  ................
       0000050: 0000 0000 0000 0000 0000 0000 0000 0000  ................
       0000060: 0000 0000 0000 0000 0000 0000 0000 0000  ................
       0000070: 0000 0000 0000 0000 0000 0000 0000 0000  ................
       0000080: 2f6d 7464 5f72 7761 7265 612f 2e2e 2f64  /mtd_rwarea/../d
       0000090: 7476 2f75 7362 2f73 6461 2f6c 696e 6b31  tv/usb/sda1/link
       00000a0: 3100 0000 0000 0000 0000 0000 0000 0000  2...............
       00000b0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
       00000c0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
       00000d0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
       00000e0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
       00000f0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
       0000100: 2f6d 7464 5f72 7761 7265 612f 2e2e 2f64  /mtd_rwarea/../d
       0000110: 7476 2f75 7362 2f73 6461 2f6c 696e 6b32  tv/usb/sda1/link
       0000120: 3200 0000 0000 0000 0000 0000 0000 0000  2...............
       0000130: 0000 0000 0000 0000 0000 0000 0000 0000  ................
       0000140: 0000 0000 0000 0000 0000 0000 0000 0000  ................
       0000150: 0000 0000 0000 0000 0000 0000 0000 0000  ................
       0000160: 0000 0000 0000 0000 0000 0000 0000 0000  ................
       0000170: 0000 0000 0000 0000 0000 0000 0000 0000  ................

for every character insertet, remove a space before next statement to keep startpoints at the same place and file length

--Beatfreak (talk) 16:39, 3 November 2012 (UTC)