Avoid raw MAC BLE fallback and bump to 0.1.14
Some checks failed
Deploy to GitHub Pages / build (push) Has been cancelled
Deploy to GitHub Pages / deploy (push) Has been cancelled

This commit is contained in:
paul2212
2026-03-07 22:50:57 +01:00
parent 9f191b564a
commit 92a7224774
6 changed files with 37 additions and 4 deletions

View File

@@ -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.14] - 2026-03-07
### Fixed
- Removed BLE fallback to raw MAC string when device resolution fails. The connector now requires a discovered LE device object, avoiding BlueZ BR/EDR misclassification that can cause `br-connection-not-supported`.
## [0.1.13] - 2026-03-07
### Fixed

View File

@@ -98,7 +98,19 @@ async def resolve_ble_target(address: str | None = None):
"""
if address:
device = await BleakScanner.find_device_by_address(address, timeout=8.0)
return device or address
if device is not None:
return device
# Fallback to active scan/match before giving up; do not fall back to
# raw address because BlueZ may then attempt BR/EDR and fail with
# br-connection-not-supported.
devices = await BleakScanner.discover(timeout=8)
for d in devices:
if d.address and d.address.lower() == address.lower():
return d
raise PrinterNotFound(
f"BLE device {address} not found during scan. "
"Ensure printer is on, awake, and in range."
)
devices = await BleakScanner.discover(timeout=8)
for d in devices:
if d.name and any(d.name.startswith(p) for p in PRINTER_NAME_PREFIXES):

View File

@@ -1,5 +1,9 @@
# Changelog
## 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.
## 0.1.13
- Marked BLE service-discovery disconnect errors as retryable (`failed to discover services, device disconnected`), so the add-on retries automatically.

View File

@@ -1,5 +1,5 @@
name: "Fichero Printer"
version: "0.1.13"
version: "0.1.14"
slug: "fichero_printer"
description: "REST API for the Fichero D11s (AiYin) thermal label printer over Bluetooth"
url: "https://git.leuschner.dev/Tobias/Fichero"

View File

@@ -98,7 +98,19 @@ async def resolve_ble_target(address: str | None = None):
"""
if address:
device = await BleakScanner.find_device_by_address(address, timeout=8.0)
return device or address
if device is not None:
return device
# Fallback to active scan/match before giving up; do not fall back to
# raw address because BlueZ may then attempt BR/EDR and fail with
# br-connection-not-supported.
devices = await BleakScanner.discover(timeout=8)
for d in devices:
if d.address and d.address.lower() == address.lower():
return d
raise PrinterNotFound(
f"BLE device {address} not found during scan. "
"Ensure printer is on, awake, and in range."
)
devices = await BleakScanner.discover(timeout=8)
for d in devices:
if d.name and any(d.name.startswith(p) for p in PRINTER_NAME_PREFIXES):

View File

@@ -1,6 +1,6 @@
[project]
name = "fichero-printer"
version = "0.1.13"
version = "0.1.14"
description = "Fichero D11s thermal label printer - BLE CLI tool"
requires-python = ">=3.10"
dependencies = [