pyvisa/pyvisa-py

[COM] Communication issue with Siglent SPS5051X using Ubuntu VM

ragrylesvani opened this issue · 5 comments

In the past I was able to get python to derive a lot of information about the connected device (such as Manufacturer ID), but now pyvisa-py fails to identify anything about the device other than the bare basics.

image

PyUSB seems to be able to derive this information, and so is the Linux OS. I am wondering if there is an issue with how the Resource Class in instantiated, or how/why there is a failure to propagate this infromation up into pyvisa-py?

Python 3.8.0 (default, Dec  9 2021, 17:53:27) 
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import usb.core
>>> dev = usb.core.find(find_all=True)
>>> for cfg in dev:
...  print('Decimal VendorID=' + str(cfg.idVendor) + ' & ProductID=' + str(cfg.idProduct))
...  print('Hexadecimal VendorID=' + hex(cfg.idVendor) + ' & ProductID=' + hex(cfg.idProduct))
... 
Decimal VendorID=62700 & ProductID=5203
Hexadecimal VendorID=0xf4ec & ProductID=0x1453

Instrument details

Output of pyvisa-info

Machine Details:
Platform ID: Linux-5.4.0-135-generic-x86_64-with-glibc2.27
Processor: x86_64

Python:
Implementation: CPython
Executable: ...bin/python
Version: 3.8.0
Compiler: GCC 8.4.0
Bits: 64bit
Build: Dec 9 2021 17:53:27 (#default)
Unicode: UCS4

PyVISA Version: 1.13.0

Backends:
ivi:
Version: 1.13.0 (bundled with PyVISA)
Binary library: Not found
py:
Version: 0.7.0
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: partial (psutil not installed)
- hislip: disabled (zeroconf not installed)
TCPIP SOCKET: Available
ASRL INSTR:
Please install PySerial (>=3.0) to use this resource type.
No module named 'serial'
VICP INSTR:
Please install PyVICP to use this resource type.
GPIB INSTR:
Please install linux-gpib (Linux) or gpib-ctypes (Windows, Linux) to use this resource type. Note that installing gpib-ctypes will give you access to a broader range of functionalities.
No module named 'gpib'
GPIB INTFC:
Please install linux-gpib (Linux) or gpib-ctypes (Windows, Linux) to use this resource type. Note that installing gpib-ctypes will give you access to a broader range of functionalities.
No module named 'gpib'

I need to double-check the code, but right now, I suspect that the issue comes from the resource name looking weird (::0 before the INSTR). Typically the device manufacturer and device ID are not read from the bus since they are part of the resource name, but since here the name looks odd it may not have been parsed properly.

How did you obtain that resource name ?

So it seems I was wrong and the attributes are simply not set. #399 should fix the issue. Could you test ? I have no instrument on hand to test.

To answer your question, I got the resource name by listing the connected devices through the pyvisa-shell. To my understanding, that is how pyvisa has stored that name for itself locally.

I will try my hand at testing these changes and get back with any results.

It seems the change is successful in populating the aforementioned fields.

image

Thank you for working on this!

I will merge and try to release soon