Test and Measurement Forum

Enumerating Devices while Open

Post any questions you may have about our current range of oscilloscopes

Enumerating Devices while Open

Postby cpede » Fri Dec 23, 2016 9:24 am

I'm using the SDK for a Pico 6402C device using C++.

When calling ps6000EnumerateUnits before anything else it reports correctly my device. If I then opens the device using ps6000OpenUnit I get connection and everything is OK.

If I then call ps6000EnumerateUnits again while my device is open it report 0 devices. I would like to automatically detect when a new device is added (or removed) on the USB port while running my device.

Is it correct that ps6000EnumerateUnits will return 0 is a device is opened, or is there a way to enumerate devices when detecting USB deice changes?

-cpede
cpede
Newbie
 
Posts: 0
Joined: Fri Dec 23, 2016 7:46 am

Re: Enumerating Devices while Open

Postby Martyn » Wed Dec 28, 2016 1:50 pm

If you add another device, that hasn't been opened, does enumerate units return correctly ?
Martyn
Technical Support Manager
Martyn
Site Admin
Site Admin
 
Posts: 2779
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: Enumerating Devices while Open

Postby cpede » Mon Jan 02, 2017 7:38 am

OK, this is not mentioned in the SDK manual.This means, that is should be easy to detect new devices.

What is the correct method for detecting that a device is disconnected a.k.a. the USB cable is unplugged while a device is connected?

-cpede
cpede
Newbie
 
Posts: 0
Joined: Fri Dec 23, 2016 7:46 am

Re: Enumerating Devices while Open

Postby Martyn » Wed Jan 04, 2017 10:27 am

A return code of
Code: Select all
07 PICO_NOT_RESPONDING - The PicoScope 6000 is not responding to commands from the PC.

to any driver call, would indicate a disconnected device.
Martyn
Technical Support Manager
Martyn
Site Admin
Site Admin
 
Posts: 2779
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: Enumerating Devices while Open

Postby cpede » Wed Aug 16, 2017 7:53 am

The more I use this feature, the more I think it is implemented wrong.

ps6000EnumerateUnits should enumerate all devices no matter what, - opened or closed.

It is not logical that ps6000EnumerateUnits return 0, when a device is clearly connected and opened.

The ps6000EnumerateUnits method is often called in a static call, e.g. a thread monitoring the USB connections, whiteout direct knowledge of existing open pico handles. And as you write, it also requires to make a call using a pico handle, that maybe is invalid, and looking at the error code to figure out if it is still connected.

The ps6000EnumerateUnits method should work without interfering or calling the pico scope.

-cpede
cpede
Newbie
 
Posts: 0
Joined: Fri Dec 23, 2016 7:46 am


Return to USB PC Oscilloscopes

Who is online

Users browsing this forum: No registered users and 0 guests