[PATCH 2/2] main: Populate the final interface structure before printing it

Tormod Volden lists.tormod at gmail.com
Fri Feb 4 14:00:29 CET 2011


Hi again,

I noticed I missed a libusb_free_config_descriptor(config) in below
patch. But I also have a growing feeling I am just papering over
another bug or something should be done architecture-wise, so please
hold-off this patch. I hope we can come up with something better.

Tormod


On Thu, Feb 3, 2011 at 11:12 PM, Tormod Volden <lists.tormod at gmail.com> wrote:
> From: Tormod Volden <debian.tormod at gmail.com>
>
> The dif is used for search parameters, and later for keeping the
> interface parameters. If the vendor and product fields were not
> used for searching, they were also not filled out, and the user
> would see "Found Runtime: [0x0000:0x0000]".
> ---
>  src/main.c |   12 ++++++++++++
>  1 files changed, 12 insertions(+), 0 deletions(-)
>
> diff --git a/src/main.c b/src/main.c
> index 74d00b3..1a91b46 100644
> --- a/src/main.c
> +++ b/src/main.c
> @@ -775,6 +775,18 @@ dfustate:
>                dif->altsetting = n-1;
>        }
>
> +       /* populate the final dif */
> +       {
> +               struct libusb_device_descriptor desc;
> +               struct libusb_config_descriptor *config;
> +
> +               libusb_get_device_descriptor(dif->dev, &desc);
> +               dif->vendor = desc.idVendor;
> +               dif->product = desc.idProduct;
> +               libusb_get_active_config_descriptor(dif->dev, &config);
> +               dif->configuration = config->bConfigurationValue;
> +       }
> +
>        print_dfu_if(dif, NULL);
>
>        num_ifs = count_dfu_interfaces(dif->dev);
> --
> 1.7.0.4
>
>



More information about the devel mailing list