]> git.zerfleddert.de Git - usb-driver/commitdiff
Jtagkey: Fixed order of ftdi initialization.
authorMichal Demin <michaldemin@gmail.com>
Mon, 24 Jan 2011 14:07:59 +0000 (15:07 +0100)
committerMichael Gernoth <michael@gernoth.net>
Wed, 26 Jan 2011 17:00:28 +0000 (18:00 +0100)
Signed-off-by: Michal Demin <michaldemin@gmail.com>
jtagkey.c

index c4f2beeb9679deb554d2c7e3496f8aaa680f07e7..04bd0cd7291f886e2370f9562dfc727af02ac415 100644 (file)
--- a/jtagkey.c
+++ b/jtagkey.c
@@ -41,6 +41,11 @@ static int jtagkey_init(unsigned short vid, unsigned short pid, unsigned short i
                return ret;
        }
        
+       if ((ret = ftdi_set_interface(&ftdic, iface)) != 0) {
+               fprintf(stderr, "unable to set interface: %d (%s)\n", ret, ftdi_get_error_string(&ftdic));
+               return ret;
+       }
+
        if ((ret = ftdi_usb_open(&ftdic, vid, pid)) != 0) {
                fprintf(stderr, "unable to open ftdi device: %d (%s)\n", ret, ftdi_get_error_string(&ftdic));
                return ret;
@@ -51,11 +56,6 @@ static int jtagkey_init(unsigned short vid, unsigned short pid, unsigned short i
                return ret;
        }
 
-       if ((ret = ftdi_set_interface(&ftdic, iface)) != 0) {
-               fprintf(stderr, "unable to set interface: %d (%s)\n", ret, ftdi_get_error_string(&ftdic));
-               return ret;
-       }
-
        if ((ret = ftdi_write_data_set_chunksize(&ftdic, USBBUFSIZE))  != 0) {
                fprintf(stderr, "unable to set write chunksize: %d (%s)\n", ret, ftdi_get_error_string(&ftdic));
                return ret;
Impressum, Datenschutz