From: Tormod Volden <debian.tor...@gmail.com>

First get_first_dfu_device() fills in the dev and dev_handle
members, but only after get_first_dfu_if() the whole interface
information is filled in.

Signed-off-by: Tormod Volden <debian.tor...@gmail.com>
---

This solves the "Found Runtime: [0000:0000]" issue I tried to address
in the "main: Populate the final interface structure before printing it"
patch that I posted and withdrew in February.

It also solves the segfaults we are seeing on the libusb-1.0 branch.

Cheers,
Tormod

 src/main.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/main.c b/src/main.c
index de65793..401614d 100644
--- a/src/main.c
+++ b/src/main.c
@@ -776,8 +776,6 @@ dfustate:
                dif->altsetting = n-1;
        }
 
-       print_dfu_if(dif, NULL);
-
        num_ifs = count_dfu_interfaces(dif->dev);
        if (num_ifs < 0) {
                fprintf(stderr, "No DFU Interface after RESET?!?\n");
@@ -795,6 +793,8 @@ dfustate:
                exit(1);
        }
 
+       print_dfu_if(dif, NULL);
+
 #if 0
        printf("Setting Configuration %u...\n", dif->configuration);
        if (libusb_set_configuration(dif->dev_handle, dif->configuration) < 0) {
-- 
1.7.0.4


_______________________________________________
devel mailing list
devel@lists.openmoko.org
https://lists.openmoko.org/mailman/listinfo/devel

Reply via email to