2
0
mirror of https://github.com/koreader/koreader synced 2024-11-10 01:10:34 +00:00
Commit Graph

946 Commits

Author SHA1 Message Date
NiLuJe
ca71bb2917
Input: Ignore ABS_X, ABS_Y & ABS_PRESSURE for snow_protocol (#12427)
On Monza, the lift frame can report these for *multiple contacts* without an id or a slot, which is super-duper invalid -_-".

(And we have ABS_MT_POSITION_X & ABS_MT_POSITION_Y for the "saner" frames, plus these devices generally don't support pens, so we don't make use of pressure).

(Also, switched to a dedicated handler like for the phoenix quirks, to avoid bogging down the standard handler with hacks for broken drivers).

Fix #11910
2024-08-30 16:04:28 +02:00
David
4910afffdd
Add numerical key_codes to event_map on kindle 3 (#12358) 2024-08-24 14:17:40 +02:00
NiLuJe
4264d915b1
Kobo: Refactor suspend in order to be able to catch input events sent during the 2s window of ntx madness (#12330)
I don't even remember how badly things broke (at least on old devices) without it, despite it making absolutely no sense at all (state-extended just flips a global that dictates whether some things get flagged as wakeup sources or not).

So, don't rock the boat too much: we don't remove it, but instead of using a sleep, we use a task deadline instead, which ensures we'll keep processing input events in the right order in the meantime. We'll already have neutered input by this point, so we'll only process power events anyway.

That means that the only iffy things are potentially *when* and *where* we have to potentially cancel that task. Resume makes sense, of course, and we log an info message to make the log flow clear; but we also do so in suspend... just in case. With a warning log because that probably indicates something fishy went on.

Also cleanup the comments while I'm there, and actually rewrite the wakeup_count stuff properly so it could actually theoretically be used if ntx kernels were actually reliable. Spoiler alert: they're not, this is still horribly broken on at least Mk < 7. Works just fine on a Forma, though, so, yay.

Fix #12325
2024-08-12 03:47:43 +02:00
David
466971c0e2
ReaderFooter: add page-turn item (#12249) 2024-08-10 10:09:23 +02:00
NiLuJe
7e8cdbcf65
PowerD: Keep track of frontlight state change by interactive callers for suspend/resume purposes (#12283)
While #12256 papered over the tracking of a *single* suspend -> (resume->suspend) series of events, things still go out of sync if you tack on *more* suspend/resume events after that.

The upside is that our *actual* tracking of suspend/resume is solid, so at least we're actually doing the right thing as far as PM is concerned.

The downside is that on Kobo, the frontlight handling code is full of delays, and the ramping down/up itself also takes some time, so things can quickly overrun into the wrong event.

This means a couple of things:

* We need to cancel any scheduled frontlight toggles and ramps on Kobo, to ensure that only the one from the *last* event received goes through, in an attempt to limit the amount of potential crossover.
* Tracking fl_was_on *cannot* reliably be done from the suspend/resume handlers (especially on Kobo), as the ramps themselves may cross over the event barriers (and we potentially cancel the task anyway), so this was moved to the very few interactive callers that will actually change the frontlight state.
* On Kobo, crossover is still *somewhat* possible because the ramps take time. It's mostly harmless for the ramp down, we just need to tweak the ramp down to start from the actual intensity to avoid a weird jump on the initial step if there's an inconsistency. For the ramp up, we potentially need to manually kill the light first, because off -> on assumes it *really* starts from off ;).

Followup to #12256
Fix #12246 (again)
2024-08-06 01:13:14 +02:00
NiLuJe
9b9898d466
Kobo: Track frontlight state more accurately on suspend/resume (#12256)
Hopefully in the least intrusive way possible, because frontlight handling code is hell.

`self.fl_was_on` could go out of sync with the expected state when resume->suspend events happened in very quick succession, leading to it being set to false, preventing the frontlight from being turned back on on the next resume.

Fix #12246
2024-08-01 23:06:31 +02:00
NiLuJe
d59c837714
Kobo: Refactor various aspects of the Kaleido/MTK support (#12221)
* UIManager: Let the fb backend deal with Kaleido wfm promotion. This fixes a number of quirks that poisoned the refresh queue with spurious full-screen refreshes. See https://github.com/koreader/koreader-base/pull/1865 for more details.
* This also means we now disable Kaleido waveform modes when color rendering is disabled (remember to trash your thumbnail cache if you don't want to mix color w/ grayscale thumbnails, though).
* UIManager: Merge refreshes that share an edge, because that was driving me nuts (and would have most likely been merged by the kernel anyway). A perfect test-case is the FM, which trips two separate refreshes because of its title bar.
* ReaderFlipping: Use sensible dimensions, so that we only refresh the icon's region.
* ReaderBookmark: Only refresh the dogear instead of the whole page when toggling bookmarks.
* NetworkSetting: Make it a real boy, so it consistently refreshes properly on dismiss instead of relying on UIManager saving the day.
* Kobo: Aggressively prevent *both* suspend & standby while MTK devices are plugged-in, as both will horribly implode the kernel (we previously only prevent standby while charging).
* Kobo: Switch to 8bpp on B&W MTK devices (or when color rendering is disabled on Kaleido panels).
2024-07-28 01:19:40 +02:00
NiLuJe
761cf18222
SDL: Return true in NetworkMgr:isConnected on !hasWifiToggle platforms, (#12217)
so as not to break the beforeWifiction shenanigans...

Which is most of them, only the Emulator subclass sets it, for...
reasons.

(That Emulator quirk is also why we can't simply scrap the whole thing
to use NetworkMgr's default imps).

Fix #12203 (thanks to @benoit-pierre for spotting that one).

This was clearly an oversight on my part when working on #10669
2024-07-26 02:12:53 +02:00
Martín Fernández
617618d587
Add Device:otaModel() (#12014)
Devices with a single target might want to specify it in `Device.ota_model`
Devices with multiple targets want to override the function or to specify `ota_model` variants for each target.
2024-06-25 21:35:38 +02:00
Marek Veselý
4c4cfa2db0
Kindle: add wifi selector (#12056)
* Kindle: Implement a NetworkMgr backend loosely based on WpaClient in order to allow feature-parity with hasWifiManager platforms. This involves dealing with the native wifid over lipc (the native IPC system, based on DBus), through custom Lua bindings (https://github.com/notmarek/openlipclua), since the stock ones lack support for the needed hasharray data type.
* NetworkMgr: Clear up leftover hallucinations from #10669, making `enableWifi` much simpler (and much more similar to `turnOnWifiAndWaitForConnection`).
* NetworkMgr: Made it clearer that `turnOnWifi` implementations *must* deal with `complete_callback`, as part of the aforementioned changes mean that it's *always* wrapped in a connectivity check, and we need that for proper event signaling.
* Android, Emu: Run `complete_callback` properly in `turnOnWifi`.
* Kindle: Support `powerd:isCharged()` on the PW2 (yes, this is random, it just happened to be my test device :D).
* NetworkMgr:disableWifi: Properly tear down any potential ongoing connection attempt (e.g., connectivity check).
* NetworkMgr:promptWifi: Make the "wifi enabled but not connected" popup clearer if there's an ongoing connection attempt, and gray out the "Connect" button in this case (as it would only lead to another "connection already in progress" popup anyway).
* NetworkMgr:reconnectOrShowNetworkMenu: Make *total* scanning failures fatal (they will lead to an immediate wifi teardown).
* NetworkMgr:reconnectOrShowNetworkMenu: Clear up the long-press behavior (which *always* shows the network list popup) so that it doesn't weirdly break all the things (technical term!).
* NetworkMgr:reconnectOrShowNetworkMenu: When we manage to connect to a preferred network on our own *before* showing the network list, make sure it is flagged as "connected" in said list.
* NetworkMgr:reconnectOrShowNetworkMenu: Make connection failures fatal in non-interactive workflows (they'll lead to a wifi teardown).
* NetworkSetting (the aforementioned network list widget): Clear NetworkMgr's "connection pending" flag on dismiss when nothing else will (i.e., when there's no connectivity check ticking).
2024-06-25 21:17:36 +02:00
David
f330593233
Fixing button invert on start (#11982)
fixing issue described here https://github.com/koreader/koreader/pull/11963#issuecomment-2147876605
2024-06-05 16:05:36 +02:00
David
7a84cfef4a
Individually invert left or right side page turn buttons on Kindle (#11963)
K4 is ergonomically designed to be held with one hand (one's hand wrapped around the back and both thumb and middle finger on either PgFwd buttons).

This PR allows users to individually invert left and right page turners such that it can be operated just with one hand. It also closes #9350

Not sure if there are any other devices with two sets of page turn buttons, so currently limited to kindle, excluding kindle Voyage, but could be added too, albeit with some gymnastics.
2024-06-05 08:51:45 +02:00
NiLuJe
6a4d433aa9
Kobo: check for RGBA vs BGRA the proper way (#11953)
i.e., poke at the fb vinfo data to check the component offsets.

Fix #11952
2024-06-01 20:39:17 +02:00
Frans de Jonge
8f2bd5420d
Introduce Device:useDPadAsActionKeys() (#11900)
1. Non-Kindle-specific `hasFiveWay` behavior is changed to `hasDPad and useDPadAsActionKeys`. For now they remain Kindle-specific in practice, unless one sets `useDPadAsActionKeys = yes` in a user patch.
2. With that disambiguation out of the way, `hasFiveWay` itself is further disambiguated into `hasScreenKB` and `hasSymKey`, as per the actual property being used, rather than something that tends to correlate with it. (It needn't be Kindle-specific per se, but non-Kindle devices have equivalent shortcuts with for example `Shift`.)
  Running the emulator with `DISABLE_TOUCH=1` will set `hasSymKey = yes`, which can be tested with right shift.

Closes #11887.
2024-05-26 21:25:54 +02:00
NiLuJe
f0f37e3153
Kobo: Boost saturation for CFA refreshes (and add a dev setting to disable it) (#11883)
Being able to disable it can be interesting, because it *is* a somewhat destructive process.

* Requires a base bump:
https://github.com/koreader/koreader-base/pull/1793
https://github.com/koreader/koreader-base/pull/1794
2024-05-25 01:29:15 +02:00
SomeGuy
6c7e2a9c62
Support screenshots on Non-Touch with ScreenKB as modifier (#11802)
on devices (mostly kindles) with keyboards: Alt + Shift + G
on kindle 4: ScreenKB + Menu
2024-05-20 21:22:27 +02:00
SomeGuy
577c5d454f
Non-touch DPad improvements (#11749)
Closes #11295.
2024-05-20 21:20:50 +02:00
NiLuJe
4d9c6523ad
Input: Some more followups to the input device auto-detection stuff (#11855)
Switch to a new `input.fdopen` API & wrapper so we can keep the fds opened by `fbink_input_scan` instead of closing them to re-open them right after that...

This should hopefully help on racy zForce devices that attempt to handle power management when opening/closing the device. We know this sometimes horribly fail to re-activate the IR grid (c.f., our manual activation on resume), but this apparently could also happen here (re: #11844) because of the quick succession of open->close->open.
2024-05-19 22:53:14 +02:00
Tomáš Janoušek
e94550a261
PocketBook: Open links in the on-device web browser (#11787)
Many PocketBook devices include a web browser, but when clicking a link in KOReader, there was no option to open the link in the browser, there was only an option to show a QR code (which can then be scanned by a smartphone).

This commit implements `canOpenLink`/`openLink` on PocketBook using the "browser.app", if available.

Tested on PB740 (InkPad 3).

Fixes: https://github.com/koreader/koreader/issues/11782
Related: https://github.com/koreader/koreader/issues/6597
2024-05-18 16:57:03 +02:00
Martín Fernández
7bded465eb
SDL: add flatpak flavor (#11833)
* ship metadata with generic linux binaries
* append release version & data at build time
2024-05-18 13:21:59 +02:00
NiLuJe
05168b22f5
Kindle: Don't forget about fiveways on legacy devices & fix a couple input-scan misdetections (#11827)
* Kindle: Don't forget to open INPU_DPAD devices for the fiveways. Somehow managed to skip my mind, they're often on a separate input device.

Regression since #11807

* Update FBInk to fix a few cases of input_scan misdetection (on misconfigured drivers (e.g., no DIRECT prop on supported kernels), or old kernels with no EVIOCGPROP support).

Fix #11824
2024-05-15 23:58:01 +02:00
NiLuJe
fd5260f2ce
Support auto-detection of input devices via fbink_input (#11807)
* Kobo: Drop a bunch of if ladder crap and switch to auto-detection of input devices via fbink_input
* Kindle: Drop an even larger bundle of crap to do the same ;p. (re: #11392)
* ExternalKeyboard: Switch to fbink_input to whitelist keyboards instead of the manual parsing of caps via its FindKeyboard class
* Input: Extended open/close wrappers to handle logging & tracking of dupe open/close calls.
2024-05-15 05:42:48 +02:00
mergen3107
8a316f928a
Kindle: remove separate L and R orientations (#11780)
Fixes #11743
2024-05-14 10:31:14 +02:00
Joshua Bullock
1398154546
Gesture: Add toggle for orientation lock (#11795) 2024-05-11 11:47:33 +02:00
Predrag Đokić
eb6e5e3c20
Kindle: Fix missing Amazon UI screensaver after exiting KOreader (#11794) 2024-05-10 22:18:41 +02:00
peicuiping
a7e34673e6
chore: remove repetitive words (#11785) 2024-05-09 12:10:53 +02:00
Valentin Dubois
526a1fb727
Initial support for new Kobo (Clara B/W + Colour, Libra Colour) (#11737)
* Support the Clara B&W, Clara Colour & Libra Colour
* Enable HW dithering on *all* the Kobo MTK devices
* Enforce 32bpp instead of 8bpp for Kobo devices with a color panel (the driver doesn't actually support 8bpp anyway)
* Enable standby support on MTK (whenever possible, i.e., not when plugged in, as that is horribly, horribly broken).
* Enforce the dedicated "color" waveform mode for image content in ScreenSaver, ImageViewer & Reader.
* Fix charging LED support on MTK
* Tweak the frontlight ramp on MTK + LM3630 so that it actually ramps smoothly
2024-05-09 03:27:37 +02:00
Benoit Pierre
e8544316a8
pocketbook: simplify device model detection (#11721)
To avoid avoid having to manually handle the multiple
ways a model name reported by inkview can be formatted.
2024-04-29 20:57:16 +02:00
mergen3107
caea0e8fb2
Kindle Scribe: improve gyro detection, replace accel with acc keyword (#11696)
Fixes #11691.
2024-04-20 22:30:04 +02:00
ElimGarak1
bfc84795c8
Add PocketBook Era Color (PB700K3) (#11695)
Fixes #11684.
2024-04-19 10:15:29 +02:00
mergen3107
d3011571a3
Kindle Scribe: find accelerometer based on hardware (#11642)
Closes #11392 (temporarily).
2024-04-18 09:33:11 +02:00
Tomas Janousek
1fbdc1f19d NetworkMgr: Limit the hasDefaultRoute check in isOnline to PocketBooks
It's not necessary on other platforms. To be more precise, it would be
necessary on Kobo as well, but there's a different workaround in place:
https://github.com/koreader/koreader/pull/6424/files#diff-be863601c59a2d6607af6b04b3be2392ec4494df6d25dae48250fae57b737f61R216-R224
2024-04-07 21:58:12 +02:00
Denis Malinovsky
501cba6ebe
PocketBook: remove unused color_saturation parameter (#11597)
Bumps base for https://github.com/koreader/koreader-base/pull/1751

Includes several build system improvements as well
2024-03-29 09:36:53 +01:00
NiLuJe
dd8560cef8
Input: Don't let wacom pens clobber the slot of the next contact (#11520)
If there's only one contact, we won't get an ABS_MT_SLOT, so we need to
make sure we fall back to the main finger slot once we've caught a tool
switch.

Also, move the dedicated pen slot further away, so it has zero chance of
being detected as a potential buddy contact to a finger contact.

Fix #11514
2024-03-06 08:26:48 +01:00
Hzj_jie
d4c78aaa4f
Kindle oasis has no ambient brightness sensor (#11456)
I did not notice an ambient brightness sensor, nor adaptive brightness feature. (Ref: https://www.geekwire.com/2016/kindle-oasis-review-amazons-premium-e-reader-use-premium-features/)

Was it previously wrongly configured?
2024-02-17 14:09:48 -08:00
zwim
f836f6a237
Clear UI leftovers before doing an OTA-install, add unmovable to InfoMessage and ConfirmBox (#11412) 2024-01-29 22:37:32 +01:00
NiLuJe
4785df48a9 PRSTux: Disable OTAs
We haven't been offering any for years, and I've just killed zsync
support there anyway.
2024-01-21 06:42:09 +01:00
NiLuJe
72250daba8 UI: Add a verbose debug logging checkbox next to "Report a bug"
@hius07 mentioned something to that effect a while back, makes sense.

Unlike the set of checkmarks in the dev settings, this one flips both
debug + verbose at once, *and* asks for a restart for framebuffer's
sake.

Also update the "Report a bug" spiel to request verbose debug logs.
2024-01-19 00:08:10 +01:00
NiLuJe
c529c1cce3 Kindle: Log the args from WakeupFromSuspend & ReadyToSuspend 2024-01-15 04:29:09 +01:00
NiLuJe
588bf38c84 Kindle: Log the suspend/wakeup source
We currently don't do anything with it, but this might help someone come
up with fancier smartcover handling, like we do on Kobo...

Simplify the fake events w/args checks:
We can just hitcheck the table directly, no need for another hash

Also catch ExitedSS on Kindle.
And, again, dn't do anything with it ;p.
2024-01-15 04:29:09 +01:00
NiLuJe
dcfcc81dcf Android: Don't forget to call Generic.exit on Device:exit ;).
Fix #11345
2024-01-13 02:03:10 +01:00
NiLuJe
c97d20cd24
Chore: Make sure we always pass a rect to fb:refreshFull (#11307)
* UIManager: Init a full Geom on region-less refreshes in _refresh
* Never call refreshFull with no arguments
  I got rid of the low-level nil guards, because UIManager itself guarantees that it can never happen
* Bump base (https://github.com/koreader/koreader-base/pull/1718) (fix #11303)
* Kindle: Re-enable HW dithering on the Scribe
  Now that the underlying issue is fixed in base ;).
2024-01-12 21:23:23 +01:00
NiLuJe
18c17829b7
Input: Simplify input slot storage alloc (#11296)
* Input: Harden setCurrentMtSlotChecked
  The current implementation was assuming that the only case where we
  might be missing slot storage was for the *first* contact point,
  given that ABS_MT_SLOT is (if all goes well) guaranteed to be present
  and come first for every subsequent additional contact points.
  While this works just fine in practice, we can simplify and generalize
  the check by just checking if we've actually recorded the requested
  slot, even if it's not the first contact point.
  The hit check is possibly ever so slightly faster than the length
  computation, to boot.
* Input: Handle snow_protocol devices with newer hardware revisions that do *NOT* need the snow quirks.
  If a sane input frame is detected, the snow quirks will be disabled at runtime, ensuring sane behavior.
  Given the extremely non-standard behavior of the snow quirks, this is fairly easy to detect,
  as a snow device will *never* emit EV_ABS:ABS_MT_TRACKING_ID:-1, so if we catch one, it's not snow ;).
  (We've had reports of this on a Clara HD, FWIW)
2024-01-12 20:40:49 +01:00
zwim
2c33fc6576
Reader: Do less work on same-orientation non-gyro rotations (#11297)
Namely, don't recompute layouts, as they do not change.
(The gyro codepaths were already doing something similar.)

* Keep ConfigDialog, FileManagerMenu & ReaderMenu open on rotation.
  (In practice, only ConfigDialog is affected, as *Menu doesn't handle the rotation event.)
* Plugged an instance leak in the aforementioned Menu classes.
* Unify behavior & code with the gyro codepaths.
2024-01-12 19:13:44 +01:00
mergen3107
4a9473ed45
Kindle Oasis 1,2,3, Scribe: fix startup orientation (#11277)
Closes #11269
2024-01-11 13:22:17 +01:00
NiLuJe
4a15dce3e4 Kindle: Disable HW dithering on Scribe
Pending the actual fix from
https://github.com/koreader/koreader-base/pull/1718 that'll hit after
the release.
2024-01-09 17:24:16 +01:00
Mihai Vasiliu
5d2a441064
Add viewport for PB743K3 (#11302)
The bezel covers a couple of pixels of the screen, so adjust not to show content under the bezel.
2023-12-29 17:41:53 +01:00
mergen3107
63329569eb
[android] toggle warmth on onyx devices (#11275) 2023-12-28 12:09:42 +01:00
mergen3107
6c85547ce6
Add HW dither on Kindle Scribe (#11292) 2023-12-28 11:24:15 +01:00
mergen3107
4c2fc1eb81
Kindle Scribe: fix touch input (#11285) 2023-12-27 23:06:18 +01:00