pyvisa / pyvisa-py

A pure python PyVISA backend

Home Page:https://pyvisa-py.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[COM] Communication issue loop

LongnoseRob opened this issue · comments

commented

For tests (in pymeasure) I would like to create a Visa-resource pointing to a loop as supported by PySerial.
Is there away to create a VISA resource string point to a serial.serial_for_url("loop://", timeout=0.2) object?

Or would there be another way to create a rm-object for a loop device?


Output of pyvisa-info

Machine Details:
   Platform ID:    Linux-6.4.3-arch1-2-x86_64-with-glibc2.37
   Processor:      

Python:
   Implementation: CPython
   Executable:     /usr/bin/python
   Version:        3.11.3
   Compiler:       GCC 13.1.1 20230429
   Architecture:   ('x86', 64)
   Build:          Jun  5 2023 09:32:32 (#main)
   Unicode:        UCS4

PyVISA Version: 1.13.1.dev29+g55f01db

Backends:
   ivi:
      Version: 1.13.1.dev29+g55f01db (bundled with PyVISA)
      Binary library: Not found
   py:
      Version: 0.7.0
      ASRL INSTR: Available via PySerial (3.5)
      USB INSTR: Available via PyUSB (1.2.1). Backend: libusb1
      USB RAW: Available via PyUSB (1.2.1). Backend: libusb1
      TCPIP INSTR: Available 
         Resource discovery:
         - VXI-11: ok
         - hislip: ok
      TCPIP SOCKET: Available 
      GPIB INSTR: Available via Linux GPIB (b'4.3.5')
      GPIB INTFC: Available via Linux GPIB (b'4.3.5')
      VICP INSTR:
         Please install PyVICP to use this resource type.

Since VISA does not mandate the format of the serial board in the resource name you could use the URL and we could switch to using seiral.serial_for_url by default in PyVISA-py (with a version check). Could you test this solution and make a PR if it turns out ok ?

commented

Thank you for the feedback and the proposal,
let me see if I can get it working and I will open a PR

You basically mean to modify SerialSession.after_parsing() to take serial.searial_for_url arguments?

Basically you can try replacing cls on line 87 by serial.serial_from_url.

commented

Alright let me give it a try over the next days and report back..