diff --git a/CHANGELOG.md b/CHANGELOG.md index e51400f..38336eb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,11 @@ All notable changes to this project are documented in this file. The format is based on Keep a Changelog and this project uses Semantic Versioning. +## [0.1.15] - 2026-03-07 + +### Fixed +- Added BLE recovery path for `br-connection-not-supported`: the connector now forces a fresh LE scan target resolution and retries before returning an error. + ## [0.1.14] - 2026-03-07 ### Fixed diff --git a/fichero/printer.py b/fichero/printer.py index 38773e4..7d44601 100644 --- a/fichero/printer.py +++ b/fichero/printer.py @@ -450,6 +450,7 @@ async def connect( ) last_exc: Exception | None = None + forced_rescan_done = False for attempt in range(1, BLE_CONNECT_RETRIES + 1): try: async with BleakClient(target) as client: @@ -466,8 +467,15 @@ async def connect( except BleakDBusError as exc: msg = str(exc).lower() if "br-connection-not-supported" in msg: + last_exc = exc + if not forced_rescan_done: + forced_rescan_done = True + target = await resolve_ble_target(None) + if attempt < BLE_CONNECT_RETRIES: + await asyncio.sleep(BLE_CONNECT_BACKOFF * attempt) + continue raise PrinterError( - "BLE connection failed (br-connection-not-supported). " + "BLE connection failed (br-connection-not-supported) after LE rescan. " "Try Classic Bluetooth with classic=true and channel=1." ) from exc last_exc = exc diff --git a/fichero_printer/CHANGELOG.md b/fichero_printer/CHANGELOG.md index 62d281c..6dd5bad 100644 --- a/fichero_printer/CHANGELOG.md +++ b/fichero_printer/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 0.1.15 + +- Added a BLE recovery retry for `br-connection-not-supported` that forces fresh LE target resolution from scan results before failing. + ## 0.1.14 - Prevented BLE fallback to raw MAC connects and now require discovered LE device resolution, reducing `br-connection-not-supported` regressions on some BlueZ hosts. diff --git a/fichero_printer/config.yaml b/fichero_printer/config.yaml index a0171a7..f36af81 100644 --- a/fichero_printer/config.yaml +++ b/fichero_printer/config.yaml @@ -1,5 +1,5 @@ name: "Fichero Printer" -version: "0.1.14" +version: "0.1.15" slug: "fichero_printer" description: "REST API for the Fichero D11s (AiYin) thermal label printer over Bluetooth" url: "https://git.leuschner.dev/Tobias/Fichero" diff --git a/fichero_printer/fichero/printer.py b/fichero_printer/fichero/printer.py index 38773e4..7d44601 100644 --- a/fichero_printer/fichero/printer.py +++ b/fichero_printer/fichero/printer.py @@ -450,6 +450,7 @@ async def connect( ) last_exc: Exception | None = None + forced_rescan_done = False for attempt in range(1, BLE_CONNECT_RETRIES + 1): try: async with BleakClient(target) as client: @@ -466,8 +467,15 @@ async def connect( except BleakDBusError as exc: msg = str(exc).lower() if "br-connection-not-supported" in msg: + last_exc = exc + if not forced_rescan_done: + forced_rescan_done = True + target = await resolve_ble_target(None) + if attempt < BLE_CONNECT_RETRIES: + await asyncio.sleep(BLE_CONNECT_BACKOFF * attempt) + continue raise PrinterError( - "BLE connection failed (br-connection-not-supported). " + "BLE connection failed (br-connection-not-supported) after LE rescan. " "Try Classic Bluetooth with classic=true and channel=1." ) from exc last_exc = exc diff --git a/pyproject.toml b/pyproject.toml index 7ce7b9a..4377d02 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "fichero-printer" -version = "0.1.14" +version = "0.1.15" description = "Fichero D11s thermal label printer - BLE CLI tool" requires-python = ">=3.10" dependencies = [