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 10-13-2018, 11:51 AM   #1
frostschutz
Linux User
frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.
 
frostschutz's Avatar
 
Posts: 2,279
Karma: 6123806
Join Date: Sep 2010
Location: Heidelberg, Germany
Device: none
user interaction while nickel is running?

While reading a book with nickel, I'd like to do something akin of displaying a Yes/No popup dialog box, and allow the user to interact with it.

The problem is, nickel will process those touch events and flip pages or do other random things.

Is there a way to make nickel ignore touch events temporarily, so you can go seamlessly from reading to an interactive popup and back to reading?

My attempts so far were unsuccessful:

- (un-)binding the touchscreen driver disables touch, but for nickel it does so permanently; have to re-start nickel entirely to make touch work again.

- freezing nickel (kill SIGSTOP) allows user interaction just fine, but when you unfreeze nickel (kill SIGCONT), it will still process all touch events that happened while frozen

Any ideas?
frostschutz is offline   Reply With Quote
Old 10-13-2018, 12:02 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: 26012494
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW, PW2, PW5; Kobo H2O, Forma, Elipsa, Sage, C2E
I don't recall if an EVIOCGRAB ioctl would help ensuring you get exclusive access to the input device without the events getting queued and replayed back to nickel when you're done :/.

(Or if that even works as intended at all here, I vaguely recall having it in in FBInk at one point, and nickel happily getting my fake events anyway, so :/).

Because short of that, I don't have any bright ideas. I'd say putting nickel in a state where stray inputs would be harmless, but that's much easier said than done on a Kobo ;p.
NiLuJe is offline   Reply With Quote
Advert
Old 10-13-2018, 02:04 PM   #3
frostschutz
Linux User
frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.
 
frostschutz's Avatar
 
Posts: 2,279
Karma: 6123806
Join Date: Sep 2010
Location: Heidelberg, Germany
Device: none
Thanks! I didn't think of ioctl at all, but it seems to work just fine, I just tried it on my H2O.

EVIOCGRAB does the trick, nickel no longer sees the touch events.

Of course the downside is, pickel wait-for-hit no longer sees them either, so I have to handle touch events myself.

Or maybe not: pickel is actually happy with a fifo instead of the real touch device. So I can write a small C utility that grabs the touchscreen, bounces all the data into a fifo, where pickel wait-for-hit then picks it up.

----

trivial code snippet I used for test (grabs touch for 60 seconds or until you ctrl-c)

Code:
int main(int argc, char *argv[]) {
    int fd = open("/dev/input/event1", O_RDONLY);
    if(ioctl(fd, EVIOCGRAB, 1) == -1) {
        perror("Failed EVIOCGRAB grab");
        exit(1);
    }
    printf("Grabbed touchscreen...\n");
    sleep(60);
    if(ioctl(fd, EVIOCGRAB, 0) == -1) {
        perror("Failed EVIOCGRAB release");
        exit(1);
    }
    exit(0);
}

Last edited by frostschutz; 10-13-2018 at 02:09 PM.
frostschutz is offline   Reply With Quote
Old 10-13-2018, 06:06 PM   #4
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: 856
Karma: 2676800
Join Date: Aug 2008
Location: Taranaki - NZ
Device: Kobo Aura H2O, Kobo Forma
Oooh. This looks interesting...

An application/script launcher without kfmon/fmon anyone?
sherman is offline   Reply With Quote
Old 10-24-2018, 11:19 AM   #5
frostschutz
Linux User
frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.
 
frostschutz's Avatar
 
Posts: 2,279
Karma: 6123806
Join Date: Sep 2010
Location: Heidelberg, Germany
Device: none
One caveat with this method... once you freeze nickel and grab the touchscreen exclusively, if your app crashes or gets stuck for any reason, there is no way to get out.

You can't power off or reboot the reader anymore, since nickel is the one processing those button signals, but you've frozen both nickel and the touchscreen so the device is unresponsive to all inputs.

I'm lucky since my H2O has a dedicated reset button/hole next to the USB port ( that still works ), but from what I understand newer models no longer have a reset button.

Without reset button I guess the only thing you could do is wait for the ereader to run out of power (or open it and disconnect battery physically).
frostschutz is offline   Reply With Quote
Advert
Old 10-24-2018, 11:27 AM   #6
geek1011
Wizard
geek1011 ought to be getting tired of karma fortunes by now.geek1011 ought to be getting tired of karma fortunes by now.geek1011 ought to be getting tired of karma fortunes by now.geek1011 ought to be getting tired of karma fortunes by now.geek1011 ought to be getting tired of karma fortunes by now.geek1011 ought to be getting tired of karma fortunes by now.geek1011 ought to be getting tired of karma fortunes by now.geek1011 ought to be getting tired of karma fortunes by now.geek1011 ought to be getting tired of karma fortunes by now.geek1011 ought to be getting tired of karma fortunes by now.geek1011 ought to be getting tired of karma fortunes by now.
 
Posts: 2,735
Karma: 6990705
Join Date: May 2016
Location: Ontario, Canada
Device: Kobo Mini, Aura Edition 2 v1, Clara HD
How about using the hardware watchdog? Maybe you could use that as well as an additional software one to reenable the touchscreen if the app crashes, and to reboot the device if the software watchdog crashes.
geek1011 is offline   Reply With Quote
Old 10-24-2018, 12:33 PM   #7
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 frostschutz View Post
You can't power off or reboot the reader anymore, since nickel is the one processing those button signals, but you've frozen both nickel and the touchscreen so the device is unresponsive to all inputs.
Holding the power button 20 secs or longer should still power the device off.
tshering is offline   Reply With Quote
Old 10-24-2018, 12:53 PM   #8
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: 26012494
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW, PW2, PW5; Kobo H2O, Forma, Elipsa, Sage, C2E
I have extremely rarely managed to not be able to rely on the ~20s power button behavior (on a H2O, again, so, reset hole to the rescue).

I can't recall anything weirdly specific about the time this happened, but, eh, there you go .
NiLuJe is offline   Reply With Quote
Old 10-24-2018, 01:07 PM   #9
frostschutz
Linux User
frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.
 
frostschutz's Avatar
 
Posts: 2,279
Karma: 6123806
Join Date: Sep 2010
Location: Heidelberg, Germany
Device: none
Okay, maybe I only hold the power button for ~15s instead of 20. (didn't work)
I'll have to test it again later.
(Edit: Okay this time it worked. before it did not. no idea.)

Well, my app only expects a few touches, so my (stupid) idea was to count the touchscreen activity inside the grabber, and quit after processing a certain amount of data. So you can get out of it by drawing a few circles on the touchscreen.

Hummm, well, it only got stuck because of a bug so I could simply pretend it won't happen again.

Last edited by frostschutz; 10-24-2018 at 02:08 PM.
frostschutz is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Eink stanalone demo Qt eink driver for standalone qt apps ie no nickel nickel tonyv Kobo Developer's Corner 2 12-27-2012 09:35 AM
Interaction umarramzan47 Introduce Yourself 2 12-11-2011 05:29 PM
Calibre interaction with Kobo eReader blivett Devices 2 04-03-2011 07:09 PM
Stanza and Calibre interaction fail whitepawn Calibre 1 05-09-2010 01:53 AM
PDA247 is running a user survey Alexander Turcic Lounge 0 07-29-2005 07:10 PM


All times are GMT -4. The time now is 09:19 AM.


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