Bug 766

Summary: Device scan doesn't find devices which are opened by PV
Product: PulseView Reporter: whitequark <whitequark>
Component: OtherAssignee: Soeren Apel <soeren>
Status: CONFIRMED ---    
Severity: normal CC: soeren
Priority: Normal    
Version: 0.3.0   
Target Milestone: ---   
Hardware: All   
OS: All   

Description whitequark 2016-03-06 12:35:08 CET
When I run pulseview with DS1104Z connected via USB, it correctly discovers the scope and shows it in the drop down. However, when I click on the dropdown (opening the "Connect to device" dialog), select "Rigol DS" and click "Scan", no devices are found. The log gains these messages after clicking "Scan":

sr: [02:33.988650] hwdriver: sr_config_list(): key 2147418112 (NULL) sdi (nil) cg NULL -> [uint32 20000, 20001]
sr: [02:33.988752] hwdriver: Scan of 'rigol-ds' found 0 devices.

Previously, it has found a rigol-ds device as follows:

sr: [00:00.383854] hwdriver: Initializing driver 'rigol-ds'.
sr: [00:00.383920] scpi_usbtmc: Found USBTMC device (VID:PID = 1ab1:04ce, bus.address = 2.14).
sr: [00:00.383944] scpi_usbtmc: Found 1 device(s).
sr: [00:00.383969] scpi: Opening USBTMC device usbtmc/2.14.
sr: [00:00.384033] usb: Trying to find USB device with bus.address = 2.14.
sr: [00:00.384054] usb: Found USB device (VID:PID = 1ab1:04ce, bus.address = 2.14).
sr: [00:00.384069] usb: Found 1 device(s).
sr: [00:00.384084] usb: Trying to open USB device 2.14.
sr: [00:00.384111] usb: Opened USB device (VID:PID = 1ab1:04ce, bus.address = 2.14).
sr: [00:00.384130] scpi_usbtmc: Interface 0 configuration 1.
sr: [00:00.384143] scpi_usbtmc: Interrupt EP 1
sr: [00:00.384154] scpi_usbtmc: Bulk IN EP 2
sr: [00:00.384165] scpi_usbtmc: Bulk OUT EP 3
sr: [00:00.384570] scpi_usbtmc: Device capabilities: SCPI, L4, T6, SR1, RL1, DT1
sr: [00:00.384604] scpi_usbtmc: Locking out local control.
sr: [00:00.384905] scpi_usbtmc: Successfully sent SCPI command: '*IDN?'.
sr: [00:00.448100] scpi: Got response: 'RIGOL TECHNOLOGIES,DS1104Z,DS1ZA161951790,00.04.03.SP2', length 54.
sr: [00:00.448131] scpi: Got IDN string: 'RIGOL TECHNOLOGIES,DS1104Z,DS1ZA161951790,00.04.03.SP2'
sr: [00:00.448198] scpi_usbtmc: Returning local control.
sr: [00:00.448877] usb: Closed USB device 2.14.
sr: [00:00.448940] hwdriver: Scan of 'rigol-ds' found 1 devices.
Comment 1 Soeren Apel 2016-04-17 22:08:14 CEST
Was able to reproduce using my USBTMC scope:

sr: [00:03.478391] hwdriver: sr_config_list(): key 2147418112 (NULL) sdi (nil) cg NULL -> [uint32 20000]
sr: [00:05.079197] scpi_usbtmc: Found USBTMC device (VID:PID = 0b21:0030, bus.address = 2.11).
sr: [00:05.079266] scpi_usbtmc: Found 1 device(s).
sr: [00:05.079285] scpi: Opening USBTMC device usbtmc/2.11.
sr: [00:05.079368] usb: Trying to find USB device with bus.address = 2.11.
sr: [00:05.079401] usb: Found USB device (VID:PID = 0b21:0030, bus.address = 2.11).
sr: [00:05.079424] usb: Found 1 device(s).
sr: [00:05.079443] usb: Trying to open USB device 2.11.
sr: [00:05.079528] usb: Opened USB device (VID:PID = 0b21:0030, bus.address = 2.11).
sr: [00:05.079547] scpi_usbtmc: Interface 0 configuration 1.
sr: [00:05.079559] scpi_usbtmc: Bulk OUT EP 1
sr: [00:05.079587] scpi_usbtmc: Interrupt EP 2
sr: [00:05.079598] scpi_usbtmc: Bulk IN EP 3
sr: [00:05.079682] scpi_usbtmc: Failed to claim interface: LIBUSB_ERROR_BUSY.
sr: [00:05.079695] scpi: Couldn't open SCPI device.

It's pretty reasonable to assume that a device that has been opened by PV (to perform aquisition at any time) can't be scanned as that would require opening the device.

Not quite sure what's the best way to handle this at the moment.