View Single Post
Old 12-03-2024, 05:37 AM   #12
kobotouch2711
Member
kobotouch2711 began at the beginning.
 
Posts: 10
Karma: 10
Join Date: Nov 2024
Device: Kobo Touch
Sorry for starting "a new topic" within this thread, but i realized a very odd behaviour.

I currently run the following script on my kobo
Code:
#your Wi-Fi network details
LOG_FILE="/my2job.log"
log_message() {
     local MESSAGE="$@"
      echo "$(date +"%Y-%m-%d %H:%M:%S") : $MESSAGE" >> "$LOG_FILE"
 }

INTERFACE="wlan0"

# The IP address to ping
HOST="192.168.0.1"

# Function to reconnect to Wi-Fi
reconnect_wifi() {
    log_message "Host is not reachable. Reconnecting to WiFi"
    echo "Host $HOST is not reachable. Reconnecting to Wi-Fi..."
/usr/bin/qndb -m wfmSetAirplaneMode toggle; 
    log_message "Airplane toggle (WIFI to off). Now sleep for 10s"
    echo "Airplane toggle (WIFI to off). Now sleep for 10s"
sleep 10 ; 
/usr/bin/qndb -m wfmSetAirplaneMode toggle ; 
    log_message "Airplane toggle (WIFI to on). Now sleep for 10s"
    echo "Airplane toggle (WIFI to on). Now sleep for 10s"
sleep 10; 
/usr/bin/qndb -m wfmConnectWirelessSilently;
    log_message "1st attempt to connect wirelessly."
    echo "1st attempt to connect wirelessly."
sleep 20; 
/usr/bin/qndb -m wfmConnectWirelessSilently;
    log_message "2nd attempt to connect wirelessly."
    echo "2nd attempt to connect wirelessly."
sleep 20; 
/usr/bin/qndb -m wfmConnectWirelessSilently;
    log_message "3rd attempt to connect wirelessly."
    echo "3rd attempt to connect wirelessly."

    log_message "Wifi hopefully reconnected. Starting browser and sleep for 5s"
    echo "Wifi hopefully reconnected. Starting browser and sleep for 5s"
/usr/bin/qndb -m bwmOpenBrowser;
sleep 5;
}

while true; do
    # Ping the host
    ping -c 1 $HOST > /dev/null 2>&1
    # Check the ping result
    if [ $? -ne 0 ]; then
        reconnect_wifi
    else
        echo "Host $HOST is reachable."
    fi

    # Wait for 10 seconds before the next ping
    sleep 10
done
And the funny thing now happens in the logfile:
Code:
2024-12-03 10:48:29 : Host is not reachable. Reconnecting to WiFi
2024-12-03 10:48:29 : Airplane toggle (WIFI to off). Now sleep for 10s
2024-12-03 11:26:00 : Airplane toggle (WIFI to on). Now sleep for 10s
2024-12-03 11:26:59 : 1st attempt to connect wirelessly.
2024-12-03 11:27:19 : 2nd attempt to connect wirelessly.
2024-12-03 11:27:39 : 3rd attempt to connect wirelessly.
2024-12-03 11:27:39 : Wifi hopefully reconnected. Starting browser and sleep for 10s
The webpage was frozen at 10:48 obviously. At 11:26 I manually hit the Home Button on the device and on the Wifi Icon, which forced Kobo to "wake up" again and reconnected to the Wifi and open the browser.

Now the most interesting question: Does anyone have a clue, why Kobo keeps sleeping "forever" after the first Airplane toggle until I hit the home button?

If i fixed this, there is hopefully no need to restart device and autostart the browser on startup as in the previous post.
By the way: I assume heavily, that this is the same "freeze" as in the script from my first post.

Last edited by kobotouch2711; 12-03-2024 at 05:40 AM.
kobotouch2711 is offline   Reply With Quote