Commit Graph

138 Commits (af8988ef5f7b885791db52ca9af0cbb307eb0d91)

Author SHA1 Message Date
NiLuJe af8988ef5f
Minor script tweaks (#8169)
* Neater fbdepth usage on sunxi
* Make sure we only ever match *loaded* modules when we check lsmod
3 years ago
NiLuJe 817e9e26e8
Minor input tweak after #7986 (#8004) 3 years ago
NiLuJe ae35e898fb
Kobo Elipsa support (#7986)
Includes a few minor cleanups along the way ;).
3 years ago
NiLuJe f2e90f505b
Input: Minor cleanups (#7542)
* TimeVal: Log the results of the COARSE probes in debug logs
* GestureDetector: Print details of failed clock probes in debug logs
* GestureDetector: Skip the BOOTTIME probe when CLOCK_BOOTTIME is unsupported.
* Input: Decode ABS_DISTANCE events in debug logs
* Get rid of duplicated <linux/input.h> constants, use the FFI module everywhere (re #7536)
* Kobo: Get rid of the `touch_alyssum_protocol` quirk. Replace it by setting `main_finger_slot` to `1`, like on the H2O.
3 years ago
NiLuJe 03e9fac156
Input: Process input events in batches (#7483)
Requires https://github.com/koreader/koreader-base/pull/1344 & https://github.com/koreader/koreader-base/pull/1346 (fix #7485)

Assorted input fixes:

* Actually handle errors in the "there's a callback timer" input polling loop.
* Don't break timerfd when the clock probe was inconclusive.

Not directly related, but noticed because of duplicate onInputEvent handlers:

* HookContainer: Fix deregistration to actually deregister properly. "Regression" extant since its inception in #2933 (!).
* Made sure the three plugins (basically the trio of AutoThingies ;p) that were using HookContainer actually unschedule their task on teardown.
3 years ago
NiLuJe 8a923e3e77
Input: Followup tweaks to #7415 (#7478)
* Actually load librt properly on old Linux systems (fix #7472)
* Made sure SDL & Android honored timeouts properly in some edgy (or not so edgy, in SDL's case) cases (c.f., https://github.com/koreader/koreader-base/pull/1343).
* Try harder not to consume a timer callback when the timerfd backend is in use and `select` timed out *not* because of a timerfd expiring. This would take some particularly heinous timing to reproduce (e.g., a timerfd set, but a task deadline expiring *before* it). May or may not help with #7473.
* Decode `BTN_` KEY codes in verbose debug logs.
* Fix MultiTouch on the H2O (GestureDetector was hard-coding the two slots as 0 & 1, but the H2O kernel is a special snowflake that doesn't use slot 0, instead switching to slot 1 & 2).
3 years ago
NiLuJe b325fa4a50
Initial KOA3 support (#7446)
* Move MXCFB capchecks to front

The fact that this was halfway in front/halfway in base was weird and
mistake-prone (c.f., the amount of times I forgot to update one bit or
the other).

* Initial KOA3 support

Assume it's essentially a KOA2. Meaning no warmth handling for now.

* Bump base

https://github.com/koreader/koreader-base/pull/1339
https://github.com/koreader/koreader-base/pull/1338
3 years ago
NiLuJe 861214ce2a
Kobo: Allow toggling the WAIT_FOR_UPDATE_COMPLETE hack (#7431)
* Allow toggling the MXCFB_WAIT_FOR_UPDATE_COMPLETE bypass

* Drive-by: enable the abort_on_crash menu on Pb & rM, since they support
it
3 years ago
NiLuJe 0b3747927c
WakeupMgr: Minor usage tweak (#7400)
* Unify logging with AutoSuspend (e.g., keep ourselves to showing the delay in seconds, not the raw timestamp, as that's way harder to interpret, and the RTC module and/or logger will do that for us when the time comes).
* Speaking of, minor revamp of RTC related logging to make it more human-readable.
* On Kobo, if we hit the unexpected wakeup limit, re-engage AutoSuspend's *suspend* check, so that the device has a chance to poweroff instead of being kept awake.
3 years ago
Glen Sawyer 3f0654f530
Hold "Wi-Fi" menu to show network selection instead of auto-connecting (#7395)
* Hold "Wi-Fi connection" to show network connection options.
* Honor backend connections (e.g., if wpa_supplicant found a matching AP in its own config first).
* When user clicks "Wi-Fi connection" in menu, only prompt if state is ambiguous.
3 years ago
NiLuJe bf6c0cdd6c
LuaSettings: Add a method to initialize a setting properly (#7371)
* LuaSettings/DocSettings: Updated readSetting API to allow proper initialization to default.
Use it to initialize tables, e.g., fixing corner-cases in readerFooter that could prevent settings from being saved.
(Fixes an issue reported on Gitter).
* LuaSettings/DocSettings: Add simpler API than the the flip* ones to toggle boolean settings.
* Update LuaSettings/DocSettigns usage throughout the codebase to use the dedicated boolean methods wher appropriate, and clean up some of the more mind-bending uses.
* FileChooser: Implement an extended default exclusion list (fix #2360)
* ScreenSaver: Refactor to avoid the pile of kludges this was threatening to become. Code should be easier to follow and use, and fallbacks now behave as expected (fix #4418).
3 years ago
NiLuJe dffe86dfe9
Cleanup eye-gouging madness around io.read calls (#7149)
* Don't reinvent the wheel when reading a one-line int or string from sysfs

* Simplify a whole other bunch of read calls
3 years ago
NiLuJe 931f01ef26
Kobo: Warn on restart if the startup script is outdated (#6916)
* Warn on restart if the startup script has been updated, because a restart will not reload it.

* Also warn right after the update if it contained a startup script update...
3 years ago
NiLuJe c810a19040
H2O: Fix initial tap detection (#6832)
* Fix initial tap on the H2O

There's no slot 0, so make sure the initialState doesn't get confused by input's init data that otherwise assumes the main slot is 0
4 years ago
NiLuJe dda905271d
[Kobo, Mk. 7] Enable the power LED when charging (#6810) 4 years ago
poire-z 633d43b322 Devices: get rid of touch_probe_ev_epoch_time
On devices where the event time is the uptime (time since
boot), we don't need to trash it and use TimeVal:now()
and lose precision. We can still use these times for
relative delays and durations computations, which is
mostly all we use them for.
We just need a real clock time in GestureDetector for
two timers (long-press and double tap), where we do
the event time type detection on the first event, on
all devices.
4 years ago
NiLuJe e169b34577
Fancier Wi-Fi status icons in ReaderFooter (#6725)
* In icons mode, just use two different icons to display Wi-Fi status

* Enable Wi-Fi status icon on Kobo & Cervantes, too

* Refresh footer on (dis)connect if the Wi-Fi status item is enabled
4 years ago
ezdiy ef8d2d0d6e
linuxfb: is_always_portrait must be passed to screen init() from all frontends. (#6712)
This is because fb driver should not be inspecting self.device for low level
caps anymore.

Fixes #6711
4 years ago
ezdiy 5345728cc4
Clean up C blitbuffer kludges. (#6696)
CBB now handles nightmode correctly (by deferring to Lua), so we no longer
need to do monkey dances about disabling it when hw invert is missing.

canUseCBB cap is resolved by generic device re-configuring blitbuffer
on the go, so as to avoid repeating the same thing in every device driver.

The dev setting can now flip cbb on the go, so one can gloat at the near
meaningless perf difference - 2Mp draw is 15ms Lua / 10ms C on 1GHz Cortex A7.
4 years ago
NiLuJe 6e3a3e8069
[Kobo] Support USBMS exports (#6552)
* \o/

* Make sure the (debug) event log doesn't end up in the fd table of our child processes...
Otherwise, it breaks USBMS.

* Close suspicious fds in the Wi-Fi scripts
To prevent any and all issues w/ USBMS down the road...

* Minor USBMS UI tweaks

* Always ask for confirmation to start on USBMS session on plug

* Bump base

https://github.com/koreader/koreader-base/pull/1161
https://github.com/koreader/koreader-base/pull/1162
https://github.com/koreader/koreader-base/pull/1163
https://github.com/koreader/koreader-base/pull/1165
https://github.com/koreader/koreader-base/pull/1167
4 years ago
NiLuJe 2ad976387d
More #6424 cleanups (#6442)
* Simplify logic, and more detailed debug logging
* Kill Nickel's FIFO on startup
Avoids udev/udhcpc scripts hanging when trying to open() it.
4 years ago
NiLuJe 37a01100b7
Various Wi-Fi QoL improvements (#6424)
* Revamped most actions that require an internet connection to a new/fixed backend that allows forwarding the initial action and running it automatically once connected. (i.e., it'll allow you to set "Action when Wi-Fi is off" to "turn_on", and whatch stuff connect and do what you wanted automatically without having to re-click anywhere instead of showing you a Wi-Fi prompt and then not doing anything without any other feedback).
* Speaking of, fixed the "turn_on" beforeWifi action to, well, actually work. It's no longer marked as experimental.
* Consistently use "Wi-Fi" everywhere.
* On Kobo/Cervantes/Sony, implemented a "Kill Wi-Fi connection when inactive" system that will automatically disconnect from Wi-Fi after sustained *network* inactivity (i.e., you can keep reading, it'll eventually turn off on its own). This should be smart and flexible enough not to murder Wi-Fi while you need it, while still not keeping it uselessly on and murdering your battery.
(i.e., enable that + turn Wi-Fi on when off and enjoy never having to bother about Wi-Fi ever again).
* Made sending `NetworkConnected` / `NetworkDisconnected` events consistent (they were only being sent... sometimes, which made relying on 'em somewhat problematic).
* restoreWifiAsync is now only run when really needed (i.e., we no longer stomp on an existing working connection just for the hell of it).
* We no longer attempt to kill a bogus non-existent Wi-Fi connection when going to suspend, we only do it when it's actually needed.
* Every method of enabling Wi-Fi will now properly tear down Wi-Fi on failure, instead of leaving it in an undefined state.
* Fixed an issue in the fancy crash screen on Kobo/reMarkable that could sometime lead to the log excerpt being missing.
* Worked-around a number of sneaky issues related to low-level Wi-Fi/DHCP/DNS handling on Kobo (see the lengthy comments [below](https://github.com/koreader/koreader/pull/6424#issuecomment-663881059) for details). Fix #6421 
Incidentally, this should also fix the inconsistencies experienced re: Wi-Fi behavior in Nickel when toggling between KOReader and Nickel (use NM/KFMon, and run a current FW for best results).
* For developers, this involves various cleanups around NetworkMgr and NetworkListener. Documentation is in-line, above the concerned functions.
4 years ago
NiLuJe a8da762955
Initial handling of the upcoming Kobo Nia (#6380)
Obviously untested ;p
4 years ago
NiLuJe 509ee7bb86
Allow locking the gyro to the current screen mode (#6347)
* Allow locking the gyro to the current screen mode (i.e., orientation).
* Tweak the "sticky rota" option to work both ways
* More rotation constant usage instead of magic numbers
4 years ago
Martín Fernández 2e731dd4dd
[chore] Device abstraction (#6280)
* generic Device:info() function which returns the model

* add Device:canSuspend() and make it true in all devices that have suspend routines and the emulator

* also enable fake poweroff/reboot on the emulator

* add Device.home_dir

* add Device:hasExitOptions() and update menus & comments
4 years ago
NiLuJe 95567d8af8
Disable the RTC alarm on shutdown (#6211)
* Disable the RTC alarm on shutdown

* Nice typo.

* Bump base

https://github.com/koreader/koreader-base/pull/1103
https://github.com/koreader/koreader-base/pull/1105
https://github.com/koreader/koreader-base/pull/1106
4 years ago
NiLuJe 4a5a2eb708
Unbreak nightmode on Cervantes (#5966)
* Unbreak nightmode on Cervantes

Regression after https://github.com/koreader/koreader-base/pull/1047 (I
thought it was already implemented).

Fix #5963

* make luacheck happy
4 years ago
NiLuJe f96cfe940b
Use the proper LED driver on the Libra (#5416)
So that we can actually set the warmth ;)
5 years ago
NiLuJe bcceb94603
Hotfix the startup orientation on the Kobo Libra (#5409) 5 years ago
Frans de Jonge 3836184f9d [Kobo] Always write scheduled wakeup info to log 5 years ago
NiLuJe 4363576066 Support the Kobo Libra
(Hopefully?).
5 years ago
Frans de Jonge e257c4e45e
[feat, Kobo] Autoshutdown (#5335)
The methods used here will likely work on most embedded devices, which is why I put them in their own WakeupMgr interface/scheduler module, separate from Kobo.

See https://www.mobileread.com/forums/showthread.php?p=3886403#post3886403 for more context.

Fixes #3806.
5 years ago
Frans de Jonge a2dcfe9aec
[doc] Tag @todo, @fixme and @warning (#5244)
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
5 years ago
Robert 939538cc25 [UX] Add gesture - poweroff and restart device (#5202)
Also abstract canRestart, canReboot and CanPowerOff.
5 years ago
NiLuJe 10511220e5 Simplify isWifiOn on Kobo (#5211)
Don't fork for lsmod + grep, we can perfectly well parse /proc/modules
ourselves ;).

c.f., https://github.com/koreader/koreader/pull/5203#issuecomment-521277628
5 years ago
jetomit 20493eebc3 [fix, Kobo] Add missing parentheses (#5198)
Prevents a crash when the WIFI_MODULE environment variable is not
defined.
5 years ago
NiLuJe 38e7975728
More robust Gyro toggle (#5104)
* 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).
5 years ago
NiLuJe efe34b6fee Fix shutdown action on Kobo (#5055)
Bypass init, like Nickel does.
Otherwise, some devices either deadlock or panic.
5 years ago
NiLuJe de1146c0b5 [Kobo] Tweak the Aura viewport (#5034)
Officially, the bezel should only cover the bottom 10 pixels ;).
(The Aura was officially advertised as having a 758x1014 screen).
5 years ago
NiLuJe aec7594af5
Blacklist the C BB on devices where it cannot be used (#4989)
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 ;).)
5 years ago
NiLuJe f63ca005c6 [fix] Update AutoWarmth state on resume (#4901)
Regression since #4871
Fix #4895

* Hide the "Configure" button in the FL/NL widget on devices where it
won't do anything

(i.e., those w/ a NL mixer).
5 years ago
NiLuJe 4005bf69aa
Slightly less crappy Nightmode (#4871)
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.
5 years ago
NiLuJe 04f5bc7823 Remove the Aura SE viewport
This feels somewhat arbitrary and potentially unneeded,
and it'll prevent full blits, so, off it goes.
5 years ago
NiLuJe 9ecc2dd119 There's no viewport on the H2O²
Fix #4834
5 years ago
Frans de Jonge 728bb187fa
[UX] Gesture manager: add two-finger swipe left and right (#4815)
Also add Device:hasMultitouch() to control whether the configuration menu is shown.

Cf. #4727.
5 years ago
NiLuJe fdf92e13ea
Remove the Kobo-specific 16bpp JIT loopunroll tweak (#4784)
* Remove the Kobo-specific 16bpp JIT loopunroll tweak
It's now generic, and handled in ffi/blitbuffer.lua directly.
5 years ago
NiLuJe 7c2df53808
Update FBInk (#4765)
* Add a bit of logging before fbdepth calls, to make the progression
easier to grasp.
* Bump base (pickup FBInk update)
5 years ago
NiLuJe bb3f49a566 [feat, Kobo] On Kobo, drop fb to 8bpp on startup (#4637)
* 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
5 years ago
Martín Fernández 04e17424d0 display network settings based on device capabilities + fix android basic network info 5 years ago
NiLuJe abc6d17a25
A few minor fixes after #4541 (#4561)
* Enforce dithering in PicDocument
* Ensure we'll get a flashing update on ScreenSaver exit
5 years ago