Page 1 of 2

[App] libLockTV B/C/D/E/F/H - Parental Lock

Posted: Tue Apr 14, 2015 1:03 pm
by zoelechat
Patch immediately locks TV with pincode on injection, and won't allow watching any channel/source until right pincode is entered. As soon as it's unlocked, pincode will never be prompted anymore. Can be useful to launch on startup for *full* parental lock.

Usage:
*For D series (arm), replace every instance of /mnt below by /mtd_rwcommon/widgets/user/SamyGO/SamyGO
*For C series (arm), replace every instance of /mnt below by /SamyGO on your rooting USB device
*For B series, latest samyGOso is there.
  • Get latest samyGOso from there and copy/overwrite samyGOso file (not folder) to /mnt/opt/privateer/usr/bin
  • Set permissions if needed (usually not if overwritten)

    Code: Select all

    chmod +x /mnt/opt/privateer/usr/bin/samyGOso
  • Extract attached archives and copy libLockTV.so to /mnt/opt/privateer/usr/libso (create folder if needed).
  • Execute

    Code: Select all

    samyGOso -d -A -B -r -l /mnt/opt/privateer/usr/libso/libLockTV.so [TRIES:n] [TIMEOUT:n]
    Commandline can take two args:
    • TRIES:n - Allow n pincode tries before auto-shutdown.
    • TIMEOUT:n - TV will shutdown if no valid pincode has been entered after n seconds.
    Logfile is written to /dtv/LockTV.log
  • Autostart (Script has an early number to lock TV as soon as possible on startup)
    • Copy 02_02_LockTV.init to /mnt/etc/init.d
    • Set permissions

      Code: Select all

      chmod +x /mnt/etc/init.d/02_02_LockTV.init
    • You can change OPTIONS value on top of script, default is

      Code: Select all

      OPTIONS="TIMEOUT:100 TRIES:3"
*Changelog:

Code: Select all

23/4/2015
v0.2.2 - Added C support
21/4/2015
v0.2.0 - Added TIMEOUT and TRIES args
14/4/2015
v0.1.0 - First public release

Re: [App] libLockTV B/D/E/F/H - Parental Lock

Posted: Tue Apr 21, 2015 6:55 pm
by zoelechat
New version, added user-defined max number of pincode tries, and timeout before automatic shutdown.

Re: [App] libLockTV B/D/E/F/H - Parental Lock

Posted: Tue Apr 21, 2015 7:51 pm
by juusso
Yah, works very well!!!
Here is my updated parent control script. I use my NAS to control when TV should start unlocked (TV_LOCK_ON flag file)

Code: Select all

#!/bin/sh
#
# ? Copyright 1996-2015, SamyGO
#
#
 . /dtv/SGO.env

LIBSO_DIR=$SYSROOT/opt/privateer/usr/libso
TV_ON="0"

#### CHANGE ME START! ####

SERVERIP="192.168.1.200"
SERVER="http://$SERVERIP"

FROM_TIME="00:05"
TO_TIME="07:30"
#FROM_TIME="12:00"
#TO_TIME="13:00"


#### CHANGE ME END! ####

  
check_TV_OK()
{
#check for TV_ON file on server
	CHECK=$( curl --max-time 6 --silent --head $SERVER/TV_LOCK_ON | grep -c 'HTTP/1.1 200 OK' )
	if [ $CHECK -eq "1" ]; then
      TV_LOCK_ON="1"
#   elif [ $CHECK -eq "7" ]; then               
	else
      TV_LOCK_ON="0"
	fi
}

request_pin()
{
   samyGOso -A -B -r -l $LIBSO_DIR/libLockTV.so TIMEOUT:120 TRIES:3
   sleep 3   
}

stop_bootloop()
{
   for USB in /dtv/usb/sd* ; do
      echo "checking $USB"
      [ -e $USB/STOP ] && echo "STOP found. ParientControl script exit..."  >> /mtd_down/SHUTDOWN.log && exit 1
   done
}

case $1 in
   start)
	stop_bootloop   

	check_TV_OK	

	FROM=$( echo $FROM_TIME | sed 's/://' )
	TO=$( echo $TO_TIME | sed 's/://' )
	CUR_TIME=$( getsetcurrenttimefromtv -n exeDSP -W )
	CUR_DATE_TIME=$( getsetcurrenttimefromtv -n exeDSP -D )
   
   if [ -z $CUR_TIME ]; then
      CUR_TIME=$(date +"%H%M")
      CUR_DATE_TIME=$(date)
   fi
   
   if [ $CUR_TIME -gt $FROM ] && [ $CUR_TIME -lt $TO ]; then
#Request PIN
      request_pin   
   else
#normal TV start
      echo "$CUR_DATE_TIME NORMAL TV start"
   fi

   if [ $TV_LOCK_ON -eq "0" ]; then
      echo "TV on, nothing else to say"
   else
      request_pin   
   fi

   ;;
   status)
   ;;
   *)
   echo "Usage: $0 {start|stop|status}" 1>&2
   exit 0
   ;;
esac

I did not remove old code, where you can request PIN at certain time interval(s) as well. I can log in to my home network and change the existence of that file remotely. Now i`m thinking about some android app or simple web page to get ability check which of TV is on and switch request for pin (after mandatory reboot). For this feature getsetcurrenttimefromtv patch is required (included). Read here: viewtopic.php?f=12&t=7415

Sounds a bit drastically, but i`m facing some LONG-TV-WATCHING-PROBLEM with my kids.

Edit: Used adroid app tasker + tasker ssh plugin + tasker app factory plugin and now i can enable/disable pin request by pressing red or green buttons on my smartphone desktop :)

Re: [App] libLockTV B/C/D/E/F/H - Parental Lock

Posted: Thu Apr 23, 2015 8:31 pm
by zoelechat
New version, added C support. I'm proud to release the first ever unified B/C/D/E/F/H lib :P
Thanks sectroyer for making things easier on C ;)

Re: [App] libLockTV B/C/D/E/F/H - Parental Lock

Posted: Thu Apr 23, 2015 9:04 pm
by juusso
C series arm. Keep in mind, we have arm, mstar and trident c series... ;)

Re: [App] libLockTV B/C/D/E/F/H - Parental Lock

Posted: Thu Apr 23, 2015 9:18 pm
by sectroyer
juuso wrote:C series arm. Keep in mind, we have arm, mstar and trident c series... ;)
Find me mstar or trident user with rooted TV and I will port it ;)

Re: [App] libLockTV B/C/D/E/F/H - Parental Lock

Posted: Thu Apr 23, 2015 10:22 pm
by zoelechat
juuso wrote:C series arm. Keep in mind, we have arm, mstar and trident c series... ;)
You broke my joy :D

Re: [App] libLockTV B/C/D/E/F/H - Parental Lock

Posted: Fri Apr 24, 2015 9:33 pm
by tempinbox
@zoelechat did you find the way to add C supports? anybody here that try this patch in C series and can confirm that work?
I try your test patch and i remember that didn't work.

Re: [App] libLockTV B/C/D/E/F/H - Parental Lock

Posted: Fri Apr 24, 2015 9:38 pm
by zoelechat
tempinbox wrote:@zoelechat did you find the way to add C supports? anybody here that try this patch in C series and can confirm that work?
I try your test patch and i remember that didn't work.
I was precisely expecting you to try and report. :)
Test version was meant to see which functions were missing. Patch has been tested and now works on C, only additional TRIES and TIMEOUT args haven't been tested yet.

Re: [App] libLockTV B/C/D/E/F/H - Parental Lock

Posted: Fri Apr 24, 2015 9:57 pm
by tempinbox
Ok i will try and post here the result.
Thanks and congrats for you united first b-h patch.
Please don't stop coding ;)
And if you need tester for C arm patch don't forget that i'm here.