New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Input/Device: Refactor Gyro events handling #9935
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(approval relates to the principle, no opinion as to whether the Kindle stuff was correctly transplanted :-P)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 7 of 12 files at r1, 16 of 16 files at r2, 2 of 2 files at r3, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @pazos, @poire-z, and @rjd22)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. After this is merged I will make and new PR for the PocketBook gyro detection. For enabling and disabling the gyro I will let users do that in the config menu of PocketBook itself. That will require less supporting code from our side.
If all goes well, the standard "ignore the events" approach implemented here should Just Work (TM) anyway ;). |
We're unlikely to confuse them with KEY_ evdev constants, and those are in the FFI C namespace anyway.
Get rid of the gyro toggle flag, use pointer comparisons to infer the state instead
It's meaningless, the translation is now mandatory.
Comment it instead it's just here for documentation anyway
anything platform-specific in there once I'm done
There are only a couple platforms where this will matter anyway ;).
It's only used by the debug codepath, which sits *before* translation
It's now mandatory if hasGSensor Move toggleGSensor to Generic, as it now *is* platform-agnostic ;).
(Still needs the hasGSensor cap, though. Left for koreader#9873 to deal with ;)).
But am going to write compat wrappers instead of doing this ;p
not the class object
Make sure it always exist (again), and instead move disabling it to an actual method, instead of having to fiddle with internal instance objects directly. Will break some user patches \o/.
We'll see them on PB, because event mangling happens before waitEvent (the whole thing is synthetic, instead of mutating a real live evdev feed via event hooks).
own framebuffer ones
them. "rotated" doesn't mean anything (in fact, "portrait rotated" sounds like landscape to me :s), and doesn't actually tell you *which way* it's been rotated. The fact that UR happens to be Portrait on almost every platform we care about is a quirk of fate, that wouldn't be true on a TV, so, get rid of that assumption, at least from the names ;o). (the code... still does ^^). TL;DR: As usual, LinuxFB had it right, so, follow its inspiration, but be more wordy to make it clear we're talking about how the *device* is physically rotated in the real world.
Let's hope for the best, I guess? :D.
e667742
to
a28413d
Compare
Handle a single, custom protocol in Input, and move the platform-specific translation to Device implementations.
This allows us to get rid of a whole bunch of nastiness from Input, as the Kindle handling in particular was... not pretty ;).
Also, tweak how input events hooks can be built to allow for a single composite hook on Kobo, instead of repeating and nesting calls.
Only tested on Kobo so far (I don't have any other gyro-enabled device anyway ;p).
Depends on koreader/koreader-base#1568 (re: #9873)
canToggleGSensor
Device cap, it's now mandatory forhasGSensor
devices. (This means Kindles can now toggle the gyro, fix "Lock auto rotation to current orientation" is unchecked, grayed out #9136).Device:toggleGSensor
is now implemented byGeneric
.rotation_map
user-patches).EV_MSC:MSC_GYRO
).rotation_map
disable method implemented in 43b021d. Instead of directly poking at the internal field, use a new method,disableRotationMap
(/!\ Again, this might break somerotation_map
user-patches).This change is