Jump to content
  • 0

How to detecting AD2 removed at usb port


dragonLin

Question

Hi,

 

I can get device numbers from function FDwfEnum when I pulg-in AD2 by usb interface. But it still get 1 device when I open it then remove it from usb port. Is any way to detecting AD2 is or not on usb port?

 

the other question is=>

the filter function is not work. it always get 0 devices, when I used filter. FDwfEnum(enumfilterType|enumfilterUSB, cnt);

it works at FDwfEnum(0, cnt);

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Hi @dragonLin

If a device is hold open (FDwfDeviceOpen) by a process after disconnect, the information from this is kept in a shared table so it will be listed by enumerations.
The applications/scripts should close the device (FDwfDeviceClose/All) after the task is complete or function failure (returning zero).
For long running operation to periodically check if a device is available the FDwfAnalogIOStatus function can be used, this is also used by the WF app, like in AnalogIO_AnalogDiscovery2_SystemMonitor.py The return value of any other function can be used as well, like FDwfAnalogInStatus
The connection attempt to a disconnected or already open/busy device will fail.

It should work, see WF SDK/ samples/ py/ Device_Enumeration.py
commenting: dwf.FDwfEnum(enumfilterAll, byref(cDevice))
and uncommenting: dwf.FDwfEnum(c_int(enumfilterType.value|enumfilterUSB.value), byref(cDevice))  

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...