diff --git a/doc/configuration.rst b/doc/configuration.rst index d3cb73dc9..2cb90c64f 100644 --- a/doc/configuration.rst +++ b/doc/configuration.rst @@ -1160,6 +1160,7 @@ Arguments: ASRL, TCPIP... - url (str): device identifier on selected resource, e.g. for TCPIP resource + - backend (str): Visa library backend, e.g. '@sim' for pyvisa-sim backend Used by: - `PyVISADriver`_ diff --git a/labgrid/driver/pyvisadriver.py b/labgrid/driver/pyvisadriver.py index 5d3b4b249..044375cc5 100644 --- a/labgrid/driver/pyvisadriver.py +++ b/labgrid/driver/pyvisadriver.py @@ -18,7 +18,7 @@ class PyVISADriver(Driver): def __attrs_post_init__(self): super().__attrs_post_init__() _py_pyvisa_module = import_module('pyvisa') - self._pyvisa_resource_manager = _py_pyvisa_module.ResourceManager() + self._pyvisa_resource_manager = _py_pyvisa_module.ResourceManager(self.pyvisa_resource.backend) self.pyvisa_device = None def on_activate(self): diff --git a/labgrid/resource/pyvisa.py b/labgrid/resource/pyvisa.py index d1a93e89f..2228ea74b 100644 --- a/labgrid/resource/pyvisa.py +++ b/labgrid/resource/pyvisa.py @@ -12,6 +12,8 @@ class PyVISADevice(Resource): Args: type (str): device resource type following the pyVISA resource syntax, e.g. ASRL, TCPIP... url (str): device identifier on selected resource, e.g. for TCPIP resource + backend (str, default=''): Visa library backend, e.g. '@sim' for pyvisa-sim backend """ type = attr.ib(validator=attr.validators.instance_of(str)) url = attr.ib(validator=attr.validators.instance_of(str)) + backend = attr.ib(default='', validator=attr.validators.instance_of(str))