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

Tormod Volden lists.tormod at gmail.com
Thu Feb 3 23:12:36 CET 2011


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