2 Replies Latest reply on Nov 20, 2020 5:37 PM by wuHa_1344001

    How to creat device multiple times using cylibusb on linux OS using fx3 device

    wuHa_1344001

      We use FX3 on data acquirtion and generation system (ADC and DAC).

      The board work on linux OS.  now we hope the device has the ability of "creat device multiple times" like on widnows OS.

       

      For example : Process A creates the device handle and then performs AD's acquirtion . At the same time, it wants to run process B to perform DA output, but the device of process B cannot be opened normally. This step of "cyusb_claim_interface" will return failure because process A has already "claim" passed.

       

      How to creat device multiple times using cylibusb on linux OS using fx3 device?

        • 1. Re: How to creat device multiple times using cylibusb on linux OS using fx3 device
          RashiV_61

          Hello,

           

          From the description, I understand that only one FX3 is being interfaced with ADC and DAC and FX3 will enumerate with two interfaces. Is my understanding correct?

           

          - If yes, please let me know under which USB class does both interfaces fall

          - Is the device enumerating successfully with both the interface? If not, please share the snippet of the device enumeration after calling lsusb command.

          - Please confirm that you call cyusb_open, cyusb_gethandle APIs and check if the kernel driver is attached before claiming the second interface. You might be aware that cyusb_linux is a wrapper around libusb and the libusb API ties an open device to a specific interface. This means that if you want to claim multiple interfaces on a device, you should open the device multiple times to receive one get device handle for each interface you want to communicate with, and then claim the interface.

          - You can refer to the code flow of the 05_claiminterface console application in the CyUsb Suite for Linux (path: FX3 SDK Installation Path\cyusb_linux_1.0.5.tar\cyusb_linux_1.0.5\src). You can also check to claim the interface B using this application (refer to cyusb_programmer's_guide for using the application)

          - Please let me know if this helps. If still the problem is seen please let me know the return value of cyusb_claim_interface API and the snippet when 05_claiminterface application is used to claim the interface.

           

          Regards,

          Rashi

          • 2. Re: How to creat device multiple times using cylibusb on linux OS using fx3 device
            wuHa_1344001

            QQ图片20201121090953.png

            This is the result of 05_claiminterface console application, we run it twice, first is the right pic and the second is the left.

             

            Otherwise, How to get the interfaces number supported by one device?

            We think that our device has only one interface. We can create a device multiple times by multiple processes under Windows OS and run well, as long as we ensure that the operation is multi-threaded/multi-process safe(one Endpoint only used by one Thread at the same time). How to do this under Linux?