Skip to content

Esp32 microcontroller is not handled as Albatross display#15693

Closed
burmancomp wants to merge 30 commits into
nvaccess:masterfrom
burmancomp:esp32IsNotHandledAsAlbatrossDisplay
Closed

Esp32 microcontroller is not handled as Albatross display#15693
burmancomp wants to merge 30 commits into
nvaccess:masterfrom
burmancomp:esp32IsNotHandledAsAlbatrossDisplay

Conversation

@burmancomp

@burmancomp burmancomp commented Oct 26, 2023

Copy link
Copy Markdown
Contributor

Link to issue number:

fixes #15671

Summary of the issue:

Albatross driver handled Esp32 microcontroller as Albatross display if controller send valid init packet. This is problem especially when displays are detected automatically.

Description of user facing changes

When using usb connection, driver can check that bus reported device description is "Albatross Braille Display". Esp32 is not detected automatically as Albatross.

Description of development approach

_searchPorts function blocks port if VID and PID are correct but bus reported bus reported device description is not "Albatross Braille Display", in other cases port is valid to try to connect.

Testing strategy:

tested by @beqabeqa473

Known issues with pull request:

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.

@LeonarddeR

Copy link
Copy Markdown
Collaborator

I think there could be a more generic way to do this in bdDetect. Actually, taking the bus reported device description into account is pretty neat, because that ensures bdDetect can filter out devices earlier.

@beqabeqa473

Copy link
Copy Markdown
Contributor

Hello.

I will test it and return back with results.

@beqabeqa473

Copy link
Copy Markdown
Contributor

It seems bug with false-positive was fixed.

Only one thing, when i am plugging in ESP32 board, sometimes i am getting an error:
ERROR - hwIo.base.IoBase._notifyReceive (14:52:50.630) - hwIo.ioThread.IoThread (22792):
Traceback (most recent call last):
File "hwIo\base.py", line 204, in _notifyReceive
self._onReceive(data)
TypeError: 'NoneType' object is not callable
ERROR - hwIo.base.IoBase._notifyReceive (14:52:50.771) - hwIo.ioThread.IoThread (22792):
Traceback (most recent call last):
File "hwIo\base.py", line 204, in _notifyReceive
self._onReceive(data)
TypeError: 'NoneType' object is not callable

@beqabeqa473

Copy link
Copy Markdown
Contributor

This PR should be merged to 2023.3 release, as it makes screenreader experience very bad when connecting a microcontroller like esp32.

@LeonarddeR

Copy link
Copy Markdown
Collaborator

it is not necessary to merge this to 2023.3 as there are several workarounds. You can for example exclude the Albatross driver from automatic detection.

@burmancomp

Copy link
Copy Markdown
Contributor Author

Thank you @beqabeqa473, nice if it fixes issue.

@LeonarddeR do you think that if this (or more generic solution) is merged, albatross detection should not conflict with other drivers anymore?

@beqabeqa473

beqabeqa473 commented Oct 27, 2023 via email

Copy link
Copy Markdown
Contributor

@beqabeqa473

Copy link
Copy Markdown
Contributor

@LeonarddeR I will be happy to hear from you an answer, how person which can have such device, which is not so difficult to find, could understand that it is because of this particular braille display. Why person should have to go through this journey if we already discovered it and fix is working?
Why person should wait several months to see this in 2024.1?
Why person should be under the risk if they don't know about this problem?

@LeonarddeR

Copy link
Copy Markdown
Collaborator

Basically I don't have anything to say about this since I'm not NV Access.
I'm however pretty sure that issue exists since 2023.1 already.

@beqabeqa473

beqabeqa473 commented Oct 27, 2023 via email

Copy link
Copy Markdown
Contributor

@burmancomp burmancomp marked this pull request as ready for review October 27, 2023 15:53
@burmancomp burmancomp requested a review from a team as a code owner October 27, 2023 15:53

@LeonarddeR LeonarddeR left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

As said above, I personally prefer a more generic approach. Would it be possible to extend hwPortUtils.listComPorts to retrieve the name of the controller behind the COM port? That can then be added to the yielded dictionary. The albatross driver then can filter as appropriate. IN a follow up, we can move the filtering to bdDetect.

@bramd

bramd commented Oct 28, 2023

Copy link
Copy Markdown
Contributor

I am also working on a braille driver for a device that unfortunately has a fairly generic VID/PID combination. I would also like to use the bus description there to minimize false positives, so I would also prefer this as a generic solution in bdDetect.

Regarding the discussion of autodetection of the Albatross driver. It is not for me to decide on this, but due to this issue and other issues in the past that stem from the weird way an Albatross has to be detected, I would not mind if we exclude it from autodetection by default. But that discussion is clearly outside the scope of this PR.

@burmancomp

Copy link
Copy Markdown
Contributor Author

I also prefer generic solution but it sounds too difficult task for me now.

@LeonarddeR

Copy link
Copy Markdown
Collaborator

I will perform some research on it on monday, when I have a device with the same VID/PID at hand.

@beqabeqa473 could you provide a dump of the following from the python console?

import hwPortUtils
list(hwPortUtils.listComPorts())

@beqabeqa473

beqabeqa473 commented Oct 28, 2023 via email

Copy link
Copy Markdown
Contributor

@seanbudd seanbudd marked this pull request as draft October 30, 2023 01:29
@seanbudd

Copy link
Copy Markdown
Member

Converting to draft until the design discussion resolves

@LeonarddeR

LeonarddeR commented Oct 30, 2023

Copy link
Copy Markdown
Collaborator

@burmancomp You can edit hwPortUtils.py as follows:

Above SPDRP_HARDWAREID = 1, add:

SPDRP_DEVICEDESC = 0

Below entry["friendlyName"] = buf.value, add:

			# Device description
			if not SetupDiGetDeviceRegistryProperty(
				g_hdi,
				ctypes.byref(devinfo),
				SPDRP_DEVICEDESC,
				None,
				ctypes.byref(buf), ctypes.sizeof(buf) - 1,
				None
			):
				# Ignore ERROR_INSUFFICIENT_BUFFER
				if ctypes.GetLastError() != ERROR_INSUFFICIENT_BUFFER:
					raise ctypes.WinError()
			else:
				description = entry["deviceDescription"] = buf.value

Then, on the python console:

import hwPortUtils
list(hwPortUtils.listComPorts())

Pretty curious whether the device description for albatross is set correctly, or whether it is just the default USB Serial Port string.

@burmancomp

Copy link
Copy Markdown
Contributor Author

If you mean bus reported device description of usb serial port found in windows device manager (ports (com and lpt)), it is usb serial port.

@burmancomp

Copy link
Copy Markdown
Contributor Author

But bus reported device description of usb serial converter (found in usb drivers) is "Albatross Braille Display".

@LeonarddeR

Copy link
Copy Markdown
Collaborator

Thanks, so this is not going to work, we need to look up the bus description of the serial converter instead.
May I ask how you found out the registry query you're using now for fetching the bus description?

@burmancomp

Copy link
Copy Markdown
Contributor Author

In registry editor I searched "Albatross Braille Display", and there was no other entries.

@beqabeqa473

Copy link
Copy Markdown
Contributor

Are there any news with this?

@beqabeqa473

Copy link
Copy Markdown
Contributor

Hello.

I will test it out once it builds

@beqabeqa473

Copy link
Copy Markdown
Contributor

I hope this is fixed for now. I was not able to reproduce this with several nvda restarts with device plugged in, connections/disconnections. Port is beeing logged in log but is not detected as albatros device.

There are some errors in hwio like:
registering pre_configSave action: <class 'brailleDisplayDrivers.handyTech.BrailleDisplayDriver'>
DEBUGWARNING - brailleDisplayDrivers.handyTech.BrailleDisplayDriver._handleInputStream (15:29:48.474) - hwIo.ioThread.IoThread (23828):
Unhandled packet of type b'\x8d'
DEBUGWARNING - brailleDisplayDrivers.handyTech.BrailleDisplayDriver._handleInputStream (15:29:48.474) - hwIo.ioThread.IoThread (23828):
Unhandled packet of type b'\x08'
DEBUGWARNING - brailleDisplayDrivers.handyTech.BrailleDisplayDriver._handleInputStream (15:29:48.474) - hwIo.ioThread.IoThread (23828):
Unhandled packet of type b'\x18'
ERROR - hwIo.base.IoBase._notifyReceive (15:29:48.474) - hwIo.ioThread.IoThread (23828):
Traceback (most recent call last):
File "hwIo\base.pyc", line 204, in _notifyReceive
TypeError: 'NoneType' object is not callable
and one more which unfortunately i have lost, but i am not sure it is in scope of this.

Thanks you @burmancomp and @LeonarddeR for fixes.

@LeonarddeR LeonarddeR left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks @burmancomp
I think this branch needs to be merged into beta, but @seanbudd will probably handle appropriately.

Comment thread source/brailleDisplayDrivers/albatross/driver.py
Comment thread source/brailleDisplayDrivers/albatross/driver.py Outdated
Comment thread source/brailleDisplayDrivers/albatross/driver.py Outdated
@burmancomp burmancomp marked this pull request as ready for review December 14, 2023 13:15
seanbudd
seanbudd previously approved these changes Dec 14, 2023
Comment thread source/brailleDisplayDrivers/albatross/driver.py Outdated
@seanbudd seanbudd changed the base branch from master to beta December 14, 2023 22:53
@seanbudd seanbudd dismissed their stale review December 14, 2023 22:53

The base branch was changed.

@seanbudd seanbudd changed the base branch from beta to master December 14, 2023 22:54
@seanbudd

Copy link
Copy Markdown
Member

@burmancomp - this needs to be rebased on beta and retarget beta if you wish to include in 2024.1. Note, this isn't considered a high priority fix, and is welcome to target 2024.2.
The only reason this can be included in 2024.1 is it is low risk, and we are early enough in the beta cycle for 2024.1.

@seanbudd seanbudd added this to the 2024.1 milestone Dec 14, 2023
@burmancomp

Copy link
Copy Markdown
Contributor Author

@burmancomp - this needs to be rebased on beta and retarget beta if you wish to include in 2024.1. Note, this isn't considered a high priority fix, and is welcome to target 2024.2. The only reason this can be included in 2024.1 is it is low risk, and we are early enough in the beta cycle for 2024.1.

@beqabeqa473 what do you think?

@seanbudd let me know if there is something I should do as to rebasing/retargeting if decision is to take this to 2024.1.

@seanbudd

Copy link
Copy Markdown
Member

I think it would be nice to get this fix in, particularly if you can rebase in the next week.
It's a small and safe bug fix, which we usually allow early in the beta cycle

@burmancomp

Copy link
Copy Markdown
Contributor Author

I have no experience about that process. Is there any documentation?

@seanbudd

seanbudd commented Dec 14, 2023

Copy link
Copy Markdown
Member

You need to perform git rebase -i beta. I'd encourage reading the following:

GitHub docs (good background): https://docs.github.com/en/get-started/using-git/about-git-rebase

Manual: https://git-scm.com/docs/git-rebase

Atlassian docs (more details, however have some inaccessible diagrams): https://www.atlassian.com/git/tutorials/rewriting-history/git-rebase

@burmancomp

Copy link
Copy Markdown
Contributor Author

Something like this?

git checkout origin/beta
git branch -u nvaccess/master
git checkout esp32IsNotHandledAsAlbatrossDisplay
git rebase -i beta
git checkout beta
git push origin beta

What to do with comments where main branch is merged to esp32IsNotHandledAsAlbatrossDisplay? Could they be deleted or should some of them included like them which fix merge conflicts? And should all commits squashed/fixed so that result is single commit?

@seanbudd

Copy link
Copy Markdown
Member

If nvaccess is your origin for this repo, this should be the easiest method.
I'd encourage doing this in VS Code with GitLens however I'm not certain on the accessibility of this.

First, rebase on master, this will make the rebase on beta easier.
Follow this guide on squash rebasing.

git fetch nvaccess
git checkout esp32IsNotHandledAsAlbatrossDisplay
git rebase --keep-base -i nvaccess/master

You'll want to "pick" the first commit with P.
The rest of the commits after use "f" for fix-up.

Now rebase on beta

git fetch nvaccess
git checkout esp32IsNotHandledAsAlbatrossDisplay
git rebase -i nvaccess/beta

You'll want to "drop" everything from master, (e.g. the "Start 2024.2" commit).
Only "pick" the commit you just created.

@beqabeqa473

Copy link
Copy Markdown
Contributor

i think it should be included in 2024.1 to eliminate possible problems which could be serious if someone stucks with it.

@burmancomp

Copy link
Copy Markdown
Contributor Author

I have now hopefully done what @seanbudd adviced in this comment.

Is next step something like:

git push origin/beta esp32IsNotHandledAsAlbatrossDisplay

@Adriani90

Copy link
Copy Markdown
Collaborator

You have to do a git push -f at the end. then you commits should go to Beta directly if your local branch is properly rebased.

But i advice to do a

git dif remotes/nvaccess/beta burmancomp:esp32IsNotHandledAsAlbatrossDisplay

before pushing, to see what exactly your push will do to the beta branch.

@burmancomp

Copy link
Copy Markdown
Contributor Author

I checked with:

git diff nvaccess/beta esp32IsNotHandledAsAlbatrossDisplay

As far as I understand diff showed that lines this pr adds would be added.

but

git diff nvaccess/beta origin/esp32IsNotHandledAsAlbatrossDisplay

shows a lot of differences. May this be because I have not pushed esp32IsNotHandledAsAlbatrossDisplay after rebasing?

@Adriani90

Adriani90 commented Dec 16, 2023 via email

Copy link
Copy Markdown
Collaborator

@Adriani90

Copy link
Copy Markdown
Collaborator

In your case origin is the upstream repository you forged from NV Access and remote is the original NV Access repo, not the copy of it. So that's probably why you see the differences.

@burmancomp

Copy link
Copy Markdown
Contributor Author

There is pull request #15928 now.

I pushed with:

git push origin esp32IsNotHandledAsAlbatrossDisplay:beta

@seanbudd

Copy link
Copy Markdown
Member

Closing in favour of #15928

@seanbudd seanbudd closed this Dec 17, 2023
@burmancomp burmancomp deleted the esp32IsNotHandledAsAlbatrossDisplay branch December 17, 2023 22:52
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.

esp32 microController is identified as Caiku Albatross 46/80 braille display

8 participants