View Single Post
Old 01-02-2018, 01: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: 446
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