Skip to content

Add remote/local handling for VXI-11 and HiSLIP - #636

Merged
MatthieuDartiailh merged 12 commits into
pyvisa:mainfrom
hb020:vxi11-remote-local
Aug 26, 2026
Merged

Add remote/local handling for VXI-11 and HiSLIP#636
MatthieuDartiailh merged 12 commits into
pyvisa:mainfrom
hb020:vxi11-remote-local

Conversation

@hb020

@hb020 hb020 commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

A not so easy merge will be needed between this PR and #633 and potentially also #626

The order of the merges is not important, but I'll need to adapt the code between them. Unless you want to merge them all in one PR.

#626 is the lowest priority of the 3 to me.

@codecov

codecov Bot commented Aug 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 44.78%. Comparing base (4d66a18) to head (1141ec3).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #636      +/-   ##
==========================================
+ Coverage   44.19%   44.78%   +0.59%     
==========================================
  Files          30       31       +1     
  Lines        5410     5468      +58     
  Branches      531      534       +3     
==========================================
+ Hits         2391     2449      +58     
  Misses       2987     2987              
  Partials       32       32              
Flag Coverage Δ
unittests 44.78% <100.00%> (+0.59%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@MatthieuDartiailh MatthieuDartiailh left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we add all the required pieces at the protocol level but missed the high level bits... Thanks for the PR !!!

Comment thread docs/source/faq.rst Outdated
deassert_gtl goto local disable remote, goto local
================ =========== =========================================

This is fully conform to what NI-VISA does.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Parity with NI-VISA is good but did you check the visa specs ? Some of the above are a bit surprising for VXI-11 (LLO that works but does not lock is weird).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 rules:

RULE 6.5.6
An INSTR resource implementation of viGpibControlREN() for a TCPIP System SHALL support the
modes VI_GPIB_REN_DEASSERT_GTL, VI_GPIB_REN_ASSERT_ADDRESS, VI_GPIB_REN_ASSERT_ADRESS_LLO,
and VI_GPIB_REN_ADDRESS_GTL.

OBSERVATION 6.5.1
For a TCPIP device using VXI-11, the modes VI_GPIB_REN_DEASSERT_GTL and
VI_GPIB_REN_ADDRESS_GTL behave identically, putting the device into local mode. Similarly, the modes
VI_GPIB_REN_ASSERT_ADDRESS and VI_GPIB_REN_ASSERT_ADRESS_LLO behave identically, putting the
device into remote mode.

100% conform.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But I'll adapt the faq to mention that

Comment thread pyvisa_py/tcpip.py Outdated
Comment on lines +337 to +345
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,
)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be a module level constant (private and marked Final).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

overriden by later comment

Comment thread pyvisa_py/tcpip.py Outdated
Comment on lines +349 to +357
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]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same, the dict should be a module level constant.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

overriden by later comment

Comment thread pyvisa_py/tcpip.py
# Override parsed to take into account the fact that this class is only used
# for a specific kind of resource
parsed: rname.TCPIPInstr

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

interface should be narrowed to hislip. Instrument here rather than cast in all methods.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

didn't touch that. Not sure how that will play out, since VXI-11 and HiSLIP use the same methodology. I remember seeing it used/abused somewhere. And there are no VXI11 nor HiSLIP versions of TCPIPInstr.

But can be done, as well as the casts. But if I do this here, the hislip event PR will be a mess to merge. Can we keep that till then or after then?

Comment thread pyvisa_py/tcpip.py Outdated
constants.RENLineOperation.deassert,
constants.RENLineOperation.deassert_gtl,
)
if mode not in valid_modes:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could catch the KeyError when looking up the method to avoid 2 look ups.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

Comment thread pyvisa_py/tcpip.py
)


class TCPIPInstrHiSLIP(Session):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This class is used only for hislip so it should not cause issues with vxi-11 to properly type the interface attribute. What issue do you foresee for the event support (apart from less casts) ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, can do it, but I'd prefer to do it after we merged some, as there are quite some overlaps, and I prefer to keep the number of open branches minimal. Let's mark that for a next issue?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine

Comment thread pyvisa_py/tcpip.py Outdated
Comment on lines +338 to +346
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]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The previous comment on making this a module/class constant still applies.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved. I kept the passage from one dict to another (in hislip.py), as this keeps it readable.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment thread pyvisa_py/tcpip.py Outdated
# need to define session_type to make the set_attribute machinery work.
session_type = (constants.InterfaceType.tcpip, "INSTR")

REMOTELOCALOPCODE: Dict[constants.RENLineOperation, str] = {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
REMOTELOCALOPCODE: Dict[constants.RENLineOperation, str] = {
REMOTELOCALOPCODE: Final[dict[constants.RENLineOperation, str]] = {

You may need to import Final from typing.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes! was fighting with that. dict in lowercase.....
Done

Comment thread pyvisa_py/tcpip.py
)


class TCPIPInstrHiSLIP(Session):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine

@hb020

hb020 commented Aug 26, 2026

Copy link
Copy Markdown
Contributor Author

strange, my ruff version (latest on python 3.14) did not complain.

@MatthieuDartiailh MatthieuDartiailh left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 small things.

Comment thread pyvisa_py/tcpip.py Outdated
Comment thread pyvisa_py/tcpip.py Outdated
hb020 and others added 3 commits August 26, 2026 18:47
Co-authored-by: Matthieu Dartiailh <marul@laposte.net>
Co-authored-by: Matthieu Dartiailh <marul@laposte.net>
@MatthieuDartiailh
MatthieuDartiailh merged commit fde650a into pyvisa:main Aug 26, 2026
18 checks passed
@hb020
hb020 deleted the vxi11-remote-local branch August 26, 2026 17:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for remote/local to vxi-11 and hislip

2 participants