Introduction

Peer-to-peer sharing of data has become one of the most popular ways of transferring files over the internet but has been mostly restricted to the pc domain. Recently there have been shifts towards other types of devices. One example being aTorrent[8] for android phones. Another being SwiftIpad[9] for the iPad. One platform that has remained untouched is the Television, a device that has never changed its purpose since the invention of it. Our goal is bring peer-to-peer to the TV and introduce a new way of viewing content on the TV. With the functionality that libswift offers we are able to make streaming content possible through a completely decentralized system.

Libswift on a TV

This article briefly describes the project to get a peer-to-peer application using libswift running on a Samsung D-Series Smart TV with a proof-of-concept application to stream, download and search content with the use of dispersy [1]. Since the latest LED TV series of Samsung make use of a linux kernel, it is possible to create applications for it. In this project, we tested our app on a UE40D7000 Samsung TV [2], which was rooted with tools provided by the SamyGO team [3]. At the end of this page, we will include a package with everything needed to get the application running on your TV.

For now, here is a step by step process to get the application running on your TV. We will be adding screenshots and more info as soon as we can. We are also planning to create an install script to make the whole process a bit easier.

Required hardware

  • Any Samsung D-series TV using an armv7 processor with Smart Hub with a firmware <= 1018.0 (needed to get root access with SamyGO tools [3])

Required software

  • git
  • gcc-toolchain for armv7 [7] (Look for VDLinux-armv7a8-toolchain-lite_20100630 on the website)
  • Samsung 3.1.1 SDK for D series TV. [4] (Not tested with 3.5 SDK)

How to root your TV

If you are absolutely sure that your TV is rootable (check [5]), then go ahead and follow the steps on [3] to root your TV.

Once the tv is rooted, try opening a shell on the TV via your terminal.

nc <ip_of_tv> 1023

Installing the application

Now the TV is rooted, it should be pretty straightforward to install the application with all its dependencies. Just download the install.tar.bz2 file, which can be found in the attachments, and upload it to the TV using ftp. It does not matter where you put it. Unpack it there and rename either the "11_UE_UAxxD6xx0 modules" or the "11_UE_UAxxD7xx0 modules" folder to "modules", depending on the TV model you use. These folders can be found in the install folder.

After renaming the folder, connect to the TV using netcat and open up a shell terminal. Make sure that you have the right privileges to run the install script, which can be found in the install folder. You can add privileges by running "chmod +x ./install.sh". Run the install script, this should move everything to the correct locations and set everything up.

./install.sh

The application can then be run after a reboot. This is tested for the Samsung D6000 and D7000 series, it is possible that this script will not work on other series. If that is the case, it is still possible to install the application manually, for which a guide can be found in the next sections.

Compiling the application back end

Compiling libswift for the TV is pretty straightforward, assuming you already grabbed the gcc-toolchain for the TV. Extract the archive with the gcc-toolchain and add the bin path in that folder to the $PATH variable in your .bashrc.

example;

export PATH=$PATH:/opt/VDLinux-armv7a8-toolchain-lite_20100630/bin

Clone our github repository:

git clone git://github.com/jettan/swiftarm.git

Add the following exports to your .bashrc in order to get the environment variables right.

export SWIFTARM=<PATH_CLONED>

export PYTHONOPTIMIZE=yes

export PYTHONPATH=$PYTHONPATH:<PATH CLONED>/tribler

example:

export SWIFTARM=/home/jettan/Documents/swiftarm

export PYTHONOPTIMIZE=yes

export PYTHONPATH=$PYTHONPATH:/home/jettan/Documents/swiftarm/tribler

Now manually add libpython2.6.so and libz.so (see the python_libs attachment) to your toolchain folder in arm-v7a8-linux-gnueabi/lib. Don't forget to source your .bashrc.

Now we can compile the application:

cd $SWIFTARM/server/src

./build arm

Setting up the TV

After the TV has been rooted you have a very bare system that can't really do much. To make your life easier, we have prepared a package below with lots of handy tools like bash, lots of missing libraries, and modified init scripts so everything will work as it should. Instead of the netcat sh, you will be able to use bash.

This next part is about getting the application onto the TV and is fairly tedious to do it manually.

First of all, download your favourite FTP client, we like to stick with nautilus. When using Filezilla, make sure you have binary mode on! Otherwise you are just going to end up with segfaults. Also, make sure your TV's auto-standby function is turned off. There is also a time-out when using FTP and you're not doing anything for a few minutes, so when an error randomly occurs, don't panic and just unmount the FTP filesystem and mount it again.

Setting up FTP

First, connect to the TV via FTP. Figure out what the ip address of your TV is in the internet settings of the TV.

The first thing we will copy is the required binaries. Go to the following folder in your TV.

/mtd_down/widgets/user/SamyGO/SamyGO

Replace the entire bin folder with the bin folder in the install folder you downloaded.

Next, we will add the .bashrc to make life a little easier. Add the .bashrc in the attachments to the following folder.

/mtd_down

Adding python includes

Copy the include folder from the attachment to the following directory

/mtd_down/widgets/user/SamyGO/SamyGO/opt/privateer

Adding libraries

After this we will be adding the libs folder. These are pretty large files so this may take a while. We will add the attachment ASAP.

Copy all the files in lib folder from the attached archive to:

/mtd_down/widgets/user/SamyGO/SamyGO/opt/privateer/lib

Overwrite everything if asked.

Adding iptables

Due to some issues with the JavaScript side of the app sending RST packets when it shouldn't we also need to add iptables. Create a modules folder in the following location.

/mtd_down/widgets/user/SamyGO/SamyGO

Then, copy the module files from the right folder depening on your TV model.

Overwrite first init script

Now we will overwrite the first init script called 01_01_catch_crap.init​ so that bash is started properly. Overwrite 01_01_catch_crap.init​ with the one in the attachments to the following folder.

/mtd_down/user/widgets/SamyGO/SamyGO/etc/init.d

Overwrite second init script

Once this is working we can continue to the next step, adding the second init file, called 02_04_vusb.init, that will start our application. Overwrite it the same way as the previous one.

/mtd_down/user/widgets/SamyGO/SamyGO/etc/init.d

Adding our application

First we need to add the tribler folder which can be found in

cd $SWIFTARM

Copy the tribler folder to

/mtd_down/widgets/user/SamyGO/SamyGO

It is time to add the application you compiled a little while ago. It is called ws and can be found in...

$SWIFTARM/server/src

Copy the binary ws to...

/mtd_down/widgets/user/SamyGO/SamyGO/tribler

Once this is done reboot the TV and root your TV again by running SamyGO. Bash should be working now with a more friendly environment. Try netcatting to your TV through port 1024 instead of 1023.

nc <ip_of_tv> 1024

You can check whether the application is running by connecting to the TV via netcat. It might take a while before it appears.

pstree | grep ws

If it finds a process called ws, it is working. To really check you can go to your browser and go to the following site.

http://<ip_of_tv>:1337/alive

If the word "Alive" is displayed on the page, the application is running.

Adding the JavaScript part of the application

All that remains is adding the JavaScript part of the application. In the swiftarm folder you downloaded from git there is a folder called swift_p2p_tv. Copy this folder to the following location on the TV.

/mtd_down/widgets/user

Restart your TV and the application should appear on the Smart Hub. Don't forget to run SamyGO again before starting our app.

In principle everything should work properly now, if not, make sure you completed all the steps correctly. Otherwise, try killing ws and start it on your own.

nc <ip_of_tv> 1024

killall -9 ws

cd tribler

./ws

External Links

Attachments