Autoloader for extra exeDSP plugins (B65x)


From SamyGO
Revision as of 21:55, 6 May 2010 by Geo650 (talk | contribs)
Jump to: navigation, search

Plugin? What is this for ?

Extra exeDSP plugin is a dynamically-loaded library file (*.so) that may be executed using "Game" menu of the Content Library. Typically, such plugin (that may be called a "Game") is brought to you together with "clmeta.dat" XML file that points to the main library file to be started ("loader.so", for example). There are many plugins already made by SamyGO community. (Almost) all of them require to be run from Content Library "Game" submenu.

The problem is...

You cannot execute such plugins using starting script. You even cannot run them using telnet shell. So, they cannot be started automatically. Even if you make an application that run any plugin, then exeDSP functions (symbols) would be unknown. These functions are used by plugins for accessing of hardware layer easily.

Why to autostart ?

Some plugins are intended to be run in the background. Unfortunately, you have to enter Content Library to execute them. This is confusing in some situations. Autostarting is useful for staying resident applications that are waiting for a specified signal to execute a piece of its code. Starting plugins automatically will save your remote control, your fingers and... your nerves.

Then how to autostart my plugin ? What should I do ?

You have to load the plugins using exeDSP in a way like Content Library does. Content Library is started by exeDSP application. Then it loads the plugin and calls its Game_Main() function. The problem is that exeDSP is a closed-source binary and there is hard to modify its functions. So I decided to load our plugins (libraries) using another open-source library which is loaded by exeDSP. One of such libraries is libusb (libusb.so), typically loaded from /mtd_drv/Comp_LIB directory.

We have to force exeDSP to load our custom libusb library instead of original one. The directory with the original library file is read-only one, so we will modify LD_LIBRARY_PATH variable. The drawing below may be helpful to understand this method:

Libusb fig1.gif


Before you start...


WARNING!

Read the whole article first. Don't start if you doesn't understand anything. All problems can be solved on forum before bricking your TV. Please be careful. I am not responsible for your mistakes. You are doing it on your own risk.


What do I need?

  • Samsung LExxB65xT2W model with 2005.0 firmware (I don't know if it works on other models)
  • telnet access to your TV (see: How to enable Telnet on samsung TV's), or firmware update will enable telnet for you
  • very basic knowledge of Linux operating system

Optional things:

  • ex-link cable + terminal with RS232C port (for recovery purposes)
  • compilation toolchain environment (see: Setting up a cross-compilation toolchain)
  • FTP server running on your TV (or you can copy binary files using pendrive)


Steps

1. Download patcher for your firmware (only T-CHL7DEUC 2005.0 is supported at the moment) firmware patcher archive for Windows

CAUTION! This firmware patcher is incompatible with today's SamyGO rules. It uses only /mtd_rwarea/SamyGO directory with autorun.sh and exeDSP.sh scripts inside. It doesn't run /mtd_rwarea/SamyGO.sh script! For more informations go to this thread.

2. Extract firmware patcher to any directory, put the firmware archive (T-CHL7DEUC.exe) in the same directory.

3. Run geo1patch.bat script to patch the firmware.

4. Copy T-CHL7DEUC folder to a pendrive and flash your TV. Remember to save TV channels, make backups and disable special scripts on your TV before flashing!

5. After flashing, your TV should start as usual. Continue TV's installation process.

6. Optional: you can re-enable DEBUG MODE for RS232C service port in the service menu.

7. Login to your TV using telnet (make sure you know your TV's IP address before).

8. Create directory tree:

mkdir /mtd_rwarea/SamyGO
mkdir /mtd_rwarea/SamyGO/exe
mkdir /mtd_rwarea/SamyGO/exe/lib
mkdir /mtd_rwarea/SamyGO/exe/conf

9. Create /mtd_rwarea/SamyGO/exeDSP.sh file containing:

#!/bin/sh

export LD_LIBRARY_PATH="$SamyGOpath/exe/lib:$LD_LIBRARY_PATH"
cd /mtd_exe
./exeDSP

#failed ?
sleep 1
export LD_LIBRARY_PATH=`echo $LD_LIBRARY_PATH | cut -d : -f 2-`
# exit to "flipped" original exeDSP in rc.local...

where $SamyGOpath is exported from /mtd_exe/rc.local calling script and equals to "/mtd_rwarea/SamyGO".

HINT: To create new text file in linux, you can use vi comand like this:

vi /mtd_rwarea/SamyGO/exeDSP.sh

then you press [i] key, enter your text, then press the following keys: [ESC], [:], [w], [q], [ENTER] and your file will be saved.

10. Set executable flag to exeDSP.sh script:

chmod a+x /mtd_rwarea/SamyGO/exeDSP.sh

11. Download modified LIBUSB...


To be continued soon...

Under construction.

Meanwhile, take a look at this discussion.

--Geo650 21:55, 6 May 2010 (UTC)