From: Michal Demin Date: Mon, 24 Jan 2011 14:07:59 +0000 (+0100) Subject: Jtagkey: Fixed order of ftdi initialization. X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/usb-driver/commitdiff_plain/7c932f66e13171aece712ea8bb018bee3252b7ad?hp=6615630635379e2768f9cbc69b3efeb742195b32 Jtagkey: Fixed order of ftdi initialization. Signed-off-by: Michal Demin --- diff --git a/jtagkey.c b/jtagkey.c index c4f2bee..04bd0cd 100644 --- 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;