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 04-09-2019, 02:34 PM   #1
djsmiley2k
Junior Member
djsmiley2k began at the beginning.
 
Posts: 7
Karma: 10
Join Date: Jul 2016
Device: Kindle D009 3G Europe.
Talking How to run the script on power on / usb connected

Hi,

Awesome stuff here, I've managed to root my kindle (3G GB), get ssh, modified some of the weather scripts found online to almost make my own picture frame / kindle weather display / CPU Monitoring station thing however I still have one issue.

If the usb is ever disconnected from the kindle, reconnecting it causes the screen to blank, and then I have to 'power on' the kindle again, holding the power button for a second or so. Now, this in itself isn't too bad, except for when I mount it inside a picture frame!.

Is there someway I can edit things, so upon power being restored/usb connected, it'll also 'wake up' and start running the script? I don't ever plan to use it as a kindle anymore, so it doesn't need to be something I can 'reset' easily. It'd be something like https://www.mobileread.com/forums/sh...d.php?t=101847 but for usb/power. I'm going to investigate if there's an event for that now, but in the meantime maybe someone can help

Thanks in Advance!

Last edited by djsmiley2k; 04-09-2019 at 03:09 PM.
djsmiley2k is offline   Reply With Quote
Old 04-09-2019, 07:00 PM   #2
NiLuJe
BLAM!
NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.
 
NiLuJe's Avatar
 
Posts: 13,477
Karma: 26012464
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW, PW2, PW5; Kobo H2O, Forma, Elipsa, Sage, C2E
Err, define "blank", because that definitely should never happen, unless potentially stupid things have been done to the running services (i.e., going to need more details on what exactly you're doing).

What *should* happen on a plugIn event is the device switching to USBMS.
A behavior you can bypass entirely by enabling USBNet.

Because while you can listen for USB events, that won't help you *inhibit* them, which is what you want.

Last edited by NiLuJe; 04-09-2019 at 07:02 PM.
NiLuJe is offline   Reply With Quote
Advert
Old 04-09-2019, 10:17 PM   #3
knc1
Going Viral
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
We really need to see the script you are using to display your image.
From your description, you must be killing the framework AFTER you show the image. Then, since the framework is dead, the screen will not redraw.


(Note: It may not be specifically the framework, but the principle remains, you are killing something you need to redraw the image.)
knc1 is offline   Reply With Quote
Old 04-10-2019, 07:13 AM   #4
djsmiley2k
Junior Member
djsmiley2k began at the beginning.
 
Posts: 7
Karma: 10
Join Date: Jul 2016
Device: Kindle D009 3G Europe.
Sorry - most of the time the redrawing works fine. As long as USB is connected - I think the battery maybe knackered however I also think usbnet is enabled:

Code:
[2654886.905173] usb 3-3: new high-speed USB device number 35 using ehci-pci
[2654887.056085] usb 3-3: New USB device found, idVendor=0525, idProduct=a4a2
[2654887.056088] usb 3-3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[2654887.056090] usb 3-3: Product: RNDIS/Ethernet Gadget
[2654887.056091] usb 3-3: Manufacturer: Linux 2.6.26-rt-lab126/fsl-usb2-udc
Crontab to call the script, once we're up and running:

Code:
[root@kindle root]# cat /etc/crontab/
cat: read error: Is a directory
[root@kindle root]# cat /etc/crontab/root 
*/15 * * * * /usr/sbin/checkpmond
*/15 * * * * /usr/sbin/tinyrot
*/60 * * * * /usr/sbin/loginfo tmpfs
*/60 * * * * /usr/sbin/loginfo localVars
*/60 * * * * /usr/sbin/loginfo memusedump
*/15 * * * * /usr/sbin/loginfo powerdcheck
*/3 * * * * /mnt/us/weather/display-weather.sh

## And the script itself

[root@kindle root]# cat /mnt/us/weather/display-weather.sh
#!/bin/sh

cd "$(dirname "$0")"

rm weather-script-output.png
eips -c
eips -c

if wget http://192.168.0.10/weather/weather-script-output.png; then
	eips -g weather-script-output.png
else
	sleep 30
	if wget http://192.168.0.10/weather/weather-script-output.png; then
		       eips -g weather-script-output.png
        else
        	        sleep 30
        	        if wget http://192.168.0.10/weather/weather-script-output.png; then
        	                         eips -g weather-script-output.png       
        	        elsE 
					eips -g weather-image-error.png
			fi
	fi
fi

Last edited by djsmiley2k; 04-10-2019 at 07:15 AM.
djsmiley2k is offline   Reply With Quote
Old 04-11-2019, 02:19 AM   #5
knc1
Going Viral
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
Scripts are case sensitive (elsE != else).
There are three paths where the scripting can silently fail, leaving only a blank screen. Fix those so you can tell which one is being taken.
(Also: The script has no tests to determine if connectivity has come back up before it runs. That is, cron can start to run the script before networking is available.)
knc1 is offline   Reply With Quote
Advert
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Prototype power off script j.p.s Kindle Developer's Corner 9 12-24-2017 08:01 PM
run script on wifi connect sinisterguy Kindle Developer's Corner 1 10-18-2010 03:46 PM
Universal Flasher run script Jamp Sony Reader Dev Corner 1 08-26-2009 09:34 AM
battery used when fully charged and connected to power outlet? zerospinboson iRex 5 11-19-2008 04:19 PM
iLiad Can't run my first script ragdoll iRex Developer's Corner 4 01-28-2008 06:40 AM


All times are GMT -4. The time now is 01:20 AM.


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