From 726d71d88bf9d96ade702992a7625ff56dcfac78 Mon Sep 17 00:00:00 2001 From: Ashish Gupta Date: Sun, 8 Oct 2017 19:23:59 +0200 Subject: Never wait indefinitely (as this messes with the Network Stack events via the content/fetcher) --- src/surface/kolibri.c | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/src/surface/kolibri.c b/src/surface/kolibri.c index 25b59e1..d1b5d4c 100644 --- a/src/surface/kolibri.c +++ b/src/surface/kolibri.c @@ -53,13 +53,6 @@ int kolibri_get_button_id(void) } } -int kolibri_wait_for_event(void) -{ - uint32_t __ret; - __asm__ __volatile__ ("int $0x40":"=a"(__ret):"0"(10)); - return __ret; -} - int kolibri_get_pressed_key(void) { uint16_t __ret; @@ -243,8 +236,7 @@ static int kolibri_surface_initialise(nsfb_t *nsfb) EVENT_BUTTON | EVENT_MOUSE_CHANGE | EVENT_INACTIVE_NO_CURSOR | - EVENT_INACTIVE_NO_MOUSE | - EVENT_NETWORK); + EVENT_INACTIVE_NO_MOUSE); return 0; } @@ -364,19 +356,19 @@ int ispowerkey(int scancode) } static bool kolibri_surface_input(nsfb_t *nsfb, nsfb_event_t *event, - int timeout) + int timeout) { int got_event; static int scanfull = 0; char event_num[20]; + nsfb = nsfb; /* unused */ + /* schedule_run from gui.c might have returned negative for wait forever. This stalls us completely for network etc. + Don't do that. Always try to yield back to scheduler asap */ - if (timeout >= 0) { - got_event = kolibri_wait_for_event_with_timeout(timeout / 10); - } else { - got_event = kolibri_wait_for_event(); - } + if(timeout < 0) timeout = 100; /* millis */ + got_event = kolibri_wait_for_event_with_timeout(timeout / 10); if (got_event == 0) { return false; -- cgit v1.2.3