Hi Thomas, 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. greetings, Pit ----- Original Nachricht ---- Von: Thomas Jarosch <[email protected]> An: [email protected] Datum: 09.01.2012 16:55 Betreff: Re: Bug in libftdipp open()-methods > Hi pit, > > On Tuesday, 3. January 2012 11:25:07 Peter Schneider wrote: > > Hello and a happy new year, > > Same to you! > > > as I wrote about a year ago there is a bug in the cpp wrapper of the > > libftdi that prevents the three open methods, that does not get the > > usb-device as parameter, from working properly and keeping the > > connection opened. The patch added to this mail solves this bug only > > with a minor change in the corresponding open functions in the cpp > > wrapper. The patch attached is dedicated to libftdi0.19 but the same > > problem should be fixed within the cpp wrapper of libftdi1. > > Thanks for working on this. I think it's still broken as the > Context::get_strings_and_reopen() function needs the same fix? > > Also I would prefer it if development like this is done > for the "master" branch, but that's another topic. > > Cheers, > Thomas > -- libftdi - see http://www.intra2net.com/en/developer/libftdi for details. To unsubscribe send a mail to [email protected]
>From 53b15b7f4eceaedc6eb3911cd8363ecf8a01df6f Mon Sep 17 00:00:00 2001 From: Peter Schneider <[email protected]> Date: Tue, 10 Jan 2012 11:09:11 +0100 Subject: [PATCH] cpp-wrapper: when using get-string-and-reopen method without having set up the usb-device the currently opened usb-device is retreived from the usb-device-handle used in the ftdi context. this fixes the open methods of the cpp wrapper that do not get an usb-device by parameter. --- ftdipp/ftdi.cpp | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/ftdipp/ftdi.cpp b/ftdipp/ftdi.cpp index 5e45dce..60f03d6 100644 --- a/ftdipp/ftdi.cpp +++ b/ftdipp/ftdi.cpp @@ -316,6 +316,11 @@ int Context::get_strings() int Context::get_strings_and_reopen() { + if ( 0 == d->dev ) + { + d->dev = libusb_get_device(d->ftdi->usb_dev); + } + // Get device strings (closes device) int ret=get_strings(); if (ret < 0) -- 1.7.5.4
