Retry BLE with fresh LE scan on br-connection-not-supported (0.1.15)
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user