sysfs_light handles every case sanely already, no need to be cute ;).
This prevents always setting the warmth when setting the FL on NL
devices with a mixer, because, besides being useless, it's also slow
(lua does mmap'ed io, so every handle requires an fstat + mmap).
It was subtly affecting the fluidity of the toggle ramp, and much less
subtly wreaking havoc on #5373 ;).
KA1 owners might want to investigate keeping the fds around one way or
another, like we do for the fl ioctl, to alleviate the overhead of doing
that for not one but three or four fds...
I won't be doing that, since I lack the hardware to test it, and FL+NL
stuff is pain.
* Do the same on Cervantes
* Bump base to pickup related ioctl tweaks
When reasonably possible, the program should only crash in debug mode.
Adds a couple of extra unit tests to prevent regressions and adds docs.
Fixes <https://github.com/koreader/koreader/issues/5356>.
This commit standardizes the various todos around the code a bit in a manner recognized by LDoc.
Besides drawing more attention by being displayed in the developer docs, they're also extractable with LDoc on the command line:
```sh
ldoc --tags todo,fixme *.lua
```
However, whether that particular usage offers any advantage over other search tools is questionable at best.
* and some random beautification
* Try to make sure restoreWifiAsync eventually sends a NetworkConnected
event...
re: #5109
* Take a page from @shermp's book, and make sure wpa_supplicant managed to
connect to the AP before acquiring an IP.
Tear down WiFi modules in case of failure.
c.f., https://github.com/shermp/Kobo-UNCaGED/pull/21
* Don't let restore-wifi-async.sh enable WiFi behind our back when we're
killing it to start Nickel...
* Don't even call ping if there's no default gw
Close: #4997
This PR add support arrow key and mouse scroll wheel for next/previous page.
- Document in page mode:
PageDown, Arrow down, Arrow right - go to next page
PageUp, Arrow up, arrow left - go to prev page
Mouse scroll wheel down - go to next page
Mouse scroll wheel up - go to prev page
- Document in scroll mode:
PageDown, Arrow right - go to next page
PageUp, Arrow, arrow left - go to prev page
Arrow down - scroll document down
Arrow up - scroll document up
Mouse scroll wheel down - scroll document down
Mouse scroll wheel up - scroll document up
* Fix Kindle model detection in some corner-cases
We were (currently) unaffected because we don't support the K1.
Still, this should be slightly more robust.
* Make toggling Gyro events more robust
Actually ask to turn it on/off depending on the setting, instead of a
blind toggle
A quick succession of suspend/resume events could otherwise leave it
in an unexpected state (i.e., off when it should have been on).
For some mysterious reason, I have a duplicate default gateway on my
Forma, one with no metrics, and a proper one.
This ensures we pick the proper one.
I'm fairly sure this is temporary insanity on the part of my device,
but, still, it can't hurt.
route -n:
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.0.1 0.0.0.0 UG 0 0 0 eth0
0.0.0.0 192.168.0.1 0.0.0.0 UG 208 0 0 eth0
192.168.0.0 0.0.0.0 255.255.255.0 U 208 0 0 eth0
ip r:
default via 192.168.0.1 dev eth0
default via 192.168.0.1 dev eth0 metric 208
192.168.0.0/24 dev eth0 src 192.168.0.49 metric 208
Either at all, or because it would impose reduced functionality.
Meaning:
* On 4bpp fb, because those are completely unsupported by the C BB
* On 24bpp fb, because it has limited support for that target format (no alpha blending).
* On 8bpp Linux eInk fb with an inverted palette (that's basically only the K4 ;)).
* On Linux eInk devices w/ no HW inversion support, as that would render NightMode inoperable.
That last point means that it's currently *always* blacklisted on PocketBook, because I don't have a PB device, so I don't know how safe HW inversion would be, meaning none of them are marked as being HW invert capable.
(I was a tiny bit hasty with https://github.com/koreader/koreader-base/pull/912 ;).)
on if it's off.
Because, on the KA1, since wetting the warmth *has* to set the
brightness, it could ;).
Patch only actually needed on Kobo, as all Cervantes devices with warmth
support have a mixer, which mean they *can* set the warmth without
affecting the brightness ;).
* Don't override hw_intensity when we start with the FL off
* And add an insane workaround to make the first toggle behave sanely in this case.
* And also handle the sneakier case where the first toggle happening would not be manual, but triggered by a suspend/resume cycle.
* Make hasNaturalLight* caps safe to call without a device check. (fix#4919)
Make it clear that it's expecting the NTX implementation, though.
* Don't turn the FL on on resume if it was off on suspend
* Make sure turnOn/turnOff actually updates hw_intensity in the process where it matters, instead of just in a short lived fork ;). (fix#4923)
Companion PR to https://github.com/koreader/koreader-base/pull/884
* Basically flags devices known to be stable when using PxP inversion.
* Plus, random fix for #4870 ;).
* A few FrontLight tweaks & cleanups on Kobo:
* Moved the Kobo-specific startup status insanity to Kobo-specific init
* Made turnOff/turnOn frontlight do a smooth ramp down/up
* On Kobo, use turnOff/turnOn for suspend/resume, to get that smooth toggle
* On Kobo, for NaturalLight w/ a mixer, only set warmth for setWarmth, and only set Brightness for setBrightness, otherwise, it tried to set both with not in-sync values, which made the FL widget jittery.
* Fix the "Enable debug logging" checkbox so that it properly disables "Enable verbose debug logging" when it gets disabled
* Avoid asking ImageWidget for alpha-blending when it's not useful
* Make ImageWidget's alpha-blending code-path double-check that alpha-blending actually is needed, and avoid it if possible
* In the same vein, only do alpha-blending in textboxwidget when absolutely necessary
* Prefer color constants over the gray() method, ensuring that they're part of the eInk palette
Depends on https://github.com/koreader/koreader-base/pull/853Fix#4774
Partially resolves#4747. Will enable switching Wi-Fi on/off in the menu and getting the network status. However, a new Wi-Fi session lasts ~100 seconds and then terminates automatically, apparently, to save the energy. I believe it can be prolonged by some networking activity. Also it is not shut down if the auto suspension is disabled.
* The Great 8bpp Experiment
Swap to 8bpp on Kobo, because we're 'effing grayscale, for pete's sake!
* Always swap to 8bpp, no matter the launch method.
Because it turned out that, even when restarting Nickel, we had to
restore the expected bitdepth ourselves, because pickel/Nickel didn't do
the job completely.
(I'm going to guess the grayscale flag wasn't getting flipped properly).
* Dither every non-transparent icon to the eInk palette
* Make sure hasBGRFrameBuffer is only enabled when the Kobo fb actually is
@ 32bpp...
* Re-process badly grayscaled icons
* And re-grayscale that one w/ gamma correction so the squares show up
better.
* Allow the fbdepth switch to be disabled (in Developer settings).
Also, allow setting debug mode that way.
Also, forcibly disable verbose logging when disabling debug.
* Update setting name to piggyback on the existing check in reader.lua
* Update icons postprocessing info
Multiswipes consisting of mixed straight and diagonal strokes are not dependable and too easy to mess up, but making them mutually exclusive seems to work out quite well.
When multiswipes are enabled, this fixes the long-standing complaint that swiping to open the menu could unintentionally trigger some light panning. With the introduction of multiswipes, this problem has become more noticeable.
Reported by @poire-z, cf. https://github.com/koreader/koreader/pull/4640#issuecomment-466544922
Apparently it's natural for me to make the second swipe slightly longer than the first, so I never noticed a logic issue. I did notice that it seemed slightly harder to make 4-swipe multiswipes than I expected it to be, but those are not necessarily easy gestures to make.
The problem was that I needed to prevent obviously silly gestures like west west west east. In ignoring such duplication, what I accidentally did was to ignore any further movement west after the first multiswipe direction was detected, meaning that the following swipe east could still end up as a relatively western movement overall.
By simply updating the current multiswipe slot in case of the same direction, both problems are prevented. We'll never get the same direction twice, and X moves over to where it's supposed to be on the left.
The concept is quite simple: stick a file on the OTA server named
something like `koreader-appimage-latest-stable` (by analogy with
`koreader-cervantes-latest-stable.zsync`), which contains nothing
but a filename.
The difference with the zsync update is that the link is then launched
in the user's browser (AppImage) or DownloadManager (Android, not yet
implemented).
* Android hasOTAUpdate = no for the moment
When we rotate to show a screensaver, restore original rotation *before* closing the ScreenSaver window.
And ensure closing the ScreenSaver *always* triggers a full update, no
matter the settings.
Fix#4621
The basic idea is that you gain an infinite amount of extra gestures,
although in practice you're probably mostly limited to your 16 basic
two swipe combinations and maybe a few three swipe ones.
* Flash a white screen before showing a screensaver image, to prevent
ghosting.
* Really limit the white flash to full-screen images
* Limit that behavior to eInk screens
(Not that clear() is implemented anywhere else, but, still).
* On Kobo, kill WiFi on startup if we detect an inconsistent state...
Untested, not terribly pretty.
The other solution is to slow down the Wi-Fi meny by doing the same
check for the "Wi-Fi connection" checkbox as in the later wifi_status
one...
* Don't enable auto_restore_wifi by default
It's liable to silently murder batteries for no good reason, given that
we prompt to enable WiFi by default when needed, and we otherwise have
no actual need to keep WiFi on in the background.
re #2215 (in particular, this directly contradicts @houqp in
https://github.com/koreader/koreader/pull/2215#discussion_r74696133 ;)).
* Enable HW dithering on supported devices (Clara HD, Forma; Oasis 2, PW4)
* FileManager and co. (where appropriate, i.e., when covers are shown)
* Book Status
* Reader, where appropriate:
* CRe: on pages whith image content (for over 7.5% of the screen area, should hopefully leave stuff like bullet points or small scene breaks alone).
* Other engines: on user-request (in the gear tab of the bottom menu), via the new "Dithering" knob (will only appear on supported devices).
* ScreenSaver
* ImageViewer
* Minimize repaints when flash_ui is enabled (by, almost everywhere, only repainting the flashing element, and not the toplevel window which hosts it).
(The first pass of this involved fixing a few Button instances whose show_parent was wrong, in particular, chevrons in the FM & TopMenu).
* Hunted down a few redundant repaints (unneeded setDirty("all") calls),
either by switching the widget to nil when only a refresh was needed, and not a repaint,
or by passing the appropritate widget to setDirty.
(Note to self: Enable *verbose* debugging to catch broken setDirty calls via its post guard).
There were also a few instances of 'em right behind a widget close.
* Don't repaint the underlying widget when initially showing TopMenu & ConfigDialog.
We unfortunately do need to do it when switching tabs, because of their variable heights.
* On Kobo, disabled the extra and completely useless full refresh before suspend/reboot/poweroff, as well as on resume. No more double refreshes!
* Fix another debug guard in Kobo sysfs_light
* Switch ImageWidget & ImageViewer mostly to "ui" updates, which will be better suited to image content pretty much everywhere, REAGL or not.
PS: (Almost 💯 commits! :D)
Supported devices:
- Boyue T61 and *some* clones
- Boyue T62 and *some* clones
- Onyx C67
- Energy Sistem (which are in fact Boyue T62 clones). Was tested on a energy pro 4.
Others may work with the same controller too, but are disabled by default.
Requires https://github.com/koreader/koreader-base/pull/798
Requires https://github.com/koreader/android-luajit-launcher/pull/96Fixes#4373Fixes#1613 (supported devices will show the "full refresh rate" option under eink settings. Others won't)
Related #4228 (need to add support for this specific device to work)
WiFi handling is handled asynchronously (deferred to lipc), so this is a
bit clunkier than on devices where we handle WiFi ourselves...
But, basically, try to honor the menu callback when toggling WiFi so
that the status gets updated in the menu.
Fix#4472
* use product as device model
* print android version (codename + number) + api at launch
* exit the application properly
* fix fullscreen switching (and disable it on newer android versions)
* gettext: lower log level for message: cannot open translation file
* android common settings refactor
Defines new function reconnectOrShowNetworkMenu(), which iterates over
available networks ordered by signal power, and check if we can connect
to saved SSIDs. If we can, then skip network list dialog.
* Fix the Touch input probe on Trilogy devices that depend on the touch_probe_ev_epoch_time quirk (fix#630)
* Expose a "Pageturn button inversion" feature in the Navigation menu (for all devices with keys) (fix#4446)
* Allow ignoring the accelerometer on the Forma (Screen > Ignore accelerometer rotation events; also available from the Gesture Manager) (fix#4451)
* Fix SleepCover handling on the Forma (fix#4457)
* Make isWifiOn a tiny bit more accurate (check the actual WiFi module instead of sdio_wifi_pwr)
* Move all flash related Screen options to the eInk submenu
* Enforce a known rotation on startup, to make sure we handle touch input coordinates properly.
* Proper FrontLight warmth support (thanks to @cairnsh & @pazos in #4291)!
* Fix the PageTurn buttons mapping to match Nickel's defaults
* Properly remap PageTurn buttons depending on the current rotation.
* Actually enable the Mk.7 screen refresh codepath on *all* Mk.7 devices (I'd messed up the device check...).
* Full accelerometer handling (includes a touch of refactoring regarding orientation handling in general).
* Fix insidiously broken USBMS behavior in Nickel after we exit on FW >4.8.
Fix#4291Fix#3002
* Implement isWifiOn on Kindle (fix#4380)
* Ensure frontlight intensity is properly restored on resume on Kindle. (fix #Fix #4392)
Only actually matters when the frontlight is *off*.
* remove unused setting 'internal_storage_mount_point
use filemanagerutil.getDefaultDir() instead
https://github.com/koreader/koreader/blob/master/frontend/apps/filemanager/filemanagerutil.lua#L15
* more info about device frontlight/naturalLight capabilities
* make stock reader fonts available in KOReader
* remove restore-wifi-async leftovers
* wireless: fix wpa_supplicant configuration:
make it compatible w/ debian wheezy binaries
don't try to run enable-wifi.sh more than once
* Pocketbook Color Lux detection
* fix rotation for Pocketbook Color Lux
* deal with 24bit RGB framebuffer that are reported as 8bit
* use default DPI for Pocketbook Color Lux
* bump base
* Tweak JIT's loopunroll threshold on Kobo 16bpp
To avoid early blacklist of the blitbuffer code on alpha-blending
workloads.
Least terrible workaround we could come up with to "fix" #4137
* gzip kindle/kobo/pb OTA tarballs w/ --rsyncable
Should make them more zsync friendly.
* Make findcalibre actually useful
By setting SEARCH_LIBRARY_PATH when a Calibre tree is found, so that
book paths can properly be constructed.
Users should still very much set it themselves, but at least everything
works as intended when not, instead of mysteriously half-breaking later.
Drop the SetDefaults bits, it appeared to have been added to fix no-ops
detected by Luacheck, and it's actually non-functional, because
SetDefaults doesn't handle saving variables it did not itself assign.
So this was just causing the "Do you want to save new defaults" popup to
show up on exit, but it couldn't actually do anything useful (like, say,
save the new SEARCH_LIBRARY_PATH value).
fix#4082
* Better comments about the state of NaturalLight on the Clara, and how this might translate to the H2O²r2.
re #4015
* Make ScrolltextWidget refresh as "partial" only on actual Scroll events
Moving the cursor should stay "ui", or things gets annoying really fast
;).
re #4084
* Bump base to pickup ZMQ fixes (fix#4086)
* Unbreak dropbear after #4077
* Move the Kindle SO check to init
* Various virtual keyboard fixes to eradicate the remaining refresh conflicts (i.e., tearing artifacts), no matter the user's settings. (re #4069, re #3130).
* With a bonus version normalizer fix.
* And a zsync bump/fix to avoid softlocks with OpenStack HTTP frontends (also, pull those from the OTA mirror list).
* Better KOA2 support
* Fix FL
* Add physical pageturn keys
* Add accelerometer support
* Possibly better NaturalLight handling on the Clara
* Fix WiFi module name used in some(?) Mk7 Kobos
* A bunch of kodev fixes
* Link to the WiKi, it's a bit more explainy ;).
* More WiFi trickery for some HW revs
* Fix Rev2 detection under KSM
That's to future-proof it, the other end of this hasn't made it into
current KSM build yet.
* Resync nickel.sh w/ current rcS
We don't have CPU, but we have PLATFORM, which is based on CPU, so,
that'll do :).
* Go back to using rmmod instead of modprobe -r
Functionally identical on current FW, will potentially avoid getting
outsmarted by modprobe if Kobo ever deigns shipping an actually usable
Linux system one day...
* Don't crash if screensavers directory doesn't exist
c.f., https://www.mobileread.com/forums/showpost.php?p=3706979&postcount=2919
* Switch all initial highlights to "fast" update
i.e., everything that does an invert
Plus a few other things that refresh small UI elements onTap
Re #3130
* Tweak refreshtype for a number of widgets:
* Fix iconbutton dimen
* Make touchmenu flash on close & initial menu popup. Full-screen on close.
* Use flashing updates when opening/closing dictionary popup. Full-screen on close.
* Switch FileManager to partial.
It's mostly text, and we want flash promotion there.
* Make configdialog & menu flash on exit
* Make FLWidget flash on close
* virtualkeyboard: flash on layout change & popup.
* Potentially not that great workaround to ensure we actually see the
highlights in the FM's chevrons
* Flash when closing BookStatus Widget
* Optimize away a quirk of the dual "fast" update in touchmenu
* Promote updates to flashing slightly more agressively.
* Document what each refreshtype actually does.
With a few guidelines on their optimal usecases.
* Switch remaining scheduleIn(0.0) to nextTick()
* Tighter scheduling timers
Shaving a hundred ms off UI callbacks...
* Cache FFI C Library namespace
* Ask MuPDF to convert pixmaps to BGR on Kobo
Fix#3949
* Mention koxtoolchain in the README
re #3972
* Kindle: Handle *all* fonts via EXT_FONT_DIR instead of bind mounts insanity
* Make black flashes in UI elements user-configurable
(All or nothing).
* Jot down some random KOA2 sysfs path
* Refresh Kindle model ID routines
* Pickup current OTA packages
We stopped shipping files w/ the full .tar.gz extension a looooong time
ago.
* And actually generally handle current packages properly
* Kindle screensaver handling experiment
WIP, because there's a fair bit of insanity left in there.
Namely, USBMS is anathema. We simply shouldn't do that, at all,
but the system allows us to do it and basically shoot ourselves in the
head one way or another.
* Don't try to handle the insanity that would be USBMS on Kindles
* Yay, one less thing to worry about :).
* Okay, that should be much saner...
Since the whole deal w/ letting the WM handle stuff was for SO, restrict
that to SO devices.
The other concern was USBMS, but we can't support it.
* Reword that
* And move that comment inside the branch, like its counterpart
* Trim unneeded stuff from startup script
I was somehow convinced I'd already done that...
While we're there, explain why we need to siphon those specific vars
* Fix a stray eth0
-> $INTERFACE
* Be very very sure we have INTERFACE set in our env
re #3936
* Make getFirmwareVersion less fragile on Kobo
Not that we actually use it right now, but, still. :D
* Use the same syntax as the PRODUCT check
* Actually implement getProductId
Instead of a stray c/p ^^
* Properly identify the Rev2/Mark7 variants of existing devices
Namely, the H2O² and Aura SE
Not that the H2O²r2 support is still broken, this just allows us to
implement it cleanyl without breaking handling of the original H2O²
re #3925
* Tweak sleeps a bit around Kobo WiFi modules...
See if that jog things up (re #3936)
* Try harder not to suspend with WiFi on on Kobos
Because otherwise, things go boom. (re #3936)
* Fix order of tar args
Otherwise, current tar versions abort
* Unbreak Kobo IR grid resume workaround
Regression after f402ee5f6f
I'm going to assume my H2O is really, really weird, because that
commit's more than a year old o_O.
Add support in nickel_conf to save/retrieve setting of
'autoColorEnabled', which is the automatic warmth feature in
Nickel. We do not support reading of 'BedTime', because it is encoded
as a QVariant. This setting is hence saved/loaded solely in/from
G_reader_settings.
This is the first step to support "automatic warmth", meaning that
warmth will be set according to the current time. The user can set a
"bedtime" at which warmth should be maximal. Warmth will increase
towards approaching bedtime and decrease afterwards.
Add new members 'auto_warmth' and 'max_warmth_hour' which tell if this
feature is enabled and the "bedtime", resp. Add a method
'calculateAutoWarmth' which will set the current warmth according to
the current time. The progression is linear but not symmetrical: we
start 5h before "bedtime", but turn back warmth to '0' 2h after it, to
make sure that warmth is '0' in the morning.
For automatically setting warmth in the background we use the
backgroundrunner plugin, because not only is it more comfortable to
use, but we also cannot require 'uimanager' during device
initialization.
* [device][kindle4] add fake event to kindle4
* modify focusmanager to allow for more complex layout
The focusmanager now naviguate the layout by avoiding nil value
instead of relying on table lenght. It should be completely backward
compatible
* add Dpad naviguation to the touchmenu
* fix crash because virtualkeyboard on non touch device
the kindle4NT has no keyboard nor touch, the fix open the virtual
keyboard so koreader dont crash but it's not useable
* Enable device with keys to use the touchmenu
* Don't get stuck in reader progress statistics plugin
* [underlinecontainer] Fix and remove unused function
References #1898.
For warmth and/or brightness = 0, we need to make sure that the
red/green/white LEDs are actually turned off, regardless of the values
for gain/offset.
If the device has natural light support (currently only KA1), use the
sysfs interface instead of the ioctl-based one. It might also be
usable on other Kobo devices for setting brightness without natural
light, but since I cannot test this, this is currently restricted to
the KA1.
By default, the ioctl interface is used for accessing the
frontlight. However, the ioctl interface has two problems: the overall
brightness seems to be lower (issue #2321), and it does not support
the natural light support from the Kobo Aura One (issue #2285). This
interface is the first step to fix both these issues.
From observing Nickel's behavior, it appears the white/green/red
intensities are roughly linear dependent on the 4th root of brightness
and warmth values. This leads to a very quick increase of the
intensities for lower brightness/warmth values, which then saturate
for larger ones. The values for gain/offset were determined by a
simple linear regression, but the plan is to create a widget so that
users may adapt these values to their liking.
Partial, as it will safe the state when suspending the reader by pressing the power-button.
However, it will still not safe the state when Pocketbooks autoPowerOff-Feature kicks in, as this does not create an event (e.g. no EVT_BACKGROUND) of any kind.
* Clean up device.lua
* Save state on suspend
* Prevent open screensaver more than one in the same time
* Add option to enable/disable background in message screensaver
* fallback to random images if this book cover is excluded feature + fix Disabled (leave screen/page as it is)
* Autostretch disable by default, more fallback options, leave screen as it is
I believe this should be `if isKobo()`, or better yet that the entire
block should be moved to `KoboPowerD:init()` because afaik that is the
only platform where the system doesn't provide trustworthy frontlight
information. But to be absolutely sure that I don't break anything (and I
don't want to spend any time on this atm) I'm temporarily excluding only
Android where this behavior is known to be problematic.
See discussion in https://github.com/koreader/koreader/issues/3118#issuecomment-334995879
References #3118 (using keyword "references" because phrases like "possibly fixes"
result in GH autoclose).
* Allow for colored rendering
Available with all engines (CRE, PDF, Images).
Needs to manually add setting: "color_rendering" = true
* Disable color for djvudocument
* Use Screen:isColorEnabled()
* Bump base
* frontlight on kobo: a few fixes
Rewritten to not update NickelConf on every change, and never
if KOBO_SYNC_BRIGHTNESS_WITH_NICKEL = false.
Reintroduce global settings frontlight_intensity and
is_frontlight_on to keep level and state across koreader
sessions.
Fix a few of the remaining issues on kobo light.
Ensure settings are saved when rebooting/powering off from
File browser.
* Ensure untoggle works when starting with light off
* Put back fl_min=0 as it is for all other devices (the idea
fl_min should be 1 and toggling managed some other way is
not implemented in current code).
* Fix a few frontlightwidget issues
1. Android.getScreenBrightness() is used in frontend/device/android/powerd.lua to retrieve the frontlight intensity.
2. kosync.koplugin won't save settings for whisper sync.
3. batterstat.koplugin won't work correctly if several on* events are fired.
* Use PluginShare to exchange data between plugins
* Remove legacy code in reader.lua and kobo/device.lua, and move KOBO_LIGHT_ON_START to kobo/powerd.lua
* A better sync config logic
* Consider kobo without hardware frontlight toggle
* update frontlight widget once toggle is tapped.
* Force refresh when kindle is out of screensaver or usb is unpluged.
* Improve AutoFrontlight
* More plugins sub menu
* Last brightness should always be updated
* Finish autofrontlight improvement and enable it by default.
* More tets
* onFlushSettings
* MenuSorter can now correctly sort sub menus
Noticeable latency between toggling the power switch and the device
showing the screensaver has been tracked down to the two network
manager calls. This change allows the screen to be updated first.
Note that unloading the open source brcmfmac driver used on okreader
is slower than unloading the proprietary driver shipped by Kobo,
making this delay even more noticeable.
self.suspend() is scheduled after the network manager calls to avoid
race conditions.