libftdi Archives

Subject: Re: Bug in libftdipp open()-methods

From: Thomas Jarosch <thomas.jarosch@xxxxxxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Cc: Peter Schneider <pitpompej@xxxxxxxx>
Date: Mon, 16 Jan 2012 15:48:43 +0100
Hi Pit,

On Tuesday, 10. January 2012 11:19:23 Peter Schneider wrote:
> you are right, changed the setting of the usb-device into the
> Context::get_strings_and_reopen() function.
> 
> Attached patch is now for the master branch as you requested. anyway i
> think this patch should also be applied in the libftdi0.19 branch as --
> in my view -- it is a major bug in the cpp-wrapper.

Thanks, I've applied your patch.

Also I added another piece of code to reset "d->dev" on Context::close().

Still I think the C++ wrapper is a bit messy in that regard,
see my remarks from 2010:

----------------------------------------
Looking at the C++ wrapper three years later,
I don't like the fact that I keeps an own "libusb_device *dev"
pointer -and- a pointer to the ftdi_context. 
 
I think it can be improved without bloating the open()
function of the C API. Something like this:
 
- Remove the libusb_device pointer in the C++ wrapper

- Provide a function in the C API to get the strings without
  closing the device. Thinking about it some more, the C API
  could do this by default, "wasting" some bytes for an
  already open device is a non-issue.

- Kill the get_strings_and_reopen() function

- Implement is_open() in the C API and kill the
  "open" flag, too.
----------------------------------------

Nobody has stepped up to fix it properly :)
I guess the C++ wrapper is not used by many people...

Cheers,
Thomas

--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx   

Current Thread