Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Readers > Amazon Kindle > Kindle Developer's Corner

Notices

Reply
 
Thread Tools Search this Thread
Old 11-01-2018, 06:00 PM   #1
petervf
Junior Member
petervf began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Nov 2018
Device: K4S
[solved] KT4 NT how to recover lost wifi connection in script

@All,
for a while I was an anonymous reader benefiting out of several ideas here - thank you! Unfortunately I could not find an answer to last my problem. Hoping that you can help me now.

Problem Description
My K4NT: 4.1.3 runs my own small golang weather display (app). It runs just fine.
My router intentional drops wifi every night and restores it in the morning. I cannot find a way to recover the lost wifi connection on kindle after it is switched back on in the morning.

So my program cannot access internet and get a new forecast

"powerd" is on I just disabled screensaver:
lipc-set-prop -- com.lab126.powerd preventScreenSaver 1
framework shall be off but for now is on.

I found only one "dirty" way, which is:
1) keep framework up and running (I do not like this but there is no way to disable upper bar in KT4NT coming back again. No way to pillow off like in K5 and higher)
2) after detecting that the connection is lost by checking that "lipc-get-prop com.lab126.wifid cmState" != "CONNECTED" (it's actually PENDING)
3) simulate home button pressed by writing "send 102\n" to "/proc/keypad"
4) waiting few seconds and the framework magically refreshes the wifi connection

What I tried, but it does (always) work:
1) disabling and enabling wifi by:
lipc-set-prop -- com.lab126.cmd wirelessEnable 0
sleep 5
lipc-set-prop -- com.lab126.cmd wirelessEnable 1
sleep 5
2) trying the same with lipc-set-prop -- com.lab126.wifid enable

I've observed that sometimes the wifi connection recovers by itself and everything works fine without any action from my program.

Main question:
1) Is there any way, beside the above dirty trick with the "home button" to restore the wifi connection?

Low priority question for now
2) I'd like to put the kindle in suspend mode for the night - any working examples?
The rtcWakeup does not work as I thought

I appreciate any feedback!
Peter

[Edit, 2 hours later]
OK, I found the solution, sometimes you need a distance and leave the keyboard for a while, go outside and .... Kindle is a linux computer, do not look for a magic lipc-set-prop woodoo.

The solution is:
Code:
/usr/bin/wpa_cli -i wlan0 reconnect
Thank you!

But then the second kind request:
I'd like to put the kindle in suspend mode for the night - any working examples?
The rtcWakeup does not work as I thought

Last edited by petervf; 11-01-2018 at 09:01 PM.
petervf is offline   Reply With Quote
Reply

Tags
displayweather, golang, kt4nt, wifi

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
start script on network connection mattzz Kindle Developer's Corner 2 02-19-2014 02:50 PM
Kindle Touch: execute script when wifi connection is established atordo Kindle Developer's Corner 5 07-13-2012 06:06 AM
Classic Unrooting my Nook Wifi lost Wifi connection: unable to save the hotspot SnerdlyBosco Nook Developer's Corner 2 03-08-2011 09:17 AM
602 Editing the PPP connection script ? J.C. PocketBook Developer's Corner 0 03-06-2011 11:56 AM
Classic my rooted nook lost wifi connection, need suggestion! ctos Nook Developer's Corner 8 08-19-2010 02:01 AM


All times are GMT -4. The time now is 06:05 PM.


MobileRead.com is a privately owned, operated and funded community.