Page 3 of 9
					
				Re: MyButtons - plugin for fast execute commands
				Posted: Tue Jan 11, 2011 11:40 pm
				by reaper7
				mattberlin wrote:Thank you very much for this great tool! This way I can easily mount net drives if my PC is turned on after the TV.
BTW, is there any chance to run Content Library programs with MyButtons?
Best regards,
Matthias
If You have 
injectso then try something like this example (read more about injectso usage!):
Code: Select all
YELLOW|ScreenCap|[ -f /dtv/usb/sda/ScreenCap/loader.so ] && /mtd_rwarea/injectso `pidof exeDSP` /dtv/usb/sda/ScreenCap/loader.so Game_Main /dtv/usb/sda/ScreenCap/
 
nescha wrote:
Same result for me also: remote.log received the key, TV reported result on screen and it is the same as the one executed from console, with only difference that console executes the command but MyButtons doesn't 

.
Any ideas?
Scope for output when sending from console and TV is a bit different so maybe there lies the problem
 
I don't have any ideas now 

I don't understand this ... picoff.sh executing from telnet working but executed from myButtons not ... 
The same result is when You execute some_script.sh (from myButtons) who executed picoff.sh 

 
			 
			
					
				Re: MyButtons - plugin for fast execute commands
				Posted: Wed Jan 12, 2011 11:31 am
				by sbav1
				reaper7 wrote:
I don't understand this ... picoff.sh executing from telnet working but executed from myButtons not ... 
The same result is when You execute some_script.sh (from myButtons) who executed picoff.sh 

 
My guess (not confirmed, just an idea where the problem may be):
SsKeyInputBase::SendKey() method, called by Remote LAN Control thread, is not working, because TV is concurrently in the middle of earlier keycode processing - inside KeyCommon::SendKeyPressInput() method in MyButtons thread, waiting for the return from system() call. Executing script in the background with " &", and putting extra "sleep 1" in the beginning of the script should help. Or not, in case I'm wrong 

 
			 
			
					
				Re: MyButtons - plugin for fast execute commands
				Posted: Wed Jan 12, 2011 3:00 pm
				by reaper7
				sbav1 wrote:My guess (not confirmed, just an idea where the problem may be):
SsKeyInputBase::SendKey() method, called by Remote LAN Control thread, is not working, because TV is concurrently in the middle of earlier keycode processing - inside KeyCommon::SendKeyPressInput() method in MyButtons thread, waiting for the return from system() call. Executing script in the background with " &", and putting extra "sleep 1" in the beginning of the script should help. Or not, in case I'm wrong 

 
I try to do one more "middle" script who execute final script but without success 

  :
Code: Select all
#!/bin/sh
export PATH=/mtd_rwarea:$PATH
export LD_LIBRARY_PATH=/mtd_rwarea:$LD_LIBRARY_PATH
sleep 2
/mtd_rwarea/picoff.sh &
echo "done"
exit 0
unfortunately I don't use a 
system() for execute user command but 
popen because myButtons waiting for "answer" from executed command/script and display it on popup message on second thread...
sbav1 - it is possible to send some keys from myButtons before send "key_nothing" when ending (without using Remote LAN Control) 
using e.g. 
Code: Select all
extern int _ZN9KeyCommon17SendKeyPressInputEii(int, int, int);
 ??
If it is possible then I do some modyfication for sending keys macro...
e.g. on mybuttons.conf on some buttons user instead of command write 
#750(interval)#key1code#key2code#keyXcode 
			 
			
					
				Re: MyButtons - plugin for fast execute commands
				Posted: Wed Jan 12, 2011 8:24 pm
				by sbav1
				reaper7 wrote:
I try to do one more "middle" script who execute final script but without success 

  :
Code: Select all
#!/bin/sh
export PATH=/mtd_rwarea:$PATH
export LD_LIBRARY_PATH=/mtd_rwarea:$LD_LIBRARY_PATH
sleep 2
/mtd_rwarea/picoff.sh &
echo "done"
exit 0
 
I think "sleep 2" shoud be in the background script (in picoff.sh )
unfortunately I don't use a system() for execute user command but popen because myButtons waiting for "answer" from executed command/script and display it on popup message on second thread...
Right, I forgot the source is not up to date, it was system() in earlier version 
sbav1 - it is possible to send some keys from myButtons before send "key_nothing" when ending (without using Remote LAN Control) 
using e.g. 
Code: Select all
extern int _ZN9KeyCommon17SendKeyPressInputEii(int, int, int);
 ??
 
Should be possible, but:
- not by _ZN9KeyCommon17SendKeyPressInputEii (AFAIRC this function doesn't work properly for sending keycodes),
  you should probably use _ZN14SsKeyInputBase7SendKeyEi(), just like doodlecz did in Remote LAN Control,
- not directly from key processing code (maybe it is somehow doable, but more than likely you will end up with infinite recursion); I guess additional thread may be convenient for macro processing, anyway.
I.e. something like this:
Code: Select all
static int OnMacroFlag=0;
static int button_pressed(int key) { 
    if (OnMacroFlag) return(key);
    ...
    if (isMacro ...) {
       OnMacroFlag++;
       pthread_t helper;
       pthread_create( &helper, NULL, ¯o_thread, macro );
       return(KEY_NOTHING);
    }
    ...
}
void macro_thread(void *macro) {
     sleep(1);
     for (...) {
          ...
          _ZN14SsKeyInputBase7SendKeyEi(pInstnace, key);
     }
     OnMacroFlag--;
     return;
}
 
			 
			
					
				Re: MyButtons - plugin for fast execute commands
				Posted: Wed Jan 12, 2011 8:55 pm
				by reaper7
				I testing at this moment with example 
Code: Select all
_ZN9KeyCommon17SendKeyPressInputEii(a, KEY_MENU, arg_r2);
and seems it's work too 

but I check "Ei" too of course - You are a master here 

whats parameters have this function? 
_ZN14SsKeyInputBase7SendKeyEi(
int a(first param from injection procedure) ,
int key) ??
 
			 
			
					
				Re: MyButtons - plugin for fast execute commands
				Posted: Wed Jan 12, 2011 9:35 pm
				by sbav1
				reaper7 wrote:I testing at this moment with example 
Code: Select all
_ZN9KeyCommon17SendKeyPressInputEii(a, KEY_MENU, arg_r2);
and seems it's work too 

AFAIRC it "nearly" worked, but with some side effects (after the 1st call next remote keypress was not comming through - or something like that, I don't remember the details, it was 6 months ago).
whats parameters have this function? 
 
1st: SsKeyInputBase::SsKeyInputBase object instance, 2nd: keycode
Code: Select all
extern unsigned int _ZN8SsObject14m_poObjectListE[];
extern int _ZN14SsKeyInputBase7SendKeyEi(unsigned int, int);
...
_ZN14SsKeyInputBase7SendKeyEi(_ZN8SsObject14m_poObjectListE[2], key);
(not tested, I don't have access to Tv right now).
Or (better): use the code from doodlecz's Remote Lan Control loader.c for determining 1st argument; it's a little longer but much more clean, and it includes some extra checks.
 
			 
			
					
				Re: MyButtons - plugin for fast execute commands
				Posted: Wed Jan 12, 2011 10:14 pm
				by reaper7
				TNX 
sbav1
Your code working!!!
I tried before with 
pInstance from myButtons (
a parameter) 
and 
_ZN9KeyCommon17SendKeyPressInputEii working with this 
but 
_ZN14SsKeyInputBase7SendKeyEi rebooting TV.
Now 
pInstance from 
_ZN8SsObject14m_poObjectListE[2] is OK 

 
			 
			
					
				Re: MyButtons - plugin for fast execute commands
				Posted: Fri Jan 14, 2011 12:38 am
				by reaper7
				New 
MyButtons version 
0.6 for test
-
Remote Keys macro funcionality (look on mybuttons.conf)
e.g.:
Code: Select all
YELLOW|PICOFF|#750#KEY_MENU.KEY_CUR_DOWN.KEY_CUR_DOWN.KEY_CUR_DOWN.KEY_CUR_RIGHT.KEY_CUR_UP.KEY_CUR_RIGHT.KEY_CUR_DOWN.KEY_CUR_DOWN.KEY_CUR_RIGHT.KEY_CUR_UP.KEY_CUR_UP.KEY_ENTER
-command line must start with 
#
-integer value is a interval in miliseconds between next rc_keys (min 750, max 5000) closed by 
# too
-rc_commands separated by 
.  (dot)
rc_keys names and codes inside rc_codes.html file
DOWNLOAD from sendspace:
http://www.sendspace.com/file/3tcnah
Sorry but I can't upload 330kB to SF 

 
			 
			
					
				Re: MyButtons - plugin for fast execute commands
				Posted: Fri Jan 14, 2011 3:45 am
				by nescha
				Works nice!!! Good job!
I created couple of most appropriate my shortcuts:
1. PIP Sound Switch - 10 actions
2. PIP Toggle - 1 action
3. PIP Size - 10 actions
4. PIP Position - 11 actions
1. Picture Mode - 2 actions
2. Sound Mode - 2 actions
3. SRS Switch -  2 actions
4. Samba shared drive movies - 8 actions
I had to tweak samba path to "/usb/dtv/sda1" to be the same as USB1 so plugged USB don't mess up the order of Media.P sources - dirty but shares same link with both dir contents.
For majority of actions (except Samba), delay may be lower than 750. 
For those long PIP actions, it would be nice to find shorter path (I read recently that that are additional one-click PIP actions: 
http://forum.samygo.tv/viewtopic.php?f= ... 110#p11588)
Also, there is a problem with different menu items count depending on state, e.g. when PIP split screen is ON, Picture Size is lost, or when PIP "Sub sound" is ON, "Dual I II" is shown. This restricts from same commands being usable in all target states.
 
			 
			
					
				Re: MyButtons - plugin for fast execute commands
				Posted: Fri Jan 14, 2011 9:33 am
				by reaper7
				new 
MyButtons v0.7
-fix problem with SUBT. key
+change min interval time to 500ms (warning - some keys may be omitted)
DOWNLOAD:
http://sf.net/projects/samygo/files/Sam ... p/download
=====
nescha - about new rc_codes found by 
juuso - If new codes are better tested,
of course I add it to myButtons