Skip to content

Prevent system sleep when reading lon pieces of text with braille only#10111

Merged
michaelDCurran merged 3 commits into
nvaccess:masterfrom
BabbageCom:resetIdleTimer
Sep 9, 2019
Merged

Prevent system sleep when reading lon pieces of text with braille only#10111
michaelDCurran merged 3 commits into
nvaccess:masterfrom
BabbageCom:resetIdleTimer

Conversation

@LeonarddeR

Copy link
Copy Markdown
Collaborator

Link to issue number:

Fixes #9175

Summary of the issue:

When reading long parts of text in braille with braille display gestures, the system isn't getting any input from a normal input device. Therefore, the system idle timer isn't reset, and at some point, the system goes into stand by.

Description of how this pull request fixes the issue:

Added a new shouldPreventSystemIdle attribute on gestures. If True, NVDA resets the system idle timer when processing the gesture.

Testing performed:

If I understand @CBC33000 correctly, in #9175 (comment), this fixes the issue.

Known issues with pull request:

This pr doesn't prevent the screen saver to activate. Unfortunately, the docs for SetThreadExecutionState explicitly state that preventing screen saver activation is not supported.

Change log entry:

@CoBC

CoBC commented Aug 18, 2019

Copy link
Copy Markdown

I confirm this PR resolve the problem explain in #9175 but unfortunitly no solution was find for screensaver.

@lukaszgo1

Copy link
Copy Markdown
Contributor

In the issue above @ pzajda asked about SetThreadExecutionState with the flag ES_DISPLAY_REQUIRED. I am no expert on this, but according to the documentation it should disable the screen saver.

@LeonarddeR

Copy link
Copy Markdown
Collaborator Author

From the SetThreadExecutionState remarks section:

This function does not stop the screen saver from executing.

I can create a try build with ES_DISPLAY_REQUIRED, but it feels a bit like a waste of time to try this when Microsoft explicitly states that it's not going to work.

@Brian1Gaff

Brian1Gaff commented Aug 19, 2019 via email

Copy link
Copy Markdown

@michaelDCurran michaelDCurran 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.

All looks good, barring my comment about ES_DISPLAY_REQUIRED.

Comment thread source/inputCore.py Outdated
queueHandler.queueFunction(queueHandler.eventQueue, speech.pauseSpeech, speechEffect == gesture.SPEECHEFFECT_PAUSE)

if gesture.shouldPreventSystemIdle:
winKernel.SetThreadExecutionState(winKernel.ES_SYSTEM_REQUIRED)

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.

I do think that we should also include ES_DISPLAY_REQUIRED here, as this will cause Windows not to power off the display. See:
https://docs.microsoft.com/en-us/windows/win32/power/system-sleep-criteria
I do agree it is confusing whether or not it will specifically disable the screen saver though due to the comment in the documentation for SetThreadExecutionState.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Makes sense. I initially thought that it would actually be an energy savings benefit that the screen would go black if you have a short screen idle timeout, but it is probably confusing that it stops one idle timer and not the other.

@michaelDCurran michaelDCurran merged commit f8280f4 into nvaccess:master Sep 9, 2019
@nvaccessAuto nvaccessAuto added this to the 2019.3 milestone Sep 9, 2019
michaelDCurran added a commit that referenced this pull request Sep 9, 2019
@LeonarddeR LeonarddeR deleted the resetIdleTimer branch September 24, 2019 05:11
@LeonarddeR LeonarddeR added the BabbageWork Pull requests filed on behalf of Babbage B.V. label Oct 11, 2019
feerrenrut pushed a commit that referenced this pull request Jan 30, 2020
When a system is set up to lock or go to sleep within one minute, say all could be interrupted when reading long paragraphs in virtual buffers. Possibly in other cases as well. Similar to #10111. We instruct the system not to sleep. This happens on every line we reach.
seanbudd pushed a commit that referenced this pull request Feb 16, 2025
Fixes #17649
Partially reverts #11118
Follow up of #10111, #10643,

Summary of the issue:
On some systems (mine, for example 😉) the screen still locks during a say all even though we reset the system idle timer. We also reset the display timer in the past, but this was reverted in #11118, particularly on request of @btman16

Description of user facing changes
Added a new advanced setting that, when enabled, also resets the display timer.

Description of development approach
Added new helper/wrapper methods to systemUtils
Rather than resetting the timer(s) many times during a say all, we now persist the state during say all using the ES_CONTINUOUS flag. This should avoid an edge case where reading a line takes more then a minute and the sleep timer is a minute, in which case the system will still lock.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

BabbageWork Pull requests filed on behalf of Babbage B.V.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

No interrupt Braille reading when cumputer pass in sleep mode

6 participants