Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search for DTBs fails if other FTDI devices are present #454

Open
BranislavRistic opened this issue Sep 18, 2019 · 4 comments
Open

Search for DTBs fails if other FTDI devices are present #454

BranislavRistic opened this issue Sep 18, 2019 · 4 comments

Comments

@BranislavRistic
Copy link

We are using DTBs together with FTDI based USB-RS232 cables. While the cables are attached to the ftdi_sio driver, which provides /dev/ttyUSB nodes, the DTBs are excluded in order to be accessible by the FTDI D2XX interface.

When pxar is searching for DTBs it traverses a list of devices found by the FTDI D2XX library (which includes all FTDI devices), it tries to also get the description for the USB cables which are claimed by the ftdi_sio driver and fails (FT_ListDevices returns 'FT_ERROR(2) device not found'). At that point the search is terminated prematurely (see line 84)

ftdiStatus = FT_ListDevices(reinterpret_cast<PVOID>(enumPos), name, FT_LIST_BY_INDEX);
if (ftdiStatus != FT_OK)
{
enumCount = enumPos = 0;
return false;
}

This means that depending on the order of the devices listed by the FTDI library, the DTBs will be found or not. Removing line 84 and incrementing enumPos like for the successful case mitigates this issue and works in our case.

Is there a reason to terminate the search when encountering an inaccessible device?

Same statements can be found here:

enumCount = enumPos = 0;

enumCount = enumPos = 0;

enumCount = enumPos = 0;

@simonspa
Copy link
Member

Probably not, back then we most likely only though of an invalid device state but not of another device.

@meierb
Copy link

meierb commented Sep 18, 2019 via email

@BranislavRistic
Copy link
Author

Thanks for the quick reply!

@simonspa I will then prepare a PR with our changes.

@meierb Unfortunately this is the same code as above (cycling through FTDI devices via EnumNext). If you look at https://github.com/psi46/psi46test/blob/master/usb.cpp#L57-L69 it relies on FT_ListDevices returning a zero, otherwise enumCount is set to 0 and all following calls to EnumNext return immediately a false.

@meierb
Copy link

meierb commented Sep 18, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants