Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This function takes an already initialized USB device list, searches for Trenz Electronic USB FX2 devices (any Cypress driver derivative and VID = 0xbd0, PID=0x0300) and opens (and immediately after closes) the first device found.
The selected module is not directly given by USBDeviceList (CCyUSBDevice type). An internal operation that opens and immediately after closes an handle to CyUSB.sys driver (or a derivative like TE_USB_FX2_xx.sys) is executed instead (see page 45 of CyAPI.pdf). The open method closes every other handle already opened, and close method closes the only handle open; in this way, all handles are closed. These handles are internally managed by CyAPI.lib and there is no need to expose them to the user.

 

Note
titleDifference with C# TE_USB_FX2_Close() function

Managed C# TE_USB_FX2_Close() of TE_USB_FX2_CyUSB.dll disposes USBdevList.

Unmanaged C++ TE_USB_FX2_Close()
of TE_USB_FX2_CyAPI.dll

It can be freely called but it is rare that you would ever need to call TE_USB_FX2_Close() explicitly (though doing so would not cause any problems).

Managed C# TE_USB_FX2_Close()
of TE_USB_FX2_CyUSB.dll

It cannot be freely called and it is rare that you would ever need to call TE_USB_FX2_Close() explicitly. Furthermore, if it is used in the wrong way, the program can raise exceptions.