1 Reply Latest reply on Sep 7, 2018 2:07 AM by srnt

    CYAPI   demo application\cpp\bulkloop    Open();

    yumingfoy_3247926

      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!

        • 1. Re: CYAPI   demo application\cpp\bulkloop    Open();
          srnt

          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