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

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

cross mob
wuHa_1344001
Level 1
Level 1

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?

0 Likes
1 Solution
Rashi_Vatsa
Moderator
Moderator
Moderator
5 likes given 500 solutions authored 1000 replies posted

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

Regards,
Rashi

View solution in original post

0 Likes
3 Replies
Rashi_Vatsa
Moderator
Moderator
Moderator
5 likes given 500 solutions authored 1000 replies posted

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

Regards,
Rashi
0 Likes

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?

0 Likes

Hello,

Apologies for the delayed response.

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

>> Please confirm if the device enumerates successfully with more than one interface. You can use lsusb -v command to check of the device enumerates properly and no. of interfaces supported

How to do this under Linux?

You can refer to the source code if the cyusb_linux hui application which creates the POSIX threads

FX3 SDK installation\FX3_SDK_Linux\cyusb_linux_1.0.5.tar\cyusb_linux_1.0.5\gui_src\streamer.cpp

Regards,

Rashi

Regards,
Rashi
0 Likes