Retry BLE with fresh LE scan on br-connection-not-supported (0.1.15)
This commit is contained in:
@@ -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.
|
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
|
## [0.1.14] - 2026-03-07
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|||||||
@@ -450,6 +450,7 @@ async def connect(
|
|||||||
)
|
)
|
||||||
|
|
||||||
last_exc: Exception | None = None
|
last_exc: Exception | None = None
|
||||||
|
forced_rescan_done = False
|
||||||
for attempt in range(1, BLE_CONNECT_RETRIES + 1):
|
for attempt in range(1, BLE_CONNECT_RETRIES + 1):
|
||||||
try:
|
try:
|
||||||
async with BleakClient(target) as client:
|
async with BleakClient(target) as client:
|
||||||
@@ -466,8 +467,15 @@ async def connect(
|
|||||||
except BleakDBusError as exc:
|
except BleakDBusError as exc:
|
||||||
msg = str(exc).lower()
|
msg = str(exc).lower()
|
||||||
if "br-connection-not-supported" in msg:
|
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(
|
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."
|
"Try Classic Bluetooth with classic=true and channel=1."
|
||||||
) from exc
|
) from exc
|
||||||
last_exc = exc
|
last_exc = exc
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
# Changelog
|
# 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
|
## 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.
|
- Prevented BLE fallback to raw MAC connects and now require discovered LE device resolution, reducing `br-connection-not-supported` regressions on some BlueZ hosts.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
name: "Fichero Printer"
|
name: "Fichero Printer"
|
||||||
version: "0.1.14"
|
version: "0.1.15"
|
||||||
slug: "fichero_printer"
|
slug: "fichero_printer"
|
||||||
description: "REST API for the Fichero D11s (AiYin) thermal label printer over Bluetooth"
|
description: "REST API for the Fichero D11s (AiYin) thermal label printer over Bluetooth"
|
||||||
url: "https://git.leuschner.dev/Tobias/Fichero"
|
url: "https://git.leuschner.dev/Tobias/Fichero"
|
||||||
|
|||||||
@@ -450,6 +450,7 @@ async def connect(
|
|||||||
)
|
)
|
||||||
|
|
||||||
last_exc: Exception | None = None
|
last_exc: Exception | None = None
|
||||||
|
forced_rescan_done = False
|
||||||
for attempt in range(1, BLE_CONNECT_RETRIES + 1):
|
for attempt in range(1, BLE_CONNECT_RETRIES + 1):
|
||||||
try:
|
try:
|
||||||
async with BleakClient(target) as client:
|
async with BleakClient(target) as client:
|
||||||
@@ -466,8 +467,15 @@ async def connect(
|
|||||||
except BleakDBusError as exc:
|
except BleakDBusError as exc:
|
||||||
msg = str(exc).lower()
|
msg = str(exc).lower()
|
||||||
if "br-connection-not-supported" in msg:
|
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(
|
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."
|
"Try Classic Bluetooth with classic=true and channel=1."
|
||||||
) from exc
|
) from exc
|
||||||
last_exc = exc
|
last_exc = exc
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "fichero-printer"
|
name = "fichero-printer"
|
||||||
version = "0.1.14"
|
version = "0.1.15"
|
||||||
description = "Fichero D11s thermal label printer - BLE CLI tool"
|
description = "Fichero D11s thermal label printer - BLE CLI tool"
|
||||||
requires-python = ">=3.10"
|
requires-python = ">=3.10"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
|||||||
Reference in New Issue
Block a user