diff --git a/source/brailleDisplayDrivers/albatross/constants.py b/source/brailleDisplayDrivers/albatross/constants.py index 3f18963c636..f74cd775765 100644 --- a/source/brailleDisplayDrivers/albatross/constants.py +++ b/source/brailleDisplayDrivers/albatross/constants.py @@ -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 +""" diff --git a/source/brailleDisplayDrivers/albatross/driver.py b/source/brailleDisplayDrivers/albatross/driver.py index 18e21a1381c..86adf23ad72 100644 --- a/source/brailleDisplayDrivers/albatross/driver.py +++ b/source/brailleDisplayDrivers/albatross/driver.py @@ -26,7 +26,6 @@ Lock, ) from typing import ( - Iterator, List, Optional, Tuple, @@ -61,6 +60,8 @@ END_BYTE, BOTH_BYTES, KC_INTERVAL, + BUS_DEVICE_DESC, + VID_AND_PID, ) from .gestures import _gestureMap @@ -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 @@ -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 diff --git a/user_docs/en/changes.t2t b/user_docs/en/changes.t2t index 78c12b95dea..7f55b7b5cb4 100644 --- a/user_docs/en/changes.t2t +++ b/user_docs/en/changes.t2t @@ -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)