Skip to content

[Kobo] Enable wake on page turn buttons#13669

Merged
Frenzie merged 9 commits into
koreader:masterfrom
kodermike:issue-13668-pageturn-power
Aug 3, 2025
Merged

[Kobo] Enable wake on page turn buttons#13669
Frenzie merged 9 commits into
koreader:masterfrom
kodermike:issue-13668-pageturn-power

Conversation

@kodermike

@kodermike kodermike commented Apr 24, 2025

Copy link
Copy Markdown
Contributor

Adds menu items (toggles) and functionality to turn a kobo back on with the page turn buttons.

Fix #13668


This change is Reviewable

@kodermike

kodermike commented Apr 24, 2025

Copy link
Copy Markdown
Contributor Author

fixes #13669

Comment thread frontend/ui/elements/common_settings_menu_table.lua Outdated
Comment thread frontend/ui/elements/common_settings_menu_table.lua Outdated
@NiLuJe

NiLuJe commented Apr 25, 2025

Copy link
Copy Markdown
Member

Incidentally just caught that in a Nickel changelog when updating a device today.

I'm not entirely sure if the page turn keys are actual wakeup sources on older devices with keys, but I would assume so, so, eeeh, why not.

@NiLuJe NiLuJe added this to the 2025.05 milestone Apr 25, 2025
Co-authored-by: NiLuJe <ninuje@gmail.com>
@kodermike

kodermike commented Apr 25, 2025

Copy link
Copy Markdown
Contributor Author

Incidentally just caught that in a Nickel changelog when updating a device today.

I'm not entirely sure if the page turn keys are actual wakeup sources on older devices with keys, but I would assume so, so, eeeh, why not.

I can verify tonight on a forma (tested this initially on a KLC to see it work, and a Clara2E to see it not break :) ) Assuming a Forma counts as an older device these days

@kodermike

Copy link
Copy Markdown
Contributor Author

Verified works on the forma, fwiw.

@kodermike

Copy link
Copy Markdown
Contributor Author

Verified works on the forma, fwiw.

I'm mistaken. Looking into why t doesn't work.

Comment thread frontend/device/input.lua
@Commodore64user

Copy link
Copy Markdown
Member

fixes #13668

This needs to go in the original post #13669 (comment)

@NiLuJe

NiLuJe commented Apr 25, 2025

Copy link
Copy Markdown
Member

Verified works on the forma, fwiw.

I'm mistaken. Looking into why t doesn't work.

I assume simply because the page turn buttons are not a wakeup source, so the kernel doesn't even wake the device up.

@kodermike

Copy link
Copy Markdown
Contributor Author

I'm mistaken. Looking into why t doesn't work.

I assume simply because the page turn buttons are not a wakeup source, so the kernel doesn't even wake the device up.

If I had only seen this a few hours ago...but yes, the forma is missing the wakeup-source for the buttons (but has wakeup), which I think explains why the buttons work to wake up in the first minute or so, but not once hibernation has started (anecdotal, but I've noticed the forma isn't completely hibernating after a power button press, probably as it runs through suspension).

Looking now to see if I can figure out which devices support wakeup-source so I can at least tune this proposal a little better. Also to apply it correctly as was pointed out :)

@jonnyl2

jonnyl2 commented Apr 26, 2025

Copy link
Copy Markdown
Contributor

I think it's only the KLC that supports it. None of the other devices have any mention of it in the latest FW release notes:

https://pgaskin.net/KoboStuff/kobofirmware.html

@NiLuJe

NiLuJe commented Apr 26, 2025

Copy link
Copy Markdown
Member

why the buttons work to wake up in the first minute or so

Yes, suspend entry is delayed by something like 45s (for... ntx reasons).

@NiLuJe

NiLuJe commented Apr 26, 2025

Copy link
Copy Markdown
Member

Looking now to see if I can figure out which devices support wakeup-source

Checking the dtb might be a littler overkill (and potentially brittle ;p).

I wouldn't expect the Libra 1/2 to be any different than the Forma, given the board similarities, soo, yeah, I would assume it's MTK-only (for... now?).

@NiLuJe

NiLuJe commented Apr 26, 2025

Copy link
Copy Markdown
Member

I wouldn't expect the Libra 1/2 to be any different than the Forma, given the board similarities, soo, yeah, I would assume it's MTK-only (for... now?).

I'll check on the Sage for good measure.

@NiLuJe

NiLuJe commented Apr 26, 2025

Copy link
Copy Markdown
Member

I'll check on the Sage for good measure

That would be a no on sunxi:

/sys/firmware/devicetree/base/soc@03000000/gpio-keys/
|-- autorepeat
|-- combo
|   |-- gpios
|   |-- label
|   |-- linux,code
|   |-- name
|   `-- wakeup-source
|-- compatible
|-- hall
|   |-- gpios
|   |-- label
|   |-- linux,code
|   |-- name
|   `-- wakeup-source
|-- name
|-- pagedown
|   |-- gpios
|   |-- label
|   |-- linux,code
|   `-- name
|-- pageup
|   |-- gpios
|   |-- label
|   |-- linux,code
|   `-- name
`-- power
    |-- gpios
    |-- label
    |-- linux,code
    |-- name
    `-- wakeup-source

So, yeah, gating it behind isKobo + isMTK ought to do it.

@NiLuJe for pointing out the far more elegant solution vs what I was
thinking
@kodermike

Copy link
Copy Markdown
Contributor Author

I think it's only the KLC that supports it. None of the other devices have any mention of it in the latest FW release notes:

https://pgaskin.net/KoboStuff/kobofirmware.html

I have to agree (shame though) - given kobo is shy about upgrading kernels (and presumably modules), it's only with the latest release that it looks like this is available.

@NiLuJe NiLuJe changed the title Enable page turn buttons to power on on kobo [issue-13668] [Kobo] Enable wake on page turn buttons Apr 26, 2025
* Fixed a tragic typo (looping crashes, ohmy)
* Updated label for menu item to reflect how the buttons are referenced
  elsewhere (@Commodore64user)
@kodermike

Copy link
Copy Markdown
Contributor Author

Updated label and added condition for isMTK. I suspect it's just that the MTK devices have newer kernels and therefore have the ability to set the gpio flags, but at this time new kernel is the same as MTK. In theory someone could compile a newer kernel for their device, or non-kobo's with newer kernel's with gpio compiled in, could also activate this feature. Given that it's currently tied only to one release of kobo, I'd understand if this was rejected. Thanks!

Comment thread frontend/ui/elements/common_settings_menu_table.lua Outdated
Comment thread frontend/ui/elements/common_settings_menu_table.lua Outdated

@Commodore64user Commodore64user left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is my small symbolic attempt to remind @NiLuJe of this PR, has he finally moved out? ;)

@NiLuJe

NiLuJe commented Jul 29, 2025

Copy link
Copy Markdown
Member

Yeah, I'm slooooowwwly catching up, this is next on my list, ideally this week-end ;).

@Frenzie Frenzie merged commit c4f9c60 into koreader:master Aug 3, 2025
NiLuJe added a commit to NiLuJe/koreader that referenced this pull request Aug 23, 2025
…nts for `pageturn_power`

Should help with *some* koreader#12787 reports, but not all, since that
issue predates the PR that implemented the above feature (koreader#13669)
Frenzie pushed a commit that referenced this pull request Aug 28, 2025
…nts for `pageturn_power` (#14216)

* Kobo: Don't send `PowerPress` twice when fudging page turn button events for `pageturn_power`

Should help with *some* #12787 reports, but not all, since that
issue predates the PR that implemented the above feature (#13669)

* Only fudge release events, dwallow press and repeat.

Always follow your first instinct ;).
@onatbas

onatbas commented Dec 11, 2025

Copy link
Copy Markdown

Folks, can you point me to where I should be seeing the menu option? I dug around and don’t see the option on a libra 2. I’m on the latest stable version.

Thanks in advance

@NiLuJe

NiLuJe commented Dec 11, 2025

Copy link
Copy Markdown
Member

The Libra 2 doesn't support this feature (as this requires cooperation from the kernel), which is why you can't find it.

But if you ever find yourself looking for a setting that is available on your device, there's a search available in the help section of the top menu ;).

0xstillb pushed a commit to 0xstillb/koreader-thai that referenced this pull request May 9, 2026
Adds menu items (toggles) and functionality to turn a kobo back on with the page turn buttons.

Fix koreader#13668
0xstillb pushed a commit to 0xstillb/koreader-thai that referenced this pull request May 9, 2026
…nts for `pageturn_power` (koreader#14216)

* Kobo: Don't send `PowerPress` twice when fudging page turn button events for `pageturn_power`

Should help with *some* koreader#12787 reports, but not all, since that
issue predates the PR that implemented the above feature (koreader#13669)

* Only fudge release events, dwallow press and repeat.

Always follow your first instinct ;).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FR: Toggle wake from sleep if power button pressed on kobo

6 participants