TsuITOAR / visa-rs

High-level Rust bindings to VISA(Virtual Instrument Software Architecture)
Apache License 2.0
18 stars 4 forks source link

Encountered in some computers while in use: ErrorRsrcNfound: Insufficient location information or the device or resource is not present in the system #23

Open zengyuhan503 opened 4 months ago

zengyuhan503 commented 4 months ago

hi I am now experiencing an error that says I did not find the relevant resource, This occurs when only KS drivers exist in some PCS and when both drivers exist in some PCS:ErrorRsrcNfound: Insufficient location information or the device or resource is not present in the system.

This error occurred when I was trying to find the resource, and my code is as follows:


pub fn new(chn: String,instr_ip:String) -> Result<Self, String> {
        let rm = RESOURCE_DEFAULTRM.lock().map_err(|e| format!("{:?}", e))?;
        let ip_s = format!("TCPIP0::{}::inst0::INSTR", instr_ip);
        let expr = CString::new(ip_s)
            .map_err(|err| format!("{:?}", err))?
            .into();

        let rsc = rm.find_res(&expr).map_err(|op| format!("{:?}", op))?;

        let instr = rm
            .open(&rsc, AccessMode::NO_LOCK, TIMEOUT_IMMEDIATE)
            .map_err(|op| format!("{:?}", op))?;
        Ok(Self { instr, chn })
    }

I wonder if visa_rs can specify drivers that use KS or Ni, such as python's visa.resourceManager method

TsuITOAR commented 4 months ago

Hi! Currently, the driver can be specified only at compile time, by the path of visa64.lib set in LIB_VISA_PATH. Different drivers should be placed at separate folders, in C:\Program Files (x86)\IVI Foundation\VISA\WinNT on Windows. Based on my experience, you can try to connect the resource in Keysight Connection Expert GUI. If the GUI can do, visa-rs should work as well.

TsuITOAR commented 2 months ago

Hi, does your problem solved? Let me know if you want more help!