Skip to content

Commit

Permalink
Esp32 microcontroller is not handled as Albatross display (#15928)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
burmancomp committed Dec 17, 2023
1 parent 81e17be commit 0c8b023
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 5 deletions.
8 changes: 8 additions & 0 deletions source/brailleDisplayDrivers/albatross/constants.py
Expand Up @@ -308,3 +308,11 @@ class RoutingKeyRange:
Otherwise it falls back to "wait for connection" state.
This behavior is built-in feature of the firmware of device.
"""

BUS_DEVICE_DESC = "Albatross Braille Display"
"""Bus reported device description
"""

VID_AND_PID = "VID_0403&PID_6001"
"""Vid and pid
"""
19 changes: 14 additions & 5 deletions source/brailleDisplayDrivers/albatross/driver.py
Expand Up @@ -26,7 +26,6 @@
Lock,
)
from typing import (
Iterator,
List,
Optional,
Tuple,
Expand Down Expand Up @@ -61,6 +60,8 @@
END_BYTE,
BOTH_BYTES,
KC_INTERVAL,
BUS_DEVICE_DESC,
VID_AND_PID,
)
from .gestures import _gestureMap

Expand Down Expand Up @@ -92,7 +93,7 @@ def registerAutomaticDetection(cls, driverRegistrar: DriverRegistrar):
def getManualPorts(cls):
return braille.getSerialPorts()

def __init__(self, port="Auto"):
def __init__(self, port: str = "auto"):
super().__init__()
# Number of cells is received when initializing connection.
self.numCells = 0
Expand Down Expand Up @@ -158,13 +159,21 @@ def terminate(self):
except Exception:
log.exception("Error terminating albatross driver")

def _searchPorts(self, port: str):
def _searchPorts(self, originalPort: str):
"""Search ports where display can be connected.
@param port: port name as string
@param originalPort: original port name as string
@raises: RuntimeError if no display found
"""
for self._baudRate in BAUD_RATE:
for portType, portId, port, portInfo in self._getTryPorts(port):
for portType, portId, port, portInfo in self._getTryPorts(originalPort):
# Block port if its vid and pid are correct but bus reported
# device description is not "Albatross Braille Display".
if (
portId == VID_AND_PID
and portInfo.get("busReportedDeviceDescription") != BUS_DEVICE_DESC
):
log.debug(f"port {port} blocked; port information: {portInfo}")
continue
# For reconnection
self._currentPort = port
self._tryToConnect = True
Expand Down
1 change: 1 addition & 0 deletions user_docs/en/changes.t2t
Expand Up @@ -97,6 +97,7 @@ Users of Poedit 1 are encouraged to update to Poedit 3 if they want to rely on e
- Contracted braille input works properly again. (#15773, @aaclause)
- Braille is now updated when moving the navigator object between table cells in more situations (#15755, @Emil-18)
- The result of reporting current focus, current navigator object, and current selection commands is now shown in braille. (#15844, @Emil-18)
- The Albatross braille driver no longer handles a Esp32 microcontroller as an Albatross display. (#15671)
-
- LibreOffice:
- Words deleted using the ``control+backspace`` keyboard shortcut are now also properly announced when the deleted word is followed by whitespace (like spaces and tabs). (#15436, @michaelweghorn)
Expand Down

0 comments on commit 0c8b023

Please sign in to comment.