Skip to content

Correctly reconnect to Focus Blue displays on resume#13330

Merged
seanbudd merged 5 commits into
nvaccess:masterfrom
krzysz00:fix-focus-blue-on-resume
Feb 11, 2022
Merged

Correctly reconnect to Focus Blue displays on resume#13330
seanbudd merged 5 commits into
nvaccess:masterfrom
krzysz00:fix-focus-blue-on-resume

Conversation

@krzysz00

@krzysz00 krzysz00 commented Feb 11, 2022

Copy link
Copy Markdown
Contributor

Link to issue number:

Fixes #9830

Summary of the issue:

NVDA doesn't correctly regain control of some Focus Blue displays after the user has left the post-resume secure desktop. When in this state, Braille is only sent to the display when on a secure desktop. To regain normal functionality, the user must restart NVDA, possibly after unplugging the display and plugging it back in again.

From a technical perspective, the failure mode shows up as an error 995 (referring to cancelled I/O operations) in the background reader thread, which then leads to all the ack packets timing out.

Description of how this pull request fixes the issue:

This PR adds an onReadError callback to hwIo, which allows hwIo users to handle I/O errors that can't be caught with a try/catch (since the exception happens on a different thread).

It then uses this callback to detect the interrupted I/O characteristic of the post-resume failure state. When the issue occurs, the driver is terminated and reinitialized.

Testing strategy:

I suspended and resumed my computer while running a development build that included this fix and observed that, unlike with the latest release, the Braille display reflected changes to what I'd typed in a terminal after resume, instead of consistently showing "Secure Desktop".

I also checked the logs to ensure that the driver was only initialized once and that there weren't other exceptions being thrown as a result of this change.

Known issues with pull request:

None

Change log entries:

New features
Changes
Bug fixes

  • Fixed a problem where some Focus Blue Braille displays would stop working after waking the computer from sleep
    For Developers

Code Review Checklist:

  • Pull Request description:
    • description is up to date
    • change log entries
  • Testing:
    • Unit tests
    • System (end to end) tests
    • Manual testing
  • API is compatible with existing add-ons.
  • Documentation:
    • User Documentation
    • Developer / Technical Documentation
    • Context sensitive help for GUI changes
  • UX of all users considered: (N/A)
    • Speech
    • Braille
    • Low Vision
    • Different web browsers
    • Localization in other languages / culture than English

Fixes nvaccess#9830

After control of the session is returned to the user
from the post-resume lock screen, I/O directed at some Focus Blue
braille displays would raise an error about the operation being cancelled,
causing the I/O thread to crash but not triggering a restart
of the display driver, leading the display to not function correctly
until NVDA was restarted.

This commit adds a callback that allows the I/O exception
thrown in hwio to be supressed and uses it to terminate and
reinitialize the Braille display after resume.

One flaw with the current strategy is that the termination can
cause more I/O requests to be cancelled, leading to repeated
renitilization.
@krzysz00 krzysz00 requested a review from a team as a code owner February 11, 2022 00:51
@krzysz00 krzysz00 requested a review from seanbudd February 11, 2022 00:51
@krzysz00 krzysz00 marked this pull request as draft February 11, 2022 00:52
@krzysz00 krzysz00 marked this pull request as ready for review February 11, 2022 00:53

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

Thanks @krzysz00, LGTM

@AppVeyorBot

Copy link
Copy Markdown

See test results for failed build of commit aff0999b2b

@seanbudd seanbudd merged commit 28d5375 into nvaccess:master Feb 11, 2022
@nvaccessAuto nvaccessAuto added this to the 2022.1 milestone Feb 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error in Freedom Scientific focus braille detection after standby/resume of PC

4 participants