diff --git a/docs/supported_instruments.md b/docs/supported_instruments.md index c543196..87398a5 100644 --- a/docs/supported_instruments.md +++ b/docs/supported_instruments.md @@ -236,6 +236,22 @@ the same SCPI command set. --- +## GENERIC (Universal Fallback) + +| Driver | Purpose | Auto-Detect IDN Keywords | +|:---|:---|:---| +| `GenericDriver` | Catch-all driver for unidentified instruments; accepts any model | none (explicit `"GENERIC"` request or unrecognized `*IDN?`) | + +`"GENERIC"` is a first-class, always-registered key in +`DriverRegistry` — `get_drivers_by_type("GENERIC")` always returns +`GenericDriver` (real mode) and `SimulatedGeneric` (SIM mode). It is used +when `connect_instrument()` cannot identify an instrument, or when you +explicitly pass `driver_type="GENERIC"` to `get_instrument()`. It exposes +only generic SCPI passthrough (no typed measurement API), so it is a safe +default, never a silent DMM/SA misread — see issue #148. + +--- + ## Summary | Category | Drivers | Validated Models | diff --git a/src/instrumation/drivers/registry.py b/src/instrumation/drivers/registry.py index ce42118..d5d6e50 100644 --- a/src/instrumation/drivers/registry.py +++ b/src/instrumation/drivers/registry.py @@ -5,7 +5,19 @@ logger = logging.getLogger(__name__) class DriverRegistry: - """Registry to keep track of available instrument drivers.""" + """Registry to keep track of available instrument drivers. + + Drivers register themselves against a canonical instrument *type* key + (e.g. ``"DMM"``, ``"SA"``, ``"SCOPE"``). The full set of known keys is + defined in :data:`instrumation.factory.KNOWN_DRIVER_TYPES`. + + ``"GENERIC"`` is a special, always-registered key: both + :class:`instrumation.drivers.generic.GenericDriver` and + :class:`instrumation.drivers.simulated.SimulatedGeneric` register + against it, so ``get_drivers_by_type("GENERIC")`` never returns an + empty list in a normal import. It is the universal fallback used when + an instrument cannot be identified (see issue #148). + """ # Map of type -> list of driver classes _drivers: Dict[str, List[Type[InstrumentDriver]]] = {}