Hello everyone,
I'm trying to implement a simple I/O-Interfaceboard with a FTDI4232 chip. For that I'm opening the connection with FDTI::Context::open(<my product ID>, <my vendor ID>). The function returns 0, i.e. indicating that the call was successful. But when I'm calling
FDTI::Context::is_open() later it returns false.
After some investigation I found that FDTI::Context::open(<my product ID>, <my vendor ID>) calls get_strings_and_reopen(false,false,false). But for all parameters false there is no change to set the internal d->open flag for indicating the device to open. Moving
the setting of d->open to the end of the function get_strings_and_reopen removes that problem:
diff --git a/ftdipp/ftdi.cpp b/ftdipp/ftdi.cpp
index afb84fb..d89d842 100644
--- a/ftdipp/ftdi.cpp
+++ b/ftdipp/ftdi.cpp
@@ -398,9 +398,10 @@ int Context::get_strings_and_reopen(bool vendor, bool description, bool serial)
// Reattach device
ret = ftdi_usb_open_dev(d->ftdi, d->dev);
- d->open = (ret >= 0);
}
+ d->open = (ret >= 0);
+
return ret;
}
Or the workaround I did also removed the problem: Just using FDTI::Context::open("i:<my product ID>: <my vendor ID>"), since this calls get_strings_and_reopen(false,true,false) and this
set then the d->open flag correctly and also the FDTI::Context::is_open() works then.
Is this right or I'm missing some assumptions?
Greetings,
André
PS: Also a bit strange was that there is no usage of FDTI::Context::is_open() in the examples. If needed I
will support you in doing further tests.
Richard
Wolf GmbH, Pforzheimer Strasse 32, 75438 Knittlingen
Managing Directors: Juergen Pfab, Juergen Steinbeck. Trade Register: Mannheim
HRB 510031
Richard
Wolf GmbH routinely monitors the content of e-mail sent and received via its
network for the purposes of ensuring compliance with its policies and
procedures. Richard Wolf GmbH is not responsible for any changes made to the
message after it has been sent. Where opinions are expressed, they are not
necessarily those of Richard Wolf GmbH. This e-mail and any files transmitted
with it are confidential and intended solely for the use of the individual or
entity to which they are addressed. If you are not the intended addressee, or
the person responsible for delivering it to them, you may not copy, forward,
disclose, or otherwise use it or any part of it in any way. To do so may be
unlawful. If you receive this e-mail by mistake, please advise the sender
immediately.
Data Protection Policy
| Legal Information
| Terms & Conditions
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx
|