Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Readers > Kobo Reader > Kobo Developer's Corner

Notices

Reply
 
Thread Tools Search this Thread
Old 01-02-2018, 01:36 PM   #46
tshering
Wizard
tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.
 
Posts: 3,489
Karma: 2914715
Join Date: Jun 2012
Device: kobo touch
Quote:
Originally Posted by baskerville View Post
Please note that Plato relies on /tmp/nickel-hardware-status for knowing when the USB cable is plugged. KSM changes /usr/local/Kobo/udev/plug and prevents it from writing to the aforementioned FIFO. I'll suggest a different approach to tshering when he returns.
I think I will simply replace
Code:
[ "$(pidof nickel | wc -w)" == "0" ] && exit
by
Code:
[ "$(pidof nickel | wc -w)" == "0" ] || [ "$(pidof plato | wc -w)" == "0" ] && exit
in plug. What do you think?
Should I tread plato the same way as nickel in /usr/local/Kobo/udev/sd too?


Quote:
Originally Posted by baskerville View Post
I forgot to mention that the wifi-{enable,disable}.sh scripts won't work when Plato is launched via KSM: the required environment variables are defined late in rcS and KSM starts early.
Actually these variables are available when KSM is running. Your script does work, when on inserts " sleep 2" after
Code:
insmod "$WIFI_MODULE_PATH"
As for plato.sh, if you run "./nickel.sh &" only if nickel was running before you launched plato, KSM could simply call this plato.sh. Then I would not need to change my calling script each time you change plato.sh.

Last edited by tshering; 01-03-2018 at 09:12 AM.
tshering is offline   Reply With Quote
Old 01-02-2018, 02:41 PM   #47
baskerville
Evangelist
baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.
 
baskerville's Avatar
 
Posts: 445
Karma: 305160
Join Date: Aug 2015
Device: Kobo Glo HD, Kobo Aura ONE
Quote:
Originally Posted by tshering View Post
Quote:
Originally Posted by baskerville View Post
Please note that Plato relies on /tmp/nickel-hardware-status for knowing when the USB cable is plugged.
I think I will simply replace
Code:
[ "$(pidof nickel | wc -w)" == "0" ] && exit
by
Code:
[ "$(pidof nickel | wc -w)" == "0" ] || [ "$(pidof plato | wc -w)" == "0" ] && exit
in plug. What do you think?
Well, you could write this as
Code:
pidof nickel plato > /dev/null || exit
.

But I had something else in mind:
- Don't change any script in /usr/local/Kobo/udev/.
- Use the following function:

Code:
toggle_nickel_hardware_status() {
	local fifo_path=/tmp/nickel-hardware-status
	local arg=$1
	if [ "$arg" == on ] ; then
		while [ ! -p "$fifo_path" ] ; do
			rm "$fifo_path"
			mkfifo "$fifo_path"
		done
	elif [ "$arg" == off ] ; then
		while [ ! -L "$fifo_path" ] ; do
			rm "$fifo_path"
			ln -s /dev/null "$fifo_path"
		done
	else
		printf "toggle_nickel_hardware_status: invalid argument: '%s'." "$arg" >2
	fi
}
to change the nature of /tmp/nickel-hardware-status.

Quote:
Originally Posted by tshering View Post
Actually these variables are available when KSM is running.
My bad.

Quote:
Originally Posted by tshering View Post
Your script does work, when on inserts " sleep 2" after
Code:
insmod "$WIFI_MODULE_PATH"
The ommision of the sleep statements is intentional: when the last insmod ... returns, /sys/class/net/${INTERFACE} already exists. Do you know why the sleep statement was introduced?

Quote:
Originally Posted by tshering View Post
As for plato.sh, if you run "./nickel.sh &" only if nickel was running before you launched plato, KSM could simply call this plato.sh. Then I would not need to change my calling script each time you change plato.sh.
I'll amend the script accordingly.
baskerville is offline   Reply With Quote
Advert
Old 01-02-2018, 03:41 PM   #48
tshering
Wizard
tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.
 
Posts: 3,489
Karma: 2914715
Join Date: Jun 2012
Device: kobo touch
Quote:
Originally Posted by baskerville View Post
Well, you could write this as
Code:
pidof nickel plato > /dev/null || exit
.
This is much better than mine.

Quote:
Originally Posted by baskerville View Post
The ommision of the sleep statements is intentional: when the last insmod ... returns, /sys/class/net/${INTERFACE} already exists. Do you know why the sleep statement was introduced?
Without the sleep statement before ifconfig eth0 up "sh -x /mnt/onboard/.adds/plato/scripts/wifi-enable.sh" gives me

Code:
+ lsmod
+ grep -q sdio_wifi_pwr
+ insmod /drivers/mx50-ntx/wifi/sdio_wifi_pwr.ko
+ insmod /drivers/mx50-ntx/wifi/dhd.ko
+ ifconfig eth0 up
ifconfig: SIOCGIFFLAGS: No such device
+ wlarm_le -i eth0 up
wlarm_le: wl driver adapter not found
+ pidof wpa_supplicant
+ wpa_supplicant -D wext -s -i eth0 -c /etc/wpa_supplicant/wpa_supplicant.conf -C /var/run/wpa_supplicant -B
+ udhcpc -S -i eth0 -s /etc/udhcpc.d/default.script -t15 -T10 -A3 -b -q
udhcpc: SIOCGIFINDEX: No such device
, but with sleep 2, it works.

Last edited by tshering; 01-02-2018 at 03:47 PM.
tshering is offline   Reply With Quote
Old 01-02-2018, 04:43 PM   #49
baskerville
Evangelist
baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.
 
baskerville's Avatar
 
Posts: 445
Karma: 305160
Join Date: Aug 2015
Device: Kobo Glo HD, Kobo Aura ONE
Quote:
Originally Posted by tshering View Post
Code:
+ ifconfig eth0 up
ifconfig: SIOCGIFFLAGS: No such device
Does it work if you add:

Code:
while [ ! -e /sys/class/net/${INTERFACE} ] ; do
	sleep 0.1
done
before ifconfig eth0 up?
baskerville is offline   Reply With Quote
Old 01-02-2018, 05:12 PM   #50
tshering
Wizard
tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.
 
Posts: 3,489
Karma: 2914715
Join Date: Jun 2012
Device: kobo touch
Quote:
Originally Posted by baskerville View Post
Does it work if you add:

Code:
while [ ! -e /sys/class/net/${INTERFACE} ] ; do
	sleep 0.1
done
before ifconfig eth0 up?
Yes, it does. On my device after 6 loops. I will take this approach too.
tshering is offline   Reply With Quote
Advert
Old 01-03-2018, 01:54 PM   #51
baskerville
Evangelist
baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.
 
baskerville's Avatar
 
Posts: 445
Karma: 305160
Join Date: Aug 2015
Device: Kobo Glo HD, Kobo Aura ONE
I've released 0.3.1.

The installation instructions have changed slightly: there's one archive for the program and its support files, and one archive for each launcher.

@tshering: Is the script packaged in plato-launcher-ksm-0.3.1.zip ok?
baskerville is offline   Reply With Quote
Old 01-03-2018, 04:58 PM   #52
tshering
Wizard
tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.
 
Posts: 3,489
Karma: 2914715
Join Date: Jun 2012
Device: kobo touch
Quote:
Originally Posted by baskerville View Post
@tshering: Is the script packaged in plato-launcher-ksm-0.3.1.zip ok?
I was thinking of something like:
Spoiler:
Code:
#! /bin/sh

WORKDIR=$(dirname "$0")
cd "$WORKDIR" || exit 1

if pidof nickel; then
  FROMNICKEL=true
  eval "$(xargs -n 1 -0 < /proc/$(pidof nickel)/environ | sed -e 's/^/export /')"
  sync
  killall nickel hindenburg sickel fickel fmon > /dev/null 2>&1
else
  FROMNICKEL=false
fi

export LD_LIBRARY_PATH="libs:${LD_LIBRARY_PATH}"

./plato > info.log 2>&1 || mv info.log crash.log

if [ "${FROMNICKEL}" == "true" ]; then
  ./nickel.sh &
fi
so that you have to distribute only one version. KSM would call it with a wrapper script like this
Spoiler:
Code:
#! /bin/sh

# todo: set rotation value for the different device models
# currently I know only for sure that trilogy|kraken|alyssum|daylight need 3
case $PRODUCT in
  trilogy|kraken|alyssum|daylight ) platoRotation="3";;
  * ) platoRotation="3";;
esac

currentRotation=$(cat /sys/class/graphics/fb0/rotate)
echo "${platoRotation}" > /sys/class/graphics/fb0/rotate
cat /sys/class/graphics/fb0/rotate > /sys/class/graphics/fb0/rotate


# todo: maybe warn when wifi is on?

${platobasedir}/plato.sh
# alternatively
#cd "${platobasedir}" || exit 1
#export LD_LIBRARY_PATH="libs:${LD_LIBRARY_PATH}"
#./plato > info.log 2>&1 || mv info.log crash.log


echo "${currentRotation}" > /sys/class/graphics/fb0/rotate
cat /sys/class/graphics/fb0/rotate > /sys/class/graphics/fb0/rotate

# todo: maybe warn when wifi is on?
note: the line
Code:
cat /sys/class/graphics/fb0/rotate > /sys/class/graphics/fb0/rotate
is needed for some models (Aura HD, H2O, H2O2, if I remember correctly).

Are you certain that 3 is the correct rotate value for all models?
tshering is offline   Reply With Quote
Old 01-03-2018, 07:01 PM   #53
tshering
Wizard
tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.
 
Posts: 3,489
Karma: 2914715
Join Date: Jun 2012
Device: kobo touch
On Kobo Glo, the menu (sandwich symbol) does not work. It registers the touch (becomes dark for a moment, but the menu does not open. It works however on the Kobo Touch (C).
tshering is offline   Reply With Quote
Old 01-04-2018, 09:41 AM   #54
baskerville
Evangelist
baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.
 
baskerville's Avatar
 
Posts: 445
Karma: 305160
Join Date: Aug 2015
Device: Kobo Glo HD, Kobo Aura ONE
I've ran top and noticed that the plato process is using 99% CPU in idle state. Don't use Plato until further notice!
baskerville is offline   Reply With Quote
Old 01-04-2018, 10:00 AM   #55
baskerville
Evangelist
baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.
 
baskerville's Avatar
 
Posts: 445
Karma: 305160
Join Date: Aug 2015
Device: Kobo Glo HD, Kobo Aura ONE
Fortunately, I found the source of the problem quickly: reading from /tmp/nickel-hardware-status!

I will therefore drop the current approach (unless someone has an idea on how to properly poll the FIFO) and write something similar to libue instead.

The problem exists since version 0.2.0.
baskerville is offline   Reply With Quote
Old 01-04-2018, 12:32 PM   #56
tshering
Wizard
tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.
 
Posts: 3,489
Karma: 2914715
Join Date: Jun 2012
Device: kobo touch
Quote:
Originally Posted by baskerville View Post
I've ran top and noticed that the plato process is using 99% CPU in idle state. Don't use Plato until further notice!
Are you sure that there is a problem? I see 99.x% idle most of the time with plato running, falling to 86% idle while opening large books. Isn't this a good value?

Last edited by tshering; 01-04-2018 at 12:38 PM.
tshering is offline   Reply With Quote
Old 01-04-2018, 01:41 PM   #57
baskerville
Evangelist
baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.
 
baskerville's Avatar
 
Posts: 445
Karma: 305160
Join Date: Aug 2015
Device: Kobo Glo HD, Kobo Aura ONE
Quote:
Originally Posted by tshering View Post
Isn't this a good value?
No it isn't (it should be about 0 %).

But I was able to fix the problem in e89d090 and will make a release soon.
baskerville is offline   Reply With Quote
Old 01-05-2018, 09:03 AM   #58
baskerville
Evangelist
baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.
 
baskerville's Avatar
 
Posts: 445
Karma: 305160
Join Date: Aug 2015
Device: Kobo Glo HD, Kobo Aura ONE
I've released 0.3.2.

This version fixes the CPU hog problem!

Last edited by baskerville; 01-05-2018 at 12:00 PM.
baskerville is offline   Reply With Quote
Old 01-10-2018, 01:33 PM   #59
baskerville
Evangelist
baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.
 
baskerville's Avatar
 
Posts: 445
Karma: 305160
Join Date: Aug 2015
Device: Kobo Glo HD, Kobo Aura ONE
Quote:
Originally Posted by tshering View Post
I was thinking of something like:
Spoiler:
Code:
#! /bin/sh

WORKDIR=$(dirname "$0")
cd "$WORKDIR" || exit 1

if pidof nickel; then
  FROMNICKEL=true
  eval "$(xargs -n 1 -0 < /proc/$(pidof nickel)/environ | sed -e 's/^/export /')"
  sync
  killall nickel hindenburg sickel fickel fmon > /dev/null 2>&1
else
  FROMNICKEL=false
fi

export LD_LIBRARY_PATH="libs:${LD_LIBRARY_PATH}"

./plato > info.log 2>&1 || mv info.log crash.log

if [ "${FROMNICKEL}" == "true" ]; then
  ./nickel.sh &
fi
so that you have to distribute only one version. KSM would call it with a wrapper script like this
Spoiler:
Code:
#! /bin/sh

# todo: set rotation value for the different device models
# currently I know only for sure that trilogy|kraken|alyssum|daylight need 3
case $PRODUCT in
  trilogy|kraken|alyssum|daylight ) platoRotation="3";;
  * ) platoRotation="3";;
esac

currentRotation=$(cat /sys/class/graphics/fb0/rotate)
echo "${platoRotation}" > /sys/class/graphics/fb0/rotate
cat /sys/class/graphics/fb0/rotate > /sys/class/graphics/fb0/rotate

# todo: maybe warn when wifi is on?

${platobasedir}/plato.sh
# alternatively
#cd "${platobasedir}" || exit 1
#export LD_LIBRARY_PATH="libs:${LD_LIBRARY_PATH}"
#./plato > info.log 2>&1 || mv info.log crash.log

echo "${currentRotation}" > /sys/class/graphics/fb0/rotate
cat /sys/class/graphics/fb0/rotate > /sys/class/graphics/fb0/rotate

# todo: maybe warn when wifi is on?
note: the line
Code:
cat /sys/class/graphics/fb0/rotate > /sys/class/graphics/fb0/rotate
is needed for some models (Aura HD, H2O, H2O2, if I remember correctly).
I prefer to have one script and some support files (fmon requires icons/plato.png but KSM doesn't) for each launcher.

Quote:
Originally Posted by tshering View Post
Are you certain that 3 is the correct rotate value for all models?
I'm not.
baskerville is offline   Reply With Quote
Old 01-10-2018, 01:40 PM   #60
baskerville
Evangelist
baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.baskerville ought to be getting tired of karma fortunes by now.
 
baskerville's Avatar
 
Posts: 445
Karma: 305160
Join Date: Aug 2015
Device: Kobo Glo HD, Kobo Aura ONE
Quote:
Originally Posted by tshering View Post
On Kobo Glo, the menu (sandwich symbol) does not work. It registers the touch (becomes dark for a moment, but the menu does not open. It works however on the Kobo Touch (C).
Is there anything out of the ordinary in info.log?

Can you open the Sort by: … menu? or the frontlight dialog?

Can you toggle the frontlight by holding your finger on the frontlight icon?
baskerville is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PocketBook-KOReader: a document reader for PDF, DJVU, EPUB, FB2, CBZ, ... (AGPLv3) chrox KOReader 569 09-15-2024 10:13 AM
KOReader: a document reader for PDF, DJVU, EPUB, FB2, HTML, ... (GPLv3) hawhill Kindle Developer's Corner 1268 02-27-2024 12:49 PM
Kindle -- KOReader: a document reader for PDF, DJVU, EPUB, FB2, HTML, ... (GPLv3) hawhill KOReader 1219 01-27-2024 03:29 PM
v3 vs. v3+ as a pdf/DjVu reader hedonism_bot HanLin eBook 7 11-02-2010 09:16 PM


All times are GMT -4. The time now is 08:25 PM.


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