acTennis
Posts: 14
Joined: Mon Mar 16, 2015 6:47 pm

Strange Problem ...

Sat Apr 25, 2015 4:05 pm

Hi all,

I have a very very very strange problem with my Raspberry Pi2 and I don't know the cause.

I will explain it:
- the raspberry pi2 boot with a WiFi adapter.
- at boot it tries to connect to WiFi network.
- after booting it starts my process (c++ application)
- an init.d script is present to start my process.
- the application uses wiringPi library

Now the strange problem; all works fine if the raspberry Pi can connect to WiFi network at boot. If it can't connect to any WiFi network (wifi network are not present in the air || wifi network that are not listed into wpa*.conf file) the application starts but sometimes ( ~ 1 times every 3 ) I got messages like:

wiringPiISR: unable to open /sys/class/gpio/gpio27/value: No such file or directory

The very strange behavior is that it appens ONLY when the raspberry Pi2 is not connected to network.

Please post your questions if something is missing .. I will try to explain the full scenario.

Can anyone help me? I'm very discouraged ..

User avatar
kusti8
Posts: 3439
Joined: Sat Dec 21, 2013 5:29 pm
Location: USA

Re: Strange Problem ...

Sat Apr 25, 2015 4:20 pm

Can you post your script?
There are 10 types of people: those who understand binary and those who don't.

acTennis
Posts: 14
Joined: Mon Mar 16, 2015 6:47 pm

Re: Strange Problem ...

Sat Apr 25, 2015 4:35 pm

Hi,

this is the script.

NOTE: my script is the last that runs in current runlevel (2).

Code: Select all

#! /bin/sh

### BEGIN INIT INFO
# Provides:          myApp
# Required-Start:    $all
# Required-Stop:     $all
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: myApp application.
# Description:       This script launches myApp application on the totem.
#                    This script must copied in /etc/init.d.
### END INIT INFO

### COMMAND
# Add service: insserv /etc/init.d/myApp
# 
# NOT USED: Add service: update-rc.d myApp defaults
# NOT USED: Remove service: update-rc.d myApp remove
###

# Script name and directory.
SCRIPT_NAME="myApp"
SCRIPT_DIR="/etc/init.d/"

# Application's working directory (pi HOME).
PROGRAM_DIR="/home/pi/myApp/"
PROGRAM_APP="myApp"

LOG_FILE_NAME="/var/log/myApp/myAppLog.run.log"

case "$1" in
    start)
        # >> Display Name
        export DISPLAY=:0.0

        ###
        # myApp
        ###
        # Entering application directory
        echo `date +"%D-%T"` "] Entering directory ${PROGRAM_DIR}" >> $LOG_FILE_NAME
        cd ${PROGRAM_DIR}
        if [ $? -ne 0 ] ; then
            # Reboot the system on error.
            echo `date +"%D-%T"` "] Directory ${PROGRAM_DIR} unaccessible .. reboot!" >> $LOG_FILE_NAME            
            reboot 
        else
            # Execute main program application.
            echo `date +"%D-%T"` "] Starting application ${PROGRAM_APP}" >> $LOG_FILE_NAME
	        startx ./${PROGRAM_APP} -- :0.0 > /tmp/${PROGRAM_APP}.run.log 2>& 1
        fi
        ;;

    restart)
        echo "$SCRIPT_NAME is restarting its services ..."
        
        # Stop & Start services.
        $SCRIPT_DIR/$SCRIPT_NAME stop
        $SCRIPT_DIR/$SCRIPT_NAME start
        ;;

    reload|force-reload)
        echo "Error: argument '$1' not supported" >&2
        exit 3
        ;;

  stop)
        echo "$SCRIPT_NAME is stopping its services ..."

        # Kill application.
        killall -s SIGKILL ${PROGRAM_APP}
        ;;

  *)
        echo "Usage: $0 start|stop" >&2
        exit 3
        ;;

esac

Return to “Troubleshooting”