Page 23 of 26

Re: [App] libSoftPowerOff D/E/F/H

Posted: Thu Oct 20, 2016 11:12 am
by zoelechat
Well, if I understood correctly (!) you could simply check "your condition" in CMD_OFF script and "sync ; micom shutdown" if true. Is that it? :)
Shutdown by micom shouldn't cause any problem, except in case TV was recording (recording might be lost).

Re: [App] libSoftPowerOff D/E/F/H

Posted: Thu Oct 20, 2016 11:28 am
by mad_ady
Thank you. I didn't know about the shutdown option of micom. Yes, that would do.

Re: [App] libSoftPowerOff D/E/F/H

Posted: Sat Oct 22, 2016 12:48 pm
by mad_ady
@zoelechat: I've implemented a custom script to run on powerOn that activates LockTV if the time is right. If LockTV had been injected before, it reboots the TV (and a different script would activate on boot).
Here is the code: http://pastebin.com/kePaHqZW

When I run it from shell, it works correctly, but when I run it as an event onPower on it works, but does not inject LockTV. I dug a bit deeper, and it seems the scripts that run onPowerOn/onPowerOff are run as user 1010 (app):

Code: Select all

/mnt/scripts/onPowerOn.sh: Injecting libPinCode because we are on a weekday before 18
/mnt/scripts/onPowerOn.sh: Running as uid=1010(app) gid=1010(app) groups=500(gfx),501(video),502(audio),503(disk),504(security),506(dtvlogd),1010(app)
/mnt/scripts/onPowerOn.sh: Text injection error code:0
/mnt/scripts/onPowerOn.sh: Lock TV injection error code:0
So, what would be the best way to run some commands as root inside the script?

I tried with

Code: Select all

su -c /mnt/opt/privateer/usr/bin/samyGOso -d -A -B -l /mnt/opt/privateer/usr/libso/libText.so TEXT:'injecting libPinCode to enforce time' FONT:2 CENTER:7 TIMEOUT:5
The code exits with errorcode 1. Using quotes around the command (after -c) has the same effect.

Re: [App] libSoftPowerOff D/E/F/H

Posted: Sat Oct 22, 2016 3:24 pm
by zoelechat
It's expected on H, any CMD launched by lib (and even by TV) is not as root, you have to use such trick (example in libAirToSat thread IIRC):

Code: Select all

(echo "/mnt/opt/privateer/usr/bin/samyGOso -d -A -B -l /mnt/opt/privateer/usr/libso/libText.so TEXT:'injecting libPinCode to enforce time' FONT:2 CENTER:7 TIMEOUT:5" ; sleep 2) | /mnt/bin/telnet localhost 23

Re: [App] libSoftPowerOff D/E/F/H

Posted: Sat Oct 22, 2016 6:14 pm
by mad_ady
I see. I have disabled telnet since it didn't ask for a password. Now I see it was a feature, not a bug. Perhaps I can start it listening on localhost only. Thanks
Edit: -b does just that...

Re: [App] libSoftPowerOff D/E/F/H

Posted: Wed Dec 14, 2016 9:10 pm
by Borygo77
@zoelechat is there anyway to shutdown AV Receiver using libSoftPowerOFF ? Tryied STB option and it's not working but I probably don't fully understand how it works...

Re: [App] libSoftPowerOff D/E/F/H

Posted: Wed Dec 14, 2016 10:31 pm
by zoelechat
I think STB option is illustrated enough, it's ONLY for RCs having "STB" button (rare but added on request).
Otherwise, unless you can remotely (through network/commandline or so) shutdown your AV receiver: No :)

Re: [App] libSoftPowerOff D/E/F/H

Posted: Fri Dec 16, 2016 10:09 pm
by Borygo77
Well, do you know how to pull out command from on screen tools menu? There is option to power on or off my AV receiver...

Re: [App] libSoftPowerOff D/E/F/H

Posted: Fri Dec 16, 2016 10:36 pm
by zoelechat
No idea, never seen such option :) (HDMI-CEC related?)
Possible it could correspond to that famous STB key, but can't tell you which keycode it owns (I don't cheat it by keycode there). You might try keys using samyGOrc until you find it maybe.

Re: [App] libSoftPowerOff D/E/F/H

Posted: Sat Dec 17, 2016 2:39 am
by Borygo77
It's not hdmi-cec related as it's disappearing after pluging in hdmi ;) Better leave it as I don't want any bootloops caused with samyGOrc :P