From 7c932f66e13171aece712ea8bb018bee3252b7ad Mon Sep 17 00:00:00 2001 From: Michal Demin Date: Mon, 24 Jan 2011 15:07:59 +0100 Subject: [PATCH] Jtagkey: Fixed order of ftdi initialization. Signed-off-by: Michal Demin --- jtagkey.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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; -- 2.39.5