CYAPI demo application\cpp\bulkloop Open();

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

In theC:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\application\cpp\bulkloop,there is a demo called bulkloop.

1.png

int nDeviceIndex = 0;

m_selectedUSBDevice->Open(nDeviceIndex);

The nDeviceIndex is always o.

If there are several devices,how can i get it? Maybe i select second device,how can it distinguish?

I think it maybe a mistake!

0 Likes
1 Solution
SrinathS_16
Moderator
Moderator
Moderator
1000 replies posted 750 replies posted 500 replies posted

Hello,

You can distinguish the devices based on the VID/PID combination. This attribute is defined to be a part of the CCyUSBDevice class and can be accessed through an instance of the class.

Example:

do {

// Open() automatically calls Close() if necessary

USBDevice->Open(d);

vID = USBDevice->VendorID;

pID = USBDevice->ProductID;

d++;

} while ((d < devices ) && (vID != 0x04b4) && (pID != 0x00f1));

In case you have multiple devices with the same VID/PID, distinction can be made possible through the addition of a unique serial number in the device firmware (string descriptors). The serial number can be queried on the host application using the wchar_t CCyUSBDevice::SerialNumber attribute of the CCyUSBDevice class.

Best regards,

Srinath S

View solution in original post

0 Likes
1 Reply
SrinathS_16
Moderator
Moderator
Moderator
1000 replies posted 750 replies posted 500 replies posted

Hello,

You can distinguish the devices based on the VID/PID combination. This attribute is defined to be a part of the CCyUSBDevice class and can be accessed through an instance of the class.

Example:

do {

// Open() automatically calls Close() if necessary

USBDevice->Open(d);

vID = USBDevice->VendorID;

pID = USBDevice->ProductID;

d++;

} while ((d < devices ) && (vID != 0x04b4) && (pID != 0x00f1));

In case you have multiple devices with the same VID/PID, distinction can be made possible through the addition of a unique serial number in the device firmware (string descriptors). The serial number can be queried on the host application using the wchar_t CCyUSBDevice::SerialNumber attribute of the CCyUSBDevice class.

Best regards,

Srinath S

0 Likes