How to remotely turn off the TV?

Here for general support for D series TVs, request and problem solve area.

rol
Posts: 62
Joined: Sat Jul 28, 2012 11:44 am

How to remotely turn off the TV?

Post by rol »

I have written a Tcl/Tk script to copy the recent encrypted recordings with FTP and the shared folder, decrypt them on the fly using DRMDecrypt and replace them on the TV. The script works pretty well, and since it's a long operation, it can optionally shuts the local computer down when the transfer is complete, so that the operation can be done during the night.

However, currently, it is unable to turn the TV off. I have tried all remote controller programs I've found here, but none of them work, except the ruTVCommunicator, too complex for that usage. I would like to know if it is possible to turn off the TV with a simple HTTP command, or something similar. Any pointer will be much appreciated.

I have the UE40D6500 with T-GASDEUC-1018.0 with the D-Series rooting and hospitality mode hack explained here. As I have a recent firmware, it doesn't work completely, but I have FTP and Samba running correctly. As far as I know, my firewall doesn't block the communication between my PC (Win7 X64) and the TV.

I would prefer not to have to install additional apps or revert to an older firmware.
Someone know if it is possible to control the TV from the PC? How are the remote programs supposed to work?

Thanks in advance!
oga83
Posts: 268
Joined: Sun Mar 18, 2012 10:11 pm
Location: France

Re: How to remotely turn off the TV?

Post by oga83 »

If you don't want to implement Samsung Remote protocol, you have the quick&dirty method :
- Open TCP socket on port 55000
- Send connection file
- Send key file
- Close socket

Here are the files :
connect.bin : frame for connection.
You have to modify some fileds to make it work :
@17 : Length of following message (adjust it if you change the size of the following fields)
@1b : length of next field (Base64-IP)
@1d : Your IP in Base64
@2d : length next field (Base64-MAC)
@2f : Your MAC address in Base64

poweroff.bin : frame for KEY_POWEROFF
bdpoweroff : frame for BD_KEY_POWER if someone is using a BD
frames.zip
Alternatively, you can use
- FANet throught serial or usb
- Arduino to send an IR code with a simple HTTP get (http://wiki.samygo.tv/index.php5/Ethern ... _Interface)
The url for TV power off is http://IP/ir.htm?data=98&type=00&device=0707
You do not have the required permissions to view the files attached to this post.
Last edited by oga83 on Wed Aug 29, 2012 5:04 pm, edited 3 times in total.
rol
Posts: 62
Joined: Sat Jul 28, 2012 11:44 am

Re: How to remotely turn off the TV?

Post by rol »

Thanks a lot for your explanation.

I think I'll try the HTTP Get method first. It seems easier. If I can't get it to work, I'll try the TCP method.

Just a clarification: when you write "your IP" and "your MAC address", it's the IP and MAC of the local PC, right?
rol
Posts: 62
Joined: Sat Jul 28, 2012 11:44 am

Re: How to remotely turn off the TV?

Post by rol »

OK, tried the HTTP Get method, but it doesn't work. It requires the hardware?

So, now, I'm trying to use the TCP method. I can generate the connect.bin frame, except that I don't understand what the byte at address 9 is supposed to contain. You wrote "@09 : Length of following message (adjust it if you change the size of the following fields)". But in your example, the two fields (the IP and MAC address) have a total length of 40 bytes (without the 4 bytes used to store their length), so the value at address 9 should be 40 or 44, but your example contains 0x2E (dec 46). So, how can I compute the correct value of that field? Can I assume that it should be the length of the IP + the length of the MAC + 6? Or am I completely wrong?

Is it a thread somewhere that explains how to send the codes with that TCP method? I've searched the forum, but can't find it.
rol
Posts: 62
Joined: Sat Jul 28, 2012 11:44 am

Re: How to remotely turn off the TV?

Post by rol »

Success! I've managed to turn off the TV using the TCP method.

Currently, I have just forced 0x2E at address 9, as luckily the length of my base64 encoded IP is identical to the length of the IP in your example (and I guess the length of all MAC addresses is always the same). But I would still like to understand what value must be put at address 9 in the connect frame, just to be sure that it will still work if the IP changes. Also, maybe I'll implement other codes, such as something to launch a recording automatically from the PC at a scheduled time, or just wake the TV up (if it's possible).

Is it a collection of frames.bin files that can be downloaded somewhere, or an explanation on how to generate them? Can you explain the format of the poweroff.bin frame?

Anyway, thanks again for your invaluable help! I can now do what I needed absolutely. I just wish to try to send other keys, for the fun and for my personal erudition. ;-)

[EDIT] It seems that the content of the bin frames is essentially the name of the key to send, encoded in base64 format and starting at address 0x1D, with its length at address 0x16. Right?
oga83
Posts: 268
Joined: Sun Mar 18, 2012 10:11 pm
Location: France

Re: How to remotely turn off the TV?

Post by oga83 »

I'm glad it works.

Yes, the HTTP method requires an Arduino board with an IR Led.

No, there is no collection of Bin files.
I prepared these ones for you (with what I did at viewtopic.php?f=18&t=3780)

I made a typo error in my first post :
The length of the message is at @19 (in fact @18 because it's 16 bits long), not @9 (@9 is in the middle of that App Name "iphone..iapp.samsung")

Yes, the 'key' frame contains the length and Base64-KeyName.
For the list of possible keys, look at http://wiki.samygo.tv/index.php5/Key_codes.
oga83
Posts: 268
Joined: Sun Mar 18, 2012 10:11 pm
Location: France

Re: How to remotely turn off the TV?

Post by oga83 »

To generate these files easily, you can use the software described at viewtopic.php?f=18&t=3780
I've just updated it.

Set up you unit IP, double-click on the key you want to send; the app will create files Connect.bin and Key.bin for you :)
The files are located in the same directory than the exe.
rol
Posts: 62
Joined: Sat Jul 28, 2012 11:44 am

Re: How to remotely turn off the TV?

Post by rol »

Thanks for the precisions and links.
oga83 wrote:I made a typo error in my first post :
The length of the message is at @19 (in fact @18 because it's 16 bits long), not @9 (@9 is in the middle of that App Name "iphone..iapp.samsung")
I suspected that. However, I still doesn't understand the value at bytes 0x18-19. In your example, the value is 0x64 (dec 100). Too much to represent the length of a frame or field. So, I ask again: how can I compute that value? What are the binary strings that must be measured?

BTW, your bin files are very handy to examine their content with an hex editor, and I thank you for that, but I don't really need them. I will generate the frames on the fly. After all, you need only to know the list of keys, and how to establish the connection. When I'll know exactly what to put in the connect frame at 0x18-19, I should have everything I need to write my own remote controller. :-)
oga83
Posts: 268
Joined: Sun Mar 18, 2012 10:11 pm
Location: France

Re: How to remotely turn off the TV?

Post by oga83 »

Went back in my code... Size of message is in @0x17-0x18 (0x40 in the file connect.bin means that you have 0x40 bytes from next byte (@0x19) to end of message (@0x58).

To make it simple, the 'connection' message is :
0x00 SizeofAppName AppName SizeofWhatFollows 0x64 0x00 SizeofIP IP SizeofMAC MAC SizeofMachineName MachineName

And the the 'key' message is :
0x00 SizeofAppName AppName SizeofWhatFollows 0x00 0x00 0x00 SizeofKeyName KeyName

IP, MAC, MachineName and KeyName are base64 coded.
AppName is "iphone..iapp.samsung" and is not encoded.
Sizes are 16 bits, big-endian.
rol
Posts: 62
Joined: Sat Jul 28, 2012 11:44 am

Re: How to remotely turn off the TV?

Post by rol »

Perfectly clear now. Thanks again.

However, according to your examples, it seems that the AppName is "iphone..iapp.samsung" (with two dots then one dot, as you wrote in the post above) in the connect frame, but "iphone.iapp.samsung" (with two times a single dot) in the key frames. Right? Anyway, it works fine that way.

Post Reply

Return to “[D] Support”