This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

delaying the launch of Matrix in Sitara for splash screen

Hey folks,

I have just recently started learning about using TI Sitara for embedded Linux application development. I am currently trying to use Qt to add a splash screen that would last for 5 screens on boot up and then display the Matrix Application Launcher. I have successfully created an example code for the splash screen with QTimer. How do i go about disabling the launch of Matrix on boot-up and then make it reappear after a certain delay?

  • Hi,

    The fastest approach I can think of is to add delay inside the /etc/init.d/matrix-gui-2.0 script.

    Something like:

    sleep 5

    before the matrix browser is started.

    Best regards,
    Miroslav

  • how do i go about launching the splash screen first and then matrix. are there any functions to communicate between the two?

    Sorry this might sound stupid

  • This would be possible using the boot scripts inside /etc/init.d/.

    Here are some steps to add a new boot script/application (to run at boot time) in Debian-based Linux:

    https://www.debian-administration.org/articles/28

    1. Add the script/application to the /etc/init.d/ directory.
    2. Make it executable.
    3. Update the runtime control with the following command:

    sudo update-rc.d <script_or_application_name> defaults

    This will add the needed symbolic links to the /etc/rc#.d/ (runtime control) directories.

    4. Remove it with:

    sudo update-rc.d -f <script_or_application_name> remove

    # More info on Debian runlevels: https://wiki.debian.org/RunLevel

    Since the default runlevel is 5, check the starting priority of the matrix gui script inside /etc/rc5.d/. Here it is:

    lrwxrwxrwx    1 root     root            24 Mar 31 02:34 S97matrix-gui-2.0 -> ../init.d/matrix-gui-2.0

    It is 97, so anything below this number would be executed before this script. Unfortunately the ts-calibrate application is with priority 96, so you would have to change this as well in order to squeeze your application in between.

    Check the manual page for the update-rc.d tool for information on how to change the priority levels of boot scripts/applications:

    man update-rc.d

    I hope this clears things out a bit.

    Best regards,
    Miroslav

  • This is quite helpful, thank you! I will give this a try

  • Hi Miroslav,

    I used the steps mentioned above to create a shell script in the location /etc/init.d by going to the directory and typing gedit terminal.sh and saving it later on

    i then changed the permission by the following command-  chmod 755  <path of the file>/terminal.sh

    after having done that i tried updating the runtime control with the following - sudo update-rc.d terminal.sh start 96 S with the terminal being in the directory /etc/init.d

    I'm getting an error as "/etc/init.d/terminal.sh: file does not exist" I checked /etc/init.d and there exists terminal.sh

    Any ideas as to why this error id popping up?

    Thanks

  • This is strange. Please list the /etc/init.d/terminal.sh file with the ls -la command.

    ls -la /etc/init.d/terminal.sh

    Best regards.
    Miroslav

  • This is what im getting

    -rwxr-xr-x  1 siddarth siddarth 2751 Jun 23 14:28 terminal.sh
    -rw-rw-r--  1 siddarth siddarth 2751 Jun 23 14:27 terminal.sh~

  • Siddarth, I just realized that the default file system doesn't have "sudo" or "gedit" commands installed and its default user is "root". Are you sure you are executing these steps on the target board?

    Best regards,
    Miroslav

  • that was incredibly stupid of me. I was running the update-rc.d command on the host. Sorry about that. Thanks for all your help Miroslav.

  • Hi Miroslav,

    I managed to get the splash screen running before matrix with your help yesterday by changing the order of the matrix gui in the rc.5 folder. the problem i am now facing is that the splash screen starts execution before the matrix but before it completes execution matrix-gui is launched. i tried using sleep to delay the launch of the matrix gui by placing 'sleep 5' at the very top of the matrix-gui.sh file but that then caused the entire system to sleep for 5 seconds and the splash screen wasn't even displayed either. Any ideas on how to implement the gui launch only after the completion of my splash screen or how to implement a delay ?

  • Hi,

    Try this in your Qt application script:

    execute_your_qt_application &
    qt_app_pid=$!
    wait $qt_app_pid

    You can check what the "wait" command does with: man wait

    Best regards,
    Miroslav

  • Please find below my terminal.sh. I implemented the lines for the wait command 5 -6 lines above from the end. I may have done it wrong. Also , another thing i came across is that i have written GUI_OPTS = xxxxx and i accidentally used TERMINAL_OPTS when issuing the start command, it works fine, if i change it to GUI_OPTS it works but then the output starts scrambling when i move the mouse. Any suggestions would be much appreciated

    How do i find the pid number? i have just used pidfile , i think its wrong?

    #! /bin/sh

    terminalgui="/home/root/terminal"
    ROTATION=""
    GUI_OPTS="-qws $ROTATION terminal.pro"
    PIDFILE="/var/run/terminal.pid"

    test -x "$terminalgui" || exit 0

    export TSLIB_TSDEVICE=/dev/input/touchscreen0
    export QWS_MOUSE_PROTO=Auto
    tsfile=/etc/pointercal

    case "$1" in
      start)
        chvt 4
     
        echo 2 > /proc/cpu/alignment

        if [ -e /dev/input/touchscreen0 ]
        then
            export QWS_MOUSE_PROTO="Tslib:/dev/input/touchscreen0 Auto"
            mount | grep /media/mmcblk0p1 | grep vfat > /dev/null 2>&1
            if [ "$?" = "0" ]
            then
                tsfile=/media/mmcblk0p1/pointercal
                export TSLIB_CALIBFILE=$tsfile
            fi

            if [ ! -f $tsfile ] ; then
                echo -n "Calibrating touchscreen (first time only)"
                ts_calibrate
                echo "."
            
                if [ ! -f /etc/pointercal -a -f $tsfile ]
                then
                    cp $tsfile /etc/pointercal
                fi
            fi
        fi

        #Clear out the the tmp and lock directory
        cd /usr/share/terminal
        rm -rf tmp/*
        rm -rf lock/*
        cd -

        if [ -e $PIDFILE ]; then
          PIDDIR=/proc/$(cat $PIDFILE)
          if [ -d ${PIDDIR} -a  "$(readlink -f ${PIDDIR}/exe)" = "${terminalgui}" ]; then
            echo "$DESC already started; not starting."
          else
            echo "Removing stale PID file $PIDFILE."
            rm -f $PIDFILE
          fi
        fi

        echo -n "Starting Terminal GUI application"
        start-stop-daemon --start --quiet --background -m --pidfile $PIDFILE --exec $terminalgui -- $TERMINAL_OPTS
        echo "."
      

      if [PIDFILE -eq $!]; then
            wait $PIDFILE
        fi
        ;;

      stop)
        echo -n "Stopping Terminal GUI application"
        start-stop-daemon --stop --quiet --pidfile $PIDFILE
        echo "."
        ;;
      *)
        echo "Usage: /etc/init.d/terminal {start|stop}"
        exit 1
    esac

    exit 0