Skip to content
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

Allow add-on braille display drivers to opt in for auto detection #15196

Closed
LeonarddeR opened this issue Jul 26, 2023 · 2 comments · Fixed by #15200
Closed

Allow add-on braille display drivers to opt in for auto detection #15196

LeonarddeR opened this issue Jul 26, 2023 · 2 comments · Fixed by #15200
Labels
blocked/needs-product-decision A product decision needs to be made. Decisions about NVDA UX or supported use-cases.
Milestone

Comments

@LeonarddeR
Copy link
Collaborator

LeonarddeR commented Jul 26, 2023

Is your feature request related to a problem? Please describe.

There is currently no documented way for braille display drivers to register themselves for auto detection. You can register a display in a global plugin, but as the global plugin loads after the braille subsystem, the display won't be detected in the first round of detection.

Describe the solution you'd like

  1. Add a registerAutomaticDetection method on BrailleDisplayDriver. This method must be implemented for drivers to register themselves in bdDetect. The method receives a new bdDetect.DriverRegistrar object that has addUsbDevices, addBluetoothDevices and addDeviceScanner methods that are bound to the driver.
  2. Add a new checklistbox to the braille display selection dialog. When selection is set to automatic, this list box will be visible and allows you to opt out for auto detection of drivers you aren't interested in. For example, I only own HandyTech and Humanware devices, so the rest can be stolen from me.😉 Note that this list box will be a opt out list, so drivers will be enabled by default. This ensures that new drivers will always be enabled unless explicitly disabled.
  3. bdDetect.addUsbDevices and bdDetect.addBluetoothDevices will be deprecated. The advanced option to disable HID braille will also be removed in favor of this new ability to opt out for detection. As HID braille opt out is an advanced setting, I don't think profile upgrades are required.
@bramd
Copy link
Contributor

bramd commented Jul 26, 2023

From a user's perspective, the opt-out of certain drivers is the big feature here worth implementing in it's own right. Easier driver registration for add-on developers is also a nice bonus that I would love to see implemented.

The HID braille driver sometimes activates when a HID-compatible display such as the Brailliant BI 40x is being detected during a scan cycle where the native Brailliant driver missed it. This causes confusion such as other key bindings and is a good argument to get disabling this driver outside of the advanced options.

@LeonarddeR
Copy link
Collaborator Author

From a user's perspective, the opt-out of certain drivers is the big feature here worth implementing in it's own right.

Agreed there. But opt-out and again opt-in would rely on asking a driver to register itself.

@seanbudd seanbudd added the blocked/needs-product-decision A product decision needs to be made. Decisions about NVDA UX or supported use-cases. label Aug 1, 2023
seanbudd pushed a commit that referenced this issue Sep 1, 2023
closes #15196

Summary of the issue:
It is currently not possible to disable display drivers for automatic detection, other than the HID braille standard
There is no obvious way for add-on bundled braille display drivers to register themselves in automatic detection.
Description of user facing changes
In the braille display selection dialog, when automatic is selected, there is now an additional checklistbox that allows you to disable drivers. The disabled drivers are saved in config.
The advanced option for to disable HID braille has been removed. Users should use the new checklistbox instead. There is a config profile upgrade step to remember the user's decision about explicitly disabling HID.
It is now possible to select the HID braille driver manually when it is disabled for automatic detection. The old option in advanced setting disabled HID completely, i.e. the driver wasn't available for manual selection either.
Description of development approach
Added a registerAutomaticDetection classmethod to BrailleDisplayDriver. This method is called by bdDetect.initialize. The classmethod receives a bdDetect.DriverRegistrar that contains the following methods:
addUsbDevices: to register USB devices
addBluetoothDevices: To register bluetooth devices
addDeviceScanner: convenience method to register a handler to the scanForDevices extension point
Added a supportsAutomaticDetection boolean attribute on braille display drivers. This should be set to True for bdDetect to recognize the driver.
Removed the option from the config to enable/disable HID, instead rely on a new excludeDisplays lisst in the config that is populated by the new option in the braille display selection dialog. Note that exclusions are saved, not inclusions. This ensures that new drivers will be opt-out.
bdDetect.Detector._queueBgScan has a backwards compatible change for its limitToDevices parameter. When None, it falls back to the list of enabled drivers. When no drivers are disabled, it checks all drivers.
Logic from bdDetect.initialize() has been moved to the respective display drivers, calling the replacement methods on the driverRegistrar and omitting the name of the driver in the method call.
@nvaccessAuto nvaccessAuto added this to the 2023.3 milestone Sep 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked/needs-product-decision A product decision needs to be made. Decisions about NVDA UX or supported use-cases.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants