Skip to content

Conversation

@bramd
Copy link
Contributor

@bramd bramd commented Dec 14, 2024

Link to issue number:

Partially fixes #17518

Summary of the issue:

Some HumanWare devices do not report the number of cells in their HID capabilities report. This is the case for Brailliant BI 40X since firmware 2.4.

Description of user facing changes

The Brailliant BI 40X and similar display with firmware version 2.4 is working correctly again.

Description of development approach

This PR fixes the issue by using the HID output report size to calculate the number of cells. If the device reports a cell count, this is still being used.

Testing strategy:

Tested with a Brailliant BI 40X over Bluetooth.

Known issues with pull request:

Since firmware 2.4 this device is recognized by the Standard HID driver over Bluetooth. However, the keys do not work using that driver. This PR does not fix the Standard HID driver.

Code Review Checklist:

  • Documentation:
    • Change log entry
    • User Documentation
    • Developer / Technical Documentation
    • Context sensitive help for GUI changes
  • Testing:
    • Unit tests
    • System (end to end) tests
    • Manual testing
  • UX of all users considered:
    • Speech
    • Braille
    • Low Vision
    • Different web browsers
    • Localization in other languages / culture than English
  • API is compatible with existing add-ons.
  • Security precautions taken.

Summary by CodeRabbit

  • New Features

    • Added support for Windows 10 features, including the Emoji panel and dictation.
    • Enhanced braille display functionality with automatic detection and braille input support.
    • Introduced new commands for improved navigation and interaction with content.
    • Enhanced performance in Microsoft Office and web browsers, along with better support for mathematical content.
  • Bug Fixes

    • Various bug fixes across multiple applications and scenarios.
  • Version Update

    • Minor version updated from 1 to 2.

@bramd bramd marked this pull request as ready for review December 14, 2024 16:26
@bramd bramd requested a review from a team as a code owner December 14, 2024 16:26
@bramd bramd requested a review from SaschaCowley December 14, 2024 16:26
Copy link
Collaborator

@LeonarddeR LeonarddeR left a comment

Choose a reason for hiding this comment

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

This works like a charm with a Brailliant Bi 20X. I confirmed that the cell count is ok. just one suggestion for improved logging.

@michaelDCurran
Copy link
Member

I'm a bit confused with the expected behaviour on Firmware 2.4 for the Brailliant 20X. Via USB, Standard HID Braille works fine. But the Humanware Brailliant driver (although listed and loads) causes a blank display. However, via Bluetooth, it is the exact opposite. Brailliant B driver works fine, but Standard HID braille results in a blank display. I don't remember what it was before this firmware update. I thought it was the other way around. The Brailliant does not seem to allow the user to configure what protocol it offers on the display? Does it actually offer both at the same time?
I was testing with both #17526 and #17522 together.

@LeonarddeR
Copy link
Collaborator

@michaelDCurran This is quite interesting. I recall it being the other way around as well.
Here are my observations with a Mantis on FW 2.4 over USB.

  1. Select the Brailliant driver, there is braille output
  2. Select the HID driver, there is no braille, output nor input, but the device is detected as a 40 cell display.
  3. Now, disconnect and reconnect USB and select the HID driver. Observe that the driver now works for both input and output.
  4. Now select the brailliant driver again. It is reported as 40 cells, input and output are broken though.

This makes me think that while the device offers both protocols at the same time, first come, first served.

Long story short, I think our observations are due to shortcomings in the device/firmware, not in NVDA per se.

@seanbudd seanbudd added this to the 2024.4.2 milestone Dec 16, 2024
@SaschaCowley SaschaCowley added the conceptApproved Similar 'triaged' for issues, PR accepted in theory, implementation needs review. label Dec 16, 2024
bramd and others added 4 commits December 17, 2024 14:55
…ze. This solves the problem where some devices and firmware versions do not report a cell count in their capabilities report. The behavior is unchanged for devices that report their cell count correctly.
@SaschaCowley SaschaCowley changed the base branch from master to rc December 17, 2024 04:05
@SaschaCowley SaschaCowley reopened this Dec 17, 2024
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 17, 2024

Walkthrough

The pull request introduces modifications to the Brailliant B braille display driver initialization process, focusing on improving the method for determining the number of display cells. The changes enhance error handling and logging when retrieving device capabilities. Additionally, the minor version number of NVDA has been incremented, and the changes documentation has been updated to reflect recent improvements in the software.

Changes

File Change Summary
source/brailleDisplayDrivers/brailliantB.py Modified _initAttempt method to improve cell number detection and error handling
source/buildVersion.py Incremented version_minor from 1 to 2
user_docs/en/changes.md Updated with new features and improvements for the NVDA release

Assessment against linked issues

Objective Addressed Explanation
Brailliant BI 40X Driver Functionality [#17518] Partial changes to driver initialization, but unclear if fully resolves Bluetooth connection issues

Possibly related issues

Possibly related PRs

Suggested labels

merge-early

Suggested reviewers

  • michaelDCurran
  • LeonarddeR

Tip

CodeRabbit's docstrings feature is now available as part of our Early Access Program! Simply use the command @coderabbitai generate docstrings to have CodeRabbit automatically generate docstrings for your pull request. We would love to hear your feedback on Discord.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (4)
source/brailleDisplayDrivers/brailliantB.py (2)

195-200: Consider enhancing error logging

While the fallback to _writeSize is a good approach, the error message could be more informative about why this method was attempted and what the actual values were.

-				log.debugWarning("Could not get _writeSize from HID device")
+				log.debugWarning(
+					"Could not get _writeSize from HID device. "
+					"This is expected for some connection types."
+				)

193-213: Consider adding unit tests

While the implementation looks solid, it would be beneficial to add unit tests covering:

  1. Device reporting zero cells
  2. Device with missing _writeSize
  3. Device with both fallback mechanisms failing

Would you like me to help create these unit tests?

user_docs/en/changes.md (2)

7-7: Inconsistent capitalization in product name

"Humanware" should be "HumanWare" to match the company's official branding.

-* Humanware Brailliant BI/B series braille displays can now be used when connected via bluetooth.
+* HumanWare Brailliant BI/B series braille displays can now be used when connected via Bluetooth.

7-7: Bluetooth should be capitalized

The word "bluetooth" should be capitalized as "Bluetooth" since it is a proper noun.

📜 Review details

Configuration used: .coderabbit.yml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 782c3d8 and 8904674.

📒 Files selected for processing (3)
  • source/brailleDisplayDrivers/brailliantB.py (1 hunks)
  • source/buildVersion.py (1 hunks)
  • user_docs/en/changes.md (1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
source/buildVersion.py (2)

Pattern **/*: Focus on code smells, logic errors, edge cases, missing test cases, security flaws and serious issues. Avoid commenting on minor issues such as linting, formatting and style issues. This project uses tabs instead of spaces, do not suggest usage of spaces over tabs. Are there any 'red flags' in this code that might warrant closer investigation from a security standpoint? Explain what makes them suspicious. When providing code suggestions, particularly when requested, ensure GitHub's suggestion format is used, i.e.: suggestion <code changes>


Pattern **/*.py: _, pgettext, ngettext, and ngettext are defined globally, errors for this being undefined can be ignored.

source/brailleDisplayDrivers/brailliantB.py (2)

Pattern **/*: Focus on code smells, logic errors, edge cases, missing test cases, security flaws and serious issues. Avoid commenting on minor issues such as linting, formatting and style issues. This project uses tabs instead of spaces, do not suggest usage of spaces over tabs. Are there any 'red flags' in this code that might warrant closer investigation from a security standpoint? Explain what makes them suspicious. When providing code suggestions, particularly when requested, ensure GitHub's suggestion format is used, i.e.: suggestion <code changes>


Pattern **/*.py: _, pgettext, ngettext, and ngettext are defined globally, errors for this being undefined can be ignored.

user_docs/en/changes.md (3)

Pattern **/*: Focus on code smells, logic errors, edge cases, missing test cases, security flaws and serious issues. Avoid commenting on minor issues such as linting, formatting and style issues. This project uses tabs instead of spaces, do not suggest usage of spaces over tabs. Are there any 'red flags' in this code that might warrant closer investigation from a security standpoint? Explain what makes them suspicious. When providing code suggestions, particularly when requested, ensure GitHub's suggestion format is used, i.e.: suggestion <code changes>


Pattern **/*.md: Focus on grammar, spelling, and punctuation. Also consider readability and clarity of contents. Ensure that changes follow the style of one sentence per line, suggest changes if this is not met.


Pattern user_docs/en/changes.md: Ensure each change log entry references an issue or pull request number. Change log entries can also include a reference to a GitHub author. Examples of valid change log entries: * Item with sub-items (#123, @username): * sub-item * bar (#342) * Item with. Multiple lines. (#143)

🔇 Additional comments (4)
source/buildVersion.py (1)

68-68: LGTM: Version bump is appropriate

The minor version increment is consistent with the addition of new functionality for handling BrailliantB devices that don't report their cell count.

source/brailleDisplayDrivers/brailliantB.py (2)

193-194: Good practice: Preventing premature display writes

Moving the self.numCells assignment to the end of the method prevents potential issues with display writes before the device capabilities are fully determined.


202-210: LGTM: Robust device capabilities handling

The implementation properly handles cases where the device doesn't report its cell count, with appropriate fallback and logging.

Let's verify the compatibility with different device models:

✅ Verification successful

Let me gather more context about the HIMS driver since it also uses HR_CAPS.


Verified: Cell count handling is consistent with HIMS driver implementation

The implementation in brailliantB.py correctly follows the established pattern for HID device cell count detection, with two key observations:

  • Both drivers use HR_CAPS feature report to get cell count information
  • The offset difference (24 vs 9) is intentional as these are different device families
  • Both implement appropriate fallback and error handling
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for potential device-specific handling in the codebase

# Look for other places where HR_CAPS is used
rg "HR_CAPS" --type py

# Check for any device-specific cell count handling
ast-grep --pattern 'numCells = $_'

Length of output: 2726


Script:

#!/bin/bash
# Check how HIMS driver handles HR_CAPS for cell count
rg -B 5 -A 5 "HR_CAPS" source/brailleDisplayDrivers/hims.py

Length of output: 522

user_docs/en/changes.md (1)

Line range hint 1-7000: Overall changelog format looks good

The changelog follows a consistent format with:

  • Clear version headers
  • Categorized sections (New Features, Changes, Bug Fixes, etc.)
  • Bullet points for individual changes
  • Issue/PR references where applicable

@SaschaCowley SaschaCowley merged commit e8ebe86 into nvaccess:rc Dec 18, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

conceptApproved Similar 'triaged' for issues, PR accepted in theory, implementation needs review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

HumanWare driver does not work for Brailliant BI 40X on firmware 2.4.0_build4201

5 participants