From f6adc8c4659ad3bb473150b5944a1e22a4006090 Mon Sep 17 00:00:00 2001 From: hans boot Date: Wed, 26 Aug 2026 12:28:44 +0200 Subject: [PATCH 01/12] support vxi-11 remote/local --- CHANGES | 1 + docs/source/faq.rst | 25 +++++++++++ pyvisa_py/tcpip.py | 42 +++++++++++++++++ pyvisa_py/testsuite/test_remote_local.py | 57 ++++++++++++++++++++++++ 4 files changed, 125 insertions(+) create mode 100644 pyvisa_py/testsuite/test_remote_local.py diff --git a/CHANGES b/CHANGES index 6506b682..73efc3e4 100644 --- a/CHANGES +++ b/CHANGES @@ -4,6 +4,7 @@ PyVISA-py Changelog 0.9.0 (unreleased) ------------------ +- VXI-11 and HiSLIP: add support for remote/local #627 PR #??? - A VXI-11 read stopped by both the END indicator and the termination character now reports ``VI_SUCCESS`` rather than ``VI_SUCCESS_TERM_CHAR``. VPP-4.3 RULE 6.1.1 gives END priority over the diff --git a/docs/source/faq.rst b/docs/source/faq.rst index 1b4db1c9..f2893a53 100644 --- a/docs/source/faq.rst +++ b/docs/source/faq.rst @@ -181,6 +181,31 @@ omit the argument. wait on a lock". Set ``lock_timeout`` on the session for that, as in the DM3068 example above. +Remote/Local control +-------------------- + +Setting an instrument to Remote or Local is possible via VXI-11, HiSLIP and GPIB. + +In PyVISA, this is done through ``inst.control_ren(pyvisa.constants.RENLineOperation.{op})`` +where valid ``{op}`` values are: + +================ =========== ========================================= +RENLineOperation VXI-11 HiSLIP +================ =========== ========================================= +address_gtl goto local goto local, no change to remote enable +asrt error enable remote +asrt_address goto remote enable remote, goto remote +asrt_address_llo goto remote enable remote, goto remote, local lockout +asrt_llo error enable remote, local lockout +deassert error disable remote +deassert_gtl goto local disable remote, goto local +================ =========== ========================================= + +This is fully conform to what NI-VISA does. + +GPIB has functionality comparable to HiSLIP, but may behave differently than NI-VISA, +depending on the type of interface. + .. _PySerial: https://pythonhosted.org/pyserial/ .. _PyVISA: http://pyvisa.readthedocs.org/ diff --git a/pyvisa_py/tcpip.py b/pyvisa_py/tcpip.py index f6287171..bd3305bd 100644 --- a/pyvisa_py/tcpip.py +++ b/pyvisa_py/tcpip.py @@ -853,6 +853,48 @@ def write(self, data: bytes) -> Tuple[int, StatusCode]: except vxi11.Vxi11Error: return 0, StatusCode.error_timeout + def gpib_control_ren(self, mode: constants.RENLineOperation) -> StatusCode: + """Controls the state of the GPIB Remote Enable (REN) interface line. + + Optionally the remote/local state of the device is also controlled. + + Corresponds to viGpibControlREN function of the VISA library. + + Parameters + ---------- + mode : constants.RENLineOperation + Specifies the state of the REN line and optionally the device + remote/local state. + + Returns + ------- + StatusCode + Return value of the library call. + + """ + if mode not in ( + constants.RENLineOperation.address_gtl, + constants.RENLineOperation.asrt_address, + constants.RENLineOperation.asrt_address_llo, + constants.RENLineOperation.deassert_gtl + ): + return constants.StatusCode.error_nonsupported_operation + + if mode in ( + constants.RENLineOperation.asrt_address, + constants.RENLineOperation.asrt_address_llo + ): + error = self.interface.device_remote( + self.link, 0, self.lock_timeout, self._io_timeout + ) + else: + error = self.interface.device_local( + self.link, 0, self.lock_timeout, self._io_timeout + ) + + return VXI11_ERRORS_TO_VISA[error] + + def _get_attribute(self, attribute: ResourceAttribute) -> Tuple[Any, StatusCode]: """Get the value for a given VISA attribute for this session. diff --git a/pyvisa_py/testsuite/test_remote_local.py b/pyvisa_py/testsuite/test_remote_local.py new file mode 100644 index 00000000..481ef728 --- /dev/null +++ b/pyvisa_py/testsuite/test_remote_local.py @@ -0,0 +1,57 @@ +# -*- coding: utf-8 -*- +"""Unit tests for VXI11 and hislip remote/local operations.""" + +from __future__ import annotations + +from unittest.mock import MagicMock + +import pytest + +from pyvisa import constants +from pyvisa_py.tcpip import TCPIPInstrVxi11 + + +@pytest.mark.parametrize( + "mode, expected_method", + [ + (constants.RENLineOperation.address_gtl, "device_local"), + (constants.RENLineOperation.asrt_address, "device_remote"), + (constants.RENLineOperation.asrt_address_llo, "device_remote"), + (constants.RENLineOperation.deassert_gtl, "device_local"), + ], +) +def test_vxi11_gpib_control_ren_calls_expected_device_method(mode, expected_method): + session = object.__new__(TCPIPInstrVxi11) + session.interface = MagicMock() + session.link = 7 + session.lock_timeout = 1234 + session._io_timeout = 5678 + + session.interface.device_local.return_value = 0 + session.interface.device_remote.return_value = 0 + + assert session.gpib_control_ren(mode) == constants.StatusCode.success + + getattr(session.interface, expected_method).assert_called_once_with( + session.link, 0, session.lock_timeout, session._io_timeout + ) + + if expected_method == "device_remote": + session.interface.device_local.assert_not_called() + else: + session.interface.device_remote.assert_not_called() + + +@pytest.mark.parametrize("invalid_mode", [-1, 999, "bogus", None, object()]) +def test_vxi11_gpib_control_ren_rejects_unsupported_modes(invalid_mode): + session = object.__new__(TCPIPInstrVxi11) + session.interface = MagicMock() + session.link = 7 + session.lock_timeout = 1234 + session._io_timeout = 5678 + + assert session.gpib_control_ren(invalid_mode) == ( + constants.StatusCode.error_nonsupported_operation + ) + session.interface.device_local.assert_not_called() + session.interface.device_remote.assert_not_called() From c193bc31bee46994df969feb747697908ce0c243 Mon Sep 17 00:00:00 2001 From: hans boot Date: Wed, 26 Aug 2026 13:13:14 +0200 Subject: [PATCH 02/12] add hislip --- pyvisa_py/tcpip.py | 46 ++++++++++++++++++++++++ pyvisa_py/testsuite/test_remote_local.py | 39 +++++++++++++++++++- 2 files changed, 84 insertions(+), 1 deletion(-) diff --git a/pyvisa_py/tcpip.py b/pyvisa_py/tcpip.py index bd3305bd..b88d1136 100644 --- a/pyvisa_py/tcpip.py +++ b/pyvisa_py/tcpip.py @@ -314,6 +314,52 @@ def write(self, data: bytes) -> Tuple[int, StatusCode]: self.interface.send(data) return len(data), StatusCode.success + + def gpib_control_ren(self, mode: constants.RENLineOperation) -> StatusCode: + """Controls the state of the GPIB Remote Enable (REN) interface line. + + Optionally the remote/local state of the device is also controlled. + + Corresponds to viGpibControlREN function of the VISA library. + + Parameters + ---------- + mode : constants.RENLineOperation + Specifies the state of the REN line and optionally the device + remote/local state. + + Returns + ------- + StatusCode + Return value of the library call. + + """ + valid_modes = ( + constants.RENLineOperation.address_gtl, + constants.RENLineOperation.asrt, + constants.RENLineOperation.asrt_address, + constants.RENLineOperation.asrt_address_llo, + constants.RENLineOperation.asrt_llo, + constants.RENLineOperation.deassert, + constants.RENLineOperation.deassert_gtl, + ) + if mode not in valid_modes: + return StatusCode.error_nonsupported_operation + + method = { + constants.RENLineOperation.address_gtl: "justGTL", + constants.RENLineOperation.asrt: "enableRemote", + constants.RENLineOperation.asrt_address: "enableAndGotoRemote", + constants.RENLineOperation.asrt_address_llo: "enableAndGTRLLO", + constants.RENLineOperation.asrt_llo: "enableAndLockoutLocal", + constants.RENLineOperation.deassert: "disableRemote", + constants.RENLineOperation.deassert_gtl: "disableAndGTL", + }[mode] + + interface = cast(hislip.Instrument, self.interface) + interface.async_remote_local_control(method) + + return StatusCode.success def clear(self) -> StatusCode: """Clears a device. diff --git a/pyvisa_py/testsuite/test_remote_local.py b/pyvisa_py/testsuite/test_remote_local.py index 481ef728..fc4b65ca 100644 --- a/pyvisa_py/testsuite/test_remote_local.py +++ b/pyvisa_py/testsuite/test_remote_local.py @@ -8,7 +8,7 @@ import pytest from pyvisa import constants -from pyvisa_py.tcpip import TCPIPInstrVxi11 +from pyvisa_py.tcpip import TCPIPInstrHiSLIP, TCPIPInstrVxi11 @pytest.mark.parametrize( @@ -55,3 +55,40 @@ def test_vxi11_gpib_control_ren_rejects_unsupported_modes(invalid_mode): ) session.interface.device_local.assert_not_called() session.interface.device_remote.assert_not_called() + + +@pytest.mark.parametrize( + "mode, expected_method", + [ + (constants.RENLineOperation.address_gtl, "justGTL"), + (constants.RENLineOperation.asrt, "enableRemote"), + (constants.RENLineOperation.asrt_address, "enableAndGotoRemote"), + (constants.RENLineOperation.asrt_address_llo, "enableAndGTRLLO"), + (constants.RENLineOperation.asrt_llo, "enableAndLockoutLocal"), + (constants.RENLineOperation.deassert, "disableRemote"), + (constants.RENLineOperation.deassert_gtl, "disableAndGTL"), + ], +) +def test_hislip_gpib_control_ren_calls_expected_interface_method( + mode, expected_method +): + session = object.__new__(TCPIPInstrHiSLIP) + session.interface = MagicMock() + + assert session.gpib_control_ren(mode) == constants.StatusCode.success + session.interface.async_remote_local_control.assert_called_once_with( + expected_method + ) + + +@pytest.mark.parametrize("invalid_mode", [-1, 999, "bogus", None, object()]) +def test_hislip_gpib_control_ren_rejects_unsupported_modes(invalid_mode): + session = object.__new__(TCPIPInstrHiSLIP) + session.interface = MagicMock() + + assert session.gpib_control_ren(invalid_mode) == ( + constants.StatusCode.error_nonsupported_operation + ) + session.interface.async_remote_local_control.assert_not_called() + + From bb07dfa4f2af9c7d1705d307d2c385d1097d727d Mon Sep 17 00:00:00 2001 From: hans boot Date: Wed, 26 Aug 2026 13:18:02 +0200 Subject: [PATCH 03/12] ran precommit --- pyvisa_py/tcpip.py | 7 +++---- pyvisa_py/testsuite/test_remote_local.py | 6 +----- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/pyvisa_py/tcpip.py b/pyvisa_py/tcpip.py index b88d1136..22d219fa 100644 --- a/pyvisa_py/tcpip.py +++ b/pyvisa_py/tcpip.py @@ -314,7 +314,7 @@ def write(self, data: bytes) -> Tuple[int, StatusCode]: self.interface.send(data) return len(data), StatusCode.success - + def gpib_control_ren(self, mode: constants.RENLineOperation) -> StatusCode: """Controls the state of the GPIB Remote Enable (REN) interface line. @@ -922,13 +922,13 @@ def gpib_control_ren(self, mode: constants.RENLineOperation) -> StatusCode: constants.RENLineOperation.address_gtl, constants.RENLineOperation.asrt_address, constants.RENLineOperation.asrt_address_llo, - constants.RENLineOperation.deassert_gtl + constants.RENLineOperation.deassert_gtl, ): return constants.StatusCode.error_nonsupported_operation if mode in ( constants.RENLineOperation.asrt_address, - constants.RENLineOperation.asrt_address_llo + constants.RENLineOperation.asrt_address_llo, ): error = self.interface.device_remote( self.link, 0, self.lock_timeout, self._io_timeout @@ -940,7 +940,6 @@ def gpib_control_ren(self, mode: constants.RENLineOperation) -> StatusCode: return VXI11_ERRORS_TO_VISA[error] - def _get_attribute(self, attribute: ResourceAttribute) -> Tuple[Any, StatusCode]: """Get the value for a given VISA attribute for this session. diff --git a/pyvisa_py/testsuite/test_remote_local.py b/pyvisa_py/testsuite/test_remote_local.py index fc4b65ca..4e81f867 100644 --- a/pyvisa_py/testsuite/test_remote_local.py +++ b/pyvisa_py/testsuite/test_remote_local.py @@ -69,9 +69,7 @@ def test_vxi11_gpib_control_ren_rejects_unsupported_modes(invalid_mode): (constants.RENLineOperation.deassert_gtl, "disableAndGTL"), ], ) -def test_hislip_gpib_control_ren_calls_expected_interface_method( - mode, expected_method -): +def test_hislip_gpib_control_ren_calls_expected_interface_method(mode, expected_method): session = object.__new__(TCPIPInstrHiSLIP) session.interface = MagicMock() @@ -90,5 +88,3 @@ def test_hislip_gpib_control_ren_rejects_unsupported_modes(invalid_mode): constants.StatusCode.error_nonsupported_operation ) session.interface.async_remote_local_control.assert_not_called() - - From a247d281a0ef068801b18d69e85ee09934ad9b60 Mon Sep 17 00:00:00 2001 From: hans boot Date: Wed, 26 Aug 2026 13:19:54 +0200 Subject: [PATCH 04/12] add PR number --- CHANGES | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index 73efc3e4..5573055c 100644 --- a/CHANGES +++ b/CHANGES @@ -4,7 +4,7 @@ PyVISA-py Changelog 0.9.0 (unreleased) ------------------ -- VXI-11 and HiSLIP: add support for remote/local #627 PR #??? +- VXI-11 and HiSLIP: add support for remote/local #627 PR #636 - A VXI-11 read stopped by both the END indicator and the termination character now reports ``VI_SUCCESS`` rather than ``VI_SUCCESS_TERM_CHAR``. VPP-4.3 RULE 6.1.1 gives END priority over the From df50cfb91d412540b7f1ec39c06b7c221a711516 Mon Sep 17 00:00:00 2001 From: hans boot Date: Wed, 26 Aug 2026 15:16:06 +0200 Subject: [PATCH 05/12] after review --- docs/source/faq.rst | 3 ++- pyvisa_py/tcpip.py | 32 ++++++++++++-------------------- 2 files changed, 14 insertions(+), 21 deletions(-) diff --git a/docs/source/faq.rst b/docs/source/faq.rst index f2893a53..6675a8de 100644 --- a/docs/source/faq.rst +++ b/docs/source/faq.rst @@ -201,7 +201,8 @@ deassert error disable remote deassert_gtl goto local disable remote, goto local ================ =========== ========================================= -This is fully conform to what NI-VISA does. +This is fully conform to what VPP-4.3 Rule 6.5.6 and Observations 6.5.1 + 6.5.2 say, +and what NI-VISA does, so this should be fully portable. GPIB has functionality comparable to HiSLIP, but may behave differently than NI-VISA, depending on the type of interface. diff --git a/pyvisa_py/tcpip.py b/pyvisa_py/tcpip.py index 22d219fa..cabf0940 100644 --- a/pyvisa_py/tcpip.py +++ b/pyvisa_py/tcpip.py @@ -334,28 +334,20 @@ def gpib_control_ren(self, mode: constants.RENLineOperation) -> StatusCode: Return value of the library call. """ - valid_modes = ( - constants.RENLineOperation.address_gtl, - constants.RENLineOperation.asrt, - constants.RENLineOperation.asrt_address, - constants.RENLineOperation.asrt_address_llo, - constants.RENLineOperation.asrt_llo, - constants.RENLineOperation.deassert, - constants.RENLineOperation.deassert_gtl, - ) - if mode not in valid_modes: + try: + method = { + constants.RENLineOperation.address_gtl: "justGTL", + constants.RENLineOperation.asrt: "enableRemote", + constants.RENLineOperation.asrt_address: "enableAndGotoRemote", + constants.RENLineOperation.asrt_address_llo: "enableAndGTRLLO", + constants.RENLineOperation.asrt_llo: "enableAndLockoutLocal", + constants.RENLineOperation.deassert: "disableRemote", + constants.RENLineOperation.deassert_gtl: "disableAndGTL", + }[mode] + except: + # unknown value? return StatusCode.error_nonsupported_operation - method = { - constants.RENLineOperation.address_gtl: "justGTL", - constants.RENLineOperation.asrt: "enableRemote", - constants.RENLineOperation.asrt_address: "enableAndGotoRemote", - constants.RENLineOperation.asrt_address_llo: "enableAndGTRLLO", - constants.RENLineOperation.asrt_llo: "enableAndLockoutLocal", - constants.RENLineOperation.deassert: "disableRemote", - constants.RENLineOperation.deassert_gtl: "disableAndGTL", - }[mode] - interface = cast(hislip.Instrument, self.interface) interface.async_remote_local_control(method) From b911d9bf1bd7d1ba07594d3c2728f56b3a436c92 Mon Sep 17 00:00:00 2001 From: hans boot Date: Wed, 26 Aug 2026 15:23:44 +0200 Subject: [PATCH 06/12] ruff adapt --- pyvisa_py/tcpip.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyvisa_py/tcpip.py b/pyvisa_py/tcpip.py index cabf0940..f48e96f6 100644 --- a/pyvisa_py/tcpip.py +++ b/pyvisa_py/tcpip.py @@ -344,7 +344,7 @@ def gpib_control_ren(self, mode: constants.RENLineOperation) -> StatusCode: constants.RENLineOperation.deassert: "disableRemote", constants.RENLineOperation.deassert_gtl: "disableAndGTL", }[mode] - except: + except Exception: # unknown value? return StatusCode.error_nonsupported_operation From 4626260c555d9b045963c82daea2423ec2622fdd Mon Sep 17 00:00:00 2001 From: hans boot Date: Wed, 26 Aug 2026 15:35:38 +0200 Subject: [PATCH 07/12] move dict --- pyvisa_py/tcpip.py | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/pyvisa_py/tcpip.py b/pyvisa_py/tcpip.py index f48e96f6..6c2c69cc 100644 --- a/pyvisa_py/tcpip.py +++ b/pyvisa_py/tcpip.py @@ -112,6 +112,16 @@ class TCPIPInstrHiSLIP(Session): # need to define session_type to make the set_attribute machinery work. session_type = (constants.InterfaceType.tcpip, "INSTR") + REMOTELOCALOPCODE: Dict[constants.RENLineOperation, str] = { + constants.RENLineOperation.address_gtl: "justGTL", + constants.RENLineOperation.asrt: "enableRemote", + constants.RENLineOperation.asrt_address: "enableAndGotoRemote", + constants.RENLineOperation.asrt_address_llo: "enableAndGTRLLO", + constants.RENLineOperation.asrt_llo: "enableAndLockoutLocal", + constants.RENLineOperation.deassert: "disableRemote", + constants.RENLineOperation.deassert_gtl: "disableAndGTL", + } + # Override parsed to take into account the fact that this class is only used # for a specific kind of resource parsed: rname.TCPIPInstr @@ -335,15 +345,7 @@ def gpib_control_ren(self, mode: constants.RENLineOperation) -> StatusCode: """ try: - method = { - constants.RENLineOperation.address_gtl: "justGTL", - constants.RENLineOperation.asrt: "enableRemote", - constants.RENLineOperation.asrt_address: "enableAndGotoRemote", - constants.RENLineOperation.asrt_address_llo: "enableAndGTRLLO", - constants.RENLineOperation.asrt_llo: "enableAndLockoutLocal", - constants.RENLineOperation.deassert: "disableRemote", - constants.RENLineOperation.deassert_gtl: "disableAndGTL", - }[mode] + method = self.REMOTELOCALOPCODE[mode] except Exception: # unknown value? return StatusCode.error_nonsupported_operation From a81f2696068c455b797bdcf545c4c21abc7b7562 Mon Sep 17 00:00:00 2001 From: hans boot Date: Wed, 26 Aug 2026 16:21:18 +0200 Subject: [PATCH 08/12] final dict --- pyvisa_py/tcpip.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyvisa_py/tcpip.py b/pyvisa_py/tcpip.py index 6c2c69cc..20e6dca6 100644 --- a/pyvisa_py/tcpip.py +++ b/pyvisa_py/tcpip.py @@ -16,7 +16,7 @@ import threading import time import warnings -from typing import Any, Dict, List, Optional, Tuple, Type, cast +from typing import Any, Dict, List, Optional, Tuple, Type, cast, Final from pyvisa import attributes, constants, errors, rname from pyvisa.constants import BufferOperation, ResourceAttribute, StatusCode @@ -112,7 +112,7 @@ class TCPIPInstrHiSLIP(Session): # need to define session_type to make the set_attribute machinery work. session_type = (constants.InterfaceType.tcpip, "INSTR") - REMOTELOCALOPCODE: Dict[constants.RENLineOperation, str] = { + REMOTELOCALOPCODE: Final[dict[constants.RENLineOperation, str]] = { constants.RENLineOperation.address_gtl: "justGTL", constants.RENLineOperation.asrt: "enableRemote", constants.RENLineOperation.asrt_address: "enableAndGotoRemote", From 35d01df51ae06f9bc65f3c8c955efb7d3e28a711 Mon Sep 17 00:00:00 2001 From: hans boot Date: Wed, 26 Aug 2026 16:22:47 +0200 Subject: [PATCH 09/12] ruff --- pyvisa_py/tcpip.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyvisa_py/tcpip.py b/pyvisa_py/tcpip.py index 20e6dca6..7ff58f80 100644 --- a/pyvisa_py/tcpip.py +++ b/pyvisa_py/tcpip.py @@ -16,7 +16,7 @@ import threading import time import warnings -from typing import Any, Dict, List, Optional, Tuple, Type, cast, Final +from typing import Any, Dict, Final, List, Optional, Tuple, Type, cast from pyvisa import attributes, constants, errors, rname from pyvisa.constants import BufferOperation, ResourceAttribute, StatusCode From f1bc2837946b5d05907ff364c38776f36922ffa1 Mon Sep 17 00:00:00 2001 From: hb020 Date: Wed, 26 Aug 2026 18:47:53 +0200 Subject: [PATCH 10/12] Update pyvisa_py/tcpip.py Co-authored-by: Matthieu Dartiailh --- pyvisa_py/tcpip.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyvisa_py/tcpip.py b/pyvisa_py/tcpip.py index 7ff58f80..92c116ad 100644 --- a/pyvisa_py/tcpip.py +++ b/pyvisa_py/tcpip.py @@ -346,7 +346,7 @@ def gpib_control_ren(self, mode: constants.RENLineOperation) -> StatusCode: """ try: method = self.REMOTELOCALOPCODE[mode] - except Exception: + except KeyError: # unknown value? return StatusCode.error_nonsupported_operation From c4cd59ddc583270da6adf6d50a7e2b1fda4eee37 Mon Sep 17 00:00:00 2001 From: hb020 Date: Wed, 26 Aug 2026 18:48:56 +0200 Subject: [PATCH 11/12] Update pyvisa_py/tcpip.py Co-authored-by: Matthieu Dartiailh --- pyvisa_py/tcpip.py | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/pyvisa_py/tcpip.py b/pyvisa_py/tcpip.py index 92c116ad..4fdcb625 100644 --- a/pyvisa_py/tcpip.py +++ b/pyvisa_py/tcpip.py @@ -912,14 +912,6 @@ def gpib_control_ren(self, mode: constants.RENLineOperation) -> StatusCode: Return value of the library call. """ - if mode not in ( - constants.RENLineOperation.address_gtl, - constants.RENLineOperation.asrt_address, - constants.RENLineOperation.asrt_address_llo, - constants.RENLineOperation.deassert_gtl, - ): - return constants.StatusCode.error_nonsupported_operation - if mode in ( constants.RENLineOperation.asrt_address, constants.RENLineOperation.asrt_address_llo, @@ -927,12 +919,14 @@ def gpib_control_ren(self, mode: constants.RENLineOperation) -> StatusCode: error = self.interface.device_remote( self.link, 0, self.lock_timeout, self._io_timeout ) - else: + return VXI11_ERRORS_TO_VISA[error] + elif mode in (constants.RENLineOperation.address_gtl, constants.RENLineOperation.deassert_gtl): error = self.interface.device_local( self.link, 0, self.lock_timeout, self._io_timeout ) - - return VXI11_ERRORS_TO_VISA[error] + return VXI11_ERRORS_TO_VISA[error] + else: + return constants.StatusCode.error_nonsupported_operation def _get_attribute(self, attribute: ResourceAttribute) -> Tuple[Any, StatusCode]: """Get the value for a given VISA attribute for this session. From 1141ec30d00d285ec3a9c6125a15a64b9305b22a Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 26 Aug 2026 16:49:06 +0000 Subject: [PATCH 12/12] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- pyvisa_py/tcpip.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pyvisa_py/tcpip.py b/pyvisa_py/tcpip.py index 4fdcb625..ed53422a 100644 --- a/pyvisa_py/tcpip.py +++ b/pyvisa_py/tcpip.py @@ -920,7 +920,10 @@ def gpib_control_ren(self, mode: constants.RENLineOperation) -> StatusCode: self.link, 0, self.lock_timeout, self._io_timeout ) return VXI11_ERRORS_TO_VISA[error] - elif mode in (constants.RENLineOperation.address_gtl, constants.RENLineOperation.deassert_gtl): + elif mode in ( + constants.RENLineOperation.address_gtl, + constants.RENLineOperation.deassert_gtl, + ): error = self.interface.device_local( self.link, 0, self.lock_timeout, self._io_timeout )