I am trying to communicate a USB device (power supply, bk 9115) to python a ubuntu machine- 20.04.02.
The company suggested using NI-VISA drivers which are not available for ubuntu machines and I tried using alien to convert rpm drivers to .deb ones, which somehow corrupted my apt-get installer, and I reinstalled ubuntu.
I also tried using PyVisa with the following downloads- PyVisa, PyVisa-py, PyUSB, libusb but when I run the following code I get an empty list.
import pyvisa as visa
rm=visa.ResourceManager('@py') #Remove the '@py' if using Ni-Visa (Windows generally)
li=rm.list_resources()
print(li)
for index in range(len(li)):
print(str(index)+" - "+li[index])
choice = input("Which device?: ")
vi=rm.open_resource(li[int(choice)])
I know the device is recognizable to ubuntu as I see it when I try lsusb, dmesg, as well as
import usb
dev = usb.core.find(find_all = true)
for i in dev:
print('Hex Vendor ID= '+ hex(i.idVendor)+ '& ProductID' = hex(i.idProduct))
It shows the device. We tried running it on a windows machine and it worked fine but the goal is to run it on a ubuntu machine.
What am I missing? Thanks in advance.