[How-To] Remote Control Signal Over Lan?

Here are software that related with Samsung B series TVs. Like hex editors, new version of BusyBox or internal software, app programs that will run in your TV hardware.:!:This forum is NOT FOR USER QUESTIONS or Problems.

geo650
Official SamyGO Developer
Posts: 303
Joined: Wed Oct 07, 2009 12:03 pm

Re: Remote Control Signal Over Lan?

Post by geo650 »

Thank you very much for "remote.zip" app. It works for me, too.

Now I would like to create a simple standalone binary-app to be executed directly from telnet. I don't want to execute it from GAME menu.
My application is going to send HDMI1 command to switch TV's source and terminate.
BTW: is it possible anyway?
But I have one big problem, so maybe you could help me...
Please take a look:

This is my source code (remo.c):

Code: Select all

#include <stdio.h>
#include <dlfcn.h>

int main()
{
	unsigned *handle=NULL;
	if ( (handle = dlopen(NULL,RTLD_LAZY | RTLD_GLOBAL)) == NULL )
	{
		printf("Cannot open self!\n");
		printf(dlerror());
		printf("\n");
		return 1;
	}

	// just for test we have proper instance
	unsigned *KeyInputBase_SendKey = dlsym(handle,"_ZN14SsKeyInputBase7SendKeyEi");

	unsigned *pKeyInputBase = dlsym(handle,"_ZN8SsObject14m_poObjectListE");
  
	if(pKeyInputBase == NULL)
	{
		printf("Cannot find function!\n");
		printf(dlerror());
		printf("\n");
		return 1;
	}

	if(KeyInputBase_SendKey == NULL )
	{
		printf("Cannot find _ZN14SsKeyInputBase7SendKeyEi functions\n");
		printf(dlerror());
		printf("\n");
		return 1;
	}

	dlclose(handle);


	unsigned *pInstance = (unsigned *)(pKeyInputBase[2]);

	pKeyInputBase = (unsigned *)(*pInstance);

	if (pKeyInputBase[6] != (unsigned)KeyInputBase_SendKey)
	{
		printf("Bad instance?! Should be SsKeyInputBase..\n");
		return 1;
	}

	int key = 0xe9;	// HDMI1 select key

	asm volatile(
			"MOV	R0,%0\n"
			"MOV 	R1,%1\n"
// problem is here:
			"BL	_ZN14SsKeyInputBase7SendKeyEi\n"
			: // no output registers
			: "r" (pInstance), "r" (key) );

	printf("Does it work?\n");
	return 0;
}
And this is my attempt to compile the code:

Code: Select all

[user@fedora src]$ arm-SamyGO-linux-gnueabi-gcc -ldl remo.c -o hdmi.bin
/tmp/ccN4Z5nT.o: In function `main':
remo.c:(.text+0x164): undefined reference to `SsKeyInputBase::SendKey(int)'
collect2: ld returned 1 exit status
[user@fedora src]$ 
So the problem is in BL argument (branch label reference): _ZN14SsKeyInputBase7SendKeyEi

The environment has been prepared in FC12 linux using this manual.
Note, that I am a novice with linux programming and GCC. So, what's up?

EDIT: I also tried to create a loader with dynamically-loaded so module. But at execution time it says: "Cannot find function!". So I'd like to know how to obtain SendKey() function address in my app. I think I have to obtain exeDSP's instance somehow for my app to get this function. Any ideas? Or maybe it is not so easy?
Last edited by geo650 on Thu Apr 08, 2010 5:01 pm, edited 3 times in total.
doodlecz
Official SamyGO Developer
Posts: 98
Joined: Wed Mar 17, 2010 9:12 am

Re: Remote Control Signal Over Lan?

Post by doodlecz »

geo650 wrote:Note, that I am a novice with linux programming and GCC. So, what's up?
Np, me too :)
geo650 wrote: EDIT: I also tried to create a loader with dynamically-loaded so module. But at execution time it says: "Cannot find function!". So I'd like to know how to obtain SendKey() function address in my app. I think I have to obtain exeDSP's instance somehow for my app to get this function. Any ideas? Or maybe it is not so easy?
I don't think, it is possible to open, find and call symbols in already running process in linux. But I'm not linux guru, maybe I'm wrong. If no, the only way is to call your function somehow by exeDPR process itself. Either via telnet srv or via Game menu..
doodlecz
Official SamyGO Developer
Posts: 98
Joined: Wed Mar 17, 2010 9:12 am

Re: Remote Control Signal Over Lan?

Post by doodlecz »

a-o wrote:What about connecting TVbrowser (free EPG software for many platforms) with the TV and doing the programming of recordings etc. via the LazyBones plugin?

Of course we would first need to figure out if/ how it is possible to record something via LAN.
Maybe this will never be possible due to closed source portions of the TV sets' firmware.
In that case VDR running on the TV sets might be the only solution. ;)
It could be possible, but I'm not going to prepare such client app ;) However I (or somebody else) could prepare the server side if needed - recording DVTB stream has already been successfully tested over Wifi/LAN -- see thread in Software. And for sure some records programming ability could be possible to implement.
geo650
Official SamyGO Developer
Posts: 303
Joined: Wed Oct 07, 2009 12:03 pm

Re: Remote Control Signal Over Lan?

Post by geo650 »

doodlecz wrote:I don't think, it is possible to open, find and call symbols in already running process in linux. But I'm not linux guru, maybe I'm wrong. If no, the only way is to call your function somehow by exeDPR process itself. Either via telnet srv or via Game menu..
YES! I think, I made it! I ran a piece of your code without GAME menu just a few minutes ago. It worked.
The method was quite obvious: I put addidional code to one of the library file that exeDSP loads when it starts (in my case: libusb.so). My experiments were a bit dirty (killing exeDSP etc.) so I will describe it more precisely later. Probably, we will be forced to modify firmware's rc.local script (again) to do one thing before it starts exeDSP.
See you.
nbd
Posts: 161
Joined: Wed Jan 13, 2010 12:02 pm

Re: Remote Control Signal Over Lan?

Post by nbd »

Hello. This keymap is taken from rc_remap_tbl.h by sbav1 (here)
It should get you started.

Code: Select all

KEY_00_##_SAP
KEY_01_SOURCE
KEY_02_POWER
KEY_03_##_SLEEP
KEY_04_NUM1
KEY_05_NUM2
KEY_06_NUM3
KEY_07_VOLUME_UP
KEY_08_NUM4
KEY_09_NUM5
KEY_0A_NUM6
KEY_0B_VOLUME_DOWN
KEY_0C_NUM7
KEY_0D_NUM8
KEY_0E_NUM9
KEY_0F_MUTE
KEY_10_P_DOWN
KEY_11_NUM0
KEY_12_P_UP
KEY_13_PRE-CH
KEY_14_COL_GREEN
KEY_15_COL_YELLOW
KEY_16_COL_BLUE
KEY_17
KEY_18
KEY_19
KEY_1A_MENU
KEY_1B_TV
KEY_1C
KEY_1D
KEY_1E
KEY_1F_INFO
KEY_20_##_PIP_TOGGLE
KEY_21
KEY_22
KEY_23_##_TUNNING_TYPE
KEY_24
KEY_25_##_SUBTITLE_TOGGLE
KEY_26
KEY_27_AD
KEY_28_P.MODE
KEY_29
KEY_2A
KEY_2B_##_SOUND_MODE
KEY_2C_TTX/MIX
KEY_2D_EXIT
KEY_2E
KEY_2F
KEY_30
KEY_31
KEY_32
KEY_33
KEY_34
KEY_35
KEY_36_##_AIR_CABLE_TOGGLE
KEY_37
KEY_38
KEY_39
KEY_3A
KEY_3B
KEY_3C
KEY_3D
KEY_3E_P.SIZE
KEY_3F
KEY_40
KEY_41
KEY_42
KEY_43_##_DTV
KEY_44_FAV.CH
KEY_45_FB
KEY_46_STOP
KEY_47_PLAY
KEY_48_FF
KEY_49_RECORD
KEY_4A_PAUSE
KEY_4B_TOOLS
KEY_4C
KEY_4D
KEY_4E
KEY_4F_GUIDE
KEY_50
KEY_51
KEY_52
KEY_53_##_INTERNET@TV_2
KEY_54
KEY_55
KEY_56
KEY_57
KEY_58_RETURN
KEY_59
KEY_5A
KEY_5B
KEY_5C
KEY_60_UP
KEY_61_DOWN
KEY_62_RIGHT
KEY_63_DMA
KEY_64
KEY_65_LEFT
KEY_66
KEY_67
KEY_68_ENTER
KEY_69_##_INPUT_VGA1
KEY_6A
KEY_6B_CH_LIST
KEY_6C_COL_RED
KEY_6D
KEY_6E_##_SRS_TOGGLE
KEY_6F
KEY_70
KEY_71
KEY_72
KEY_73
KEY_74
KEY_75
KEY_76
KEY_77_##_ENERGY_TOGGLE
KEY_78
KEY_79_CONTENT
KEY_7A_##_INPUT_VCR
KEY_7B_##_INPUT_CABLE
KEY_7C
KEY_7D_##_INPUT_TV
KEY_7E_##_INPUT_DVD
KEY_7F_##_INPUT_STB
KEY_80
KEY_81
KEY_82
KEY_83
KEY_84_##_INPUT_EXT1
KEY_85
KEY_86_##_INPUT_COMPONENT1
KEY_87
KEY_88
KEY_89
KEY_8A
KEY_8B_HDMI_TOGGLE
KEY_8C_MEDIA.P
KEY_8D
KEY_8E
KEY_8F
KEY_90
KEY_91
KEY_92
KEY_93_INTERNET@
KEY_94_E.MODE
KEY_95
KEY_96
KEY_97_ANYNET
KEY_98_OFF
KEY_99_ON
KEY_9A
KEY_9B
KEY_9C
KEY_9D
KEY_9E
KEY_9F
KEY_A0
KEY_A1
KEY_A2
KEY_A3
KEY_A4
KEY_A5
KEY_A6
KEY_A7
KEY_A8
KEY_A9
KEY_AA
KEY_AB
KE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