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 06-30-2022, 09:35 PM   #46
sherman
Guru
sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.
 
Posts: 869
Karma: 2676800
Join Date: Sep 2008
Location: Taranaki - NZ
Device: Kobo Aura H2O, Kobo Forma
As far as I know, wfmSetAirplaneMode just sets weather the Wifi is active or not. It doesn't necessarily connect to a network.

You'll want to use wfmConnectWireless or wfmConnectWirelessSilently to connect to a network.

Regarding timeout, only a single timeout is supported. It might be getting confused with two.

EDIT: hang on, just re-read your script... hmm
sherman is offline   Reply With Quote
Old 06-30-2022, 09:38 PM   #47
sherman
Guru
sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.
 
Posts: 869
Karma: 2676800
Join Date: Sep 2008
Location: Taranaki - NZ
Device: Kobo Aura H2O, Kobo Forma
Also, are you running the script from NickelMenu with cmd_spawn?
sherman is offline   Reply With Quote
Advert
Old 06-30-2022, 10:23 PM   #48
Rid
Addict
Rid can self-interpret dreams as they happen.Rid can self-interpret dreams as they happen.Rid can self-interpret dreams as they happen.Rid can self-interpret dreams as they happen.Rid can self-interpret dreams as they happen.Rid can self-interpret dreams as they happen.Rid can self-interpret dreams as they happen.Rid can self-interpret dreams as they happen.Rid can self-interpret dreams as they happen.Rid can self-interpret dreams as they happen.Rid can self-interpret dreams as they happen.
 
Posts: 205
Karma: 20980
Join Date: Oct 2020
Device: Kobo Aura One, Aura HD (R.I.P.) :(
Quote:
Originally Posted by sherman View Post
Also, are you running the script from NickelMenu with cmd_spawn?
Yes

Code:
menu_item :main :Test Script :cmd_spawn :quiet :/mnt/onboard/.adds/ndbus/scripts/NDBus_Test.sh
Rid is offline   Reply With Quote
Old 06-30-2022, 10:32 PM   #49
Rid
Addict
Rid can self-interpret dreams as they happen.Rid can self-interpret dreams as they happen.Rid can self-interpret dreams as they happen.Rid can self-interpret dreams as they happen.Rid can self-interpret dreams as they happen.Rid can self-interpret dreams as they happen.Rid can self-interpret dreams as they happen.Rid can self-interpret dreams as they happen.Rid can self-interpret dreams as they happen.Rid can self-interpret dreams as they happen.Rid can self-interpret dreams as they happen.
 
Posts: 205
Karma: 20980
Join Date: Oct 2020
Device: Kobo Aura One, Aura HD (R.I.P.) :(
Quote:
Originally Posted by sherman View Post
Regarding timeout, only a single timeout is supported. It might be getting confused with two.
Cool thanks will retest it.

As far as wmWifiEnabled is concerned I don't think it was what I thought it was going to do.

If I had this code for example, do I only need to use one -s or will i need a -s on wmNetworkFailedToConnect as well?
Code:
qndb -t 50000 -s wmNetworkConnected wmNetworkFailedToConnect -m wfmConnectWirelessSilently
Rid is offline   Reply With Quote
Old 06-30-2022, 11:07 PM   #50
Rid
Addict
Rid can self-interpret dreams as they happen.Rid can self-interpret dreams as they happen.Rid can self-interpret dreams as they happen.Rid can self-interpret dreams as they happen.Rid can self-interpret dreams as they happen.Rid can self-interpret dreams as they happen.Rid can self-interpret dreams as they happen.Rid can self-interpret dreams as they happen.Rid can self-interpret dreams as they happen.Rid can self-interpret dreams as they happen.Rid can self-interpret dreams as they happen.
 
Posts: 205
Karma: 20980
Join Date: Oct 2020
Device: Kobo Aura One, Aura HD (R.I.P.) :(
I tried the scrip with the timeout change but at 6min it did not display a msg until I opened a book.

The message was step qndb -m dlgConfirmAccept "Wifi Timer 7" "Enabled Wifi" "OK"

Code:
signal07=$(qndb -t 50000 -s wmWifiEnabled -m wfmSetAirplaneMode "enable")

Last edited by Rid; 06-30-2022 at 11:11 PM. Reason: forgot to add the msg
Rid is offline   Reply With Quote
Advert
Old 07-01-2022, 12:21 AM   #51
Rid
Addict
Rid can self-interpret dreams as they happen.Rid can self-interpret dreams as they happen.Rid can self-interpret dreams as they happen.Rid can self-interpret dreams as they happen.Rid can self-interpret dreams as they happen.Rid can self-interpret dreams as they happen.Rid can self-interpret dreams as they happen.Rid can self-interpret dreams as they happen.Rid can self-interpret dreams as they happen.Rid can self-interpret dreams as they happen.Rid can self-interpret dreams as they happen.
 
Posts: 205
Karma: 20980
Join Date: Oct 2020
Device: Kobo Aura One, Aura HD (R.I.P.) :(
Did another test to see if it would eventually time out and it did.

Manually turned off the wifi on the Kobo, turned off my access point. Then ran the the script. It took about 12min50sec to get the "ERROR: timeout" msg. Tested this twice.
Rid is offline   Reply With Quote
Old 07-01-2022, 12:39 AM   #52
sherman
Guru
sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.
 
Posts: 869
Karma: 2676800
Join Date: Sep 2008
Location: Taranaki - NZ
Device: Kobo Aura H2O, Kobo Forma
Quote:
Originally Posted by Rid View Post
Did another test to see if it would eventually time out and it did.

Manually turned off the wifi on the Kobo, turned off my access point. Then ran the the script. It took about 12min50sec to get the "ERROR: timeout" msg. Tested this twice.
Thanks for the reports, I'll have to investigate this when I get time.
sherman is offline   Reply With Quote
Old 07-01-2022, 01:40 AM   #53
Rid
Addict
Rid can self-interpret dreams as they happen.Rid can self-interpret dreams as they happen.Rid can self-interpret dreams as they happen.Rid can self-interpret dreams as they happen.Rid can self-interpret dreams as they happen.Rid can self-interpret dreams as they happen.Rid can self-interpret dreams as they happen.Rid can self-interpret dreams as they happen.Rid can self-interpret dreams as they happen.Rid can self-interpret dreams as they happen.Rid can self-interpret dreams as they happen.
 
Posts: 205
Karma: 20980
Join Date: Oct 2020
Device: Kobo Aura One, Aura HD (R.I.P.) :(
No worries. Thanks for all the hard work making NickelDBus!!
Rid is offline   Reply With Quote
Old 07-28-2022, 06:05 PM   #54
ajkessel
Connoisseur
ajkessel began at the beginning.
 
Posts: 76
Karma: 10
Join Date: Jul 2017
Location: Boston
Device: Kobo Libra 2
When I telnet into my Kobo Libra 2 and run
Code:
qndb -t 60000 -s pfmDoneProcessing -m pfmRescanBooksFull
It does what you would expect as documented. But when I put that command in a shell script that is spawned from NickelMenu, it seems to not wait for the rescan to finish--it immediately goes to the next line of the script. I can add a manual sleep line in the script but I don't understand why the qndb command works in one context but not another. Can anyone point me in the right direction?
ajkessel is offline   Reply With Quote
Old 07-28-2022, 06:57 PM   #55
sherman
Guru
sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.
 
Posts: 869
Karma: 2676800
Join Date: Sep 2008
Location: Taranaki - NZ
Device: Kobo Aura H2O, Kobo Forma
Quote:
Originally Posted by ajkessel View Post
When I telnet into my Kobo Libra 2 and run
Code:
qndb -t 60000 -s pfmDoneProcessing -m pfmRescanBooksFull
It does what you would expect as documented. But when I put that command in a shell script that is spawned from NickelMenu, it seems to not wait for the rescan to finish--it immediately goes to the next line of the script. I can add a manual sleep line in the script but I don't understand why the qndb command works in one context but not another. Can anyone point me in the right direction?
When you use cmd_spawn in NickelMenu, it runs the script in a separate process, then carries on. If you try and use cmd_output, NickelMenu & NickelDBus will conflict with each other.

If you want to do stuff after the content import, you should do it in the shell script if possible. If there is something that you are trying to do in NickelMenu that can't be done in NickelDBus, let me know, and I might be able to add it.
sherman is offline   Reply With Quote
Old 07-28-2022, 07:08 PM   #56
ajkessel
Connoisseur
ajkessel began at the beginning.
 
Posts: 76
Karma: 10
Join Date: Jul 2017
Location: Boston
Device: Kobo Libra 2
Quote:
Originally Posted by sherman View Post
When you use cmd_spawn in NickelMenu, it runs the script in a separate process, then carries on. If you try and use cmd_output, NickelMenu & NickelDBus will conflict with each other.

If you want to do stuff after the content import, you should do it in the shell script if possible. If there is something that you are trying to do in NickelMenu that can't be done in NickelDBus, let me know, and I might be able to add it.
Thanks! I am actually trying to do it all in the shell script. Here is the full context:
Code:
#!/bin/sh
qndb -t 60000 -s pfmDoneProcessing -m pfmRescanBooksFull
echo usb plug add >>/tmp/nickel-hardware-status
sleep 10
echo usb plug remove >>/tmp/nickel-hardware-status
The goal is to trigger KoboCloud to sync with the cloud, and then to trigger a USB connect/disconnect in order to get AutoShelf to organize the newly downloaded items into collections. When I run the first command from telnet, it waits until it's done. When I run it from the shell script triggered by cmd_spawn, it seems to skip instantly to the next step without waiting for the rescan to complete.

Am I doing it wrong?
ajkessel is offline   Reply With Quote
Old 07-28-2022, 07:25 PM   #57
sherman
Guru
sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.
 
Posts: 869
Karma: 2676800
Join Date: Sep 2008
Location: Taranaki - NZ
Device: Kobo Aura H2O, Kobo Forma
Quote:
Originally Posted by ajkessel View Post
Thanks! I am actually trying to do it all in the shell script. Here is the full context:
Code:
#!/bin/sh
qndb -t 60000 -s pfmDoneProcessing -m pfmRescanBooksFull
echo usb plug add >>/tmp/nickel-hardware-status
sleep 10
echo usb plug remove >>/tmp/nickel-hardware-status
The goal is to trigger KoboCloud to sync with the cloud, and then to trigger a USB connect/disconnect in order to get AutoShelf to organize the newly downloaded items into collections. When I run the first command from telnet, it waits until it's done. When I run it from the shell script triggered by cmd_spawn, it seems to skip instantly to the next step without waiting for the rescan to complete.

Am I doing it wrong?
That looks ok.

I suggest showing a couple of toasts to see what's going on. Eg:
Code:
qndb -m mwcToast 3000 "Faking USB plug"
qndb -m mwcToast 3000 "Faking USB unplug"
sherman is offline   Reply With Quote
Old 07-28-2022, 07:35 PM   #58
ajkessel
Connoisseur
ajkessel began at the beginning.
 
Posts: 76
Karma: 10
Join Date: Jul 2017
Location: Boston
Device: Kobo Libra 2
I actually added toasts before and after each step to see what was happening. It does seem to go very quickly past the pfmRescanBooksFull line. Is it possible that it's dropped off the WiFi so it doesn't find anything to sync? Is there a step I could insert to make sure it's on WiFi before attempting the rescan?
ajkessel is offline   Reply With Quote
Old 07-29-2022, 10:30 AM   #59
ajkessel
Connoisseur
ajkessel began at the beginning.
 
Posts: 76
Karma: 10
Join Date: Jul 2017
Location: Boston
Device: Kobo Libra 2
I think we can rule out wifi being the issue. I've modified the script as follows:
Code:
#!/bin/sh
ifconfig wlan0 up
qndb -m mwcToast 3000 "Checking wifi"
if ( ifconfig|grep 'inet addr' )
then
qndb -m mwcToast 3000 "WiFi on"
else
qndb -m mwcToast 3000 "WiFi off, waiting"
sleep 5
fi
if ( ifconfig|grep 'inet addr' )
then
qndb -m mwcToast 3000 "WiFi on"
else
qndb -m mwcToast 3000 "WiFi still off"
fi
qndb -m mwcToast 3000 "Rescanning library"
qndb -t 60000 -s pfmDoneProcessing -m pfmRescanBooksFull
qndb -m mwcToast 3000 "Autoshelfing"
echo usb plug add >>/tmp/nickel-hardware-status  # Simulate plugging in the usb
sleep 10
echo usb plug remove >>/tmp/nickel-hardware-status # Simulate the disconnect of our simulated usb, takes a few sec after the sleep for the change to show up on the device
qndb -m mwcToast 3000 "Done"
Even while making sure WiFi is on and connected, it jumps immediately from "Rescanning library" to "Autoshelfing" -- there is virtually no delay in the interim.
ajkessel is offline   Reply With Quote
Old 07-29-2022, 05:04 PM   #60
ajkessel
Connoisseur
ajkessel began at the beginning.
 
Posts: 76
Karma: 10
Join Date: Jul 2017
Location: Boston
Device: Kobo Libra 2
I think I've figured it out. The KoboCloud sync script immediately forks on execution, so there is never time for it to complete before the usb unplug/plug occurs. I modified the KoboCloud script to disable forking, and now it seems to work as expected.
ajkessel is offline   Reply With Quote
Reply

Tags
kobo, ldpreload, nickel


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
'RUN, RUN, RUN' a crime thriller $1.61 tothepoint Self-Promotions by Authors and Publishers 10 09-01-2014 01:07 PM
Calibre: Bus error migdus Calibre 7 08-16-2011 12:58 AM
/proc/bus/usb ? troymc Calibre 3 09-05-2009 11:35 AM


All times are GMT -4. The time now is 10:56 PM.


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