Enumerating Devices while Open

Post any questions you may have about our current range of oscilloscopes
Post Reply
cpede
Newbie
Posts: 0
Joined: Fri Dec 23, 2016 7:46 am

Enumerating Devices while Open

Post by cpede »

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

Martyn
Site Admin
Site Admin
Posts: 4491
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: Enumerating Devices while Open

Post by Martyn »

If you add another device, that hasn't been opened, does enumerate units return correctly ?
Martyn
Technical Support Manager

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

Re: Enumerating Devices while Open

Post by cpede »

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

Martyn
Site Admin
Site Admin
Posts: 4491
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: Enumerating Devices while Open

Post by Martyn »

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

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

Re: Enumerating Devices while Open

Post by cpede »

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

Post Reply