Fix FeatureNotSupported crash on pending CenturionReceiver

When a pending (deferred-init) CenturionReceiver has no discovered
features, accessing receiver.firmware triggers get_firmware_centurion
which calls feature_request. With an empty feature list, feature_request
raises FeatureNotSupported — but passes a positional arg to KwException
which only accepts **kwargs, producing a TypeError.

Two fixes:
- Guard firmware property with `not self._pending` so it skips fetch
  when features haven't been discovered yet
- Fix FeatureNotSupported raise to use keyword argument
This commit is contained in:
Ken Sanislo 2026-04-16 09:35:57 -07:00
parent e91cbff361
commit 5fddfb67ea
1 changed files with 2 additions and 2 deletions

View File

@ -317,7 +317,7 @@ class CenturionReceiver:
if feat_id == feature_int:
request_id = (index << 8) | (function & 0xFF)
return self.request(request_id, *params, no_reply=no_reply)
raise exceptions.FeatureNotSupported(feature)
raise exceptions.FeatureNotSupported(feature=feature)
def _discover_dongle_features(self):
"""Independently discover features on the dongle hardware."""
@ -361,7 +361,7 @@ class CenturionReceiver:
@property
def firmware(self):
if self._firmware is None and self.handle:
if self._firmware is None and self.handle and not self._pending:
self._firmware = get_firmware_centurion(self)
return self._firmware or ()