Author: stefanct
Date: Mon Sep 17 02:40:54 2012
New Revision: 1599
URL: http://flashrom.org/trac/flashrom/changeset/1599

Log:
Allow to select FTDI device by serial number.

Requires libftdi > 0.5 (2004, commit ID 
a8f46ddc1595b1b07abfcce613acdafe5b8ddf9d).
Idea stolen from chromiumos commit 5eb5624aeb7e2ee483e2fa0823c4e634c8ea3e68:
http://git.chromium.org/gitweb/?p=chromiumos/third_party/flashrom.git;a=commit;h=5eb5624aeb7e2ee483e2fa0823c4e634c8ea3e68

Signed-off-by: Shik Chen <[email protected]>
Signed-off-by: Stefan Tauner <[email protected]>
Acked-by: Stefan Tauner <[email protected]>

Modified:
   trunk/flashrom.8
   trunk/ft2232_spi.c

Modified: trunk/flashrom.8
==============================================================================
--- trunk/flashrom.8    Mon Sep 17 02:05:44 2012        (r1598)
+++ trunk/flashrom.8    Mon Sep 17 02:40:54 2012        (r1599)
@@ -573,6 +573,15 @@
 and the default interface is
 .BR B .
 .sp
+If there is more than one ft2232_spi-compatible device connected, you can 
select which one should be used by
+specifying its serial number with the
+.sp
+.B "  flashrom \-p ft2232_spi:serial=number"
+.sp
+syntax where
+.B number
+is the serial number of the device (which can be found for example in the 
output of lsusb -v).
+.sp
 All models supported by the ft2232_spi driver can configure the SPI clock rate 
by setting a divisor. The
 expressible divisors are all even numbers between 2 and 2^17 (=131072) 
resulting in SPI clock frequencies of
 6 MHz down to about 92 Hz for 12 MHz inputs. The default divisor is set to 2, 
but you can use another one by

Modified: trunk/ft2232_spi.c
==============================================================================
--- trunk/ft2232_spi.c  Mon Sep 17 02:05:44 2012        (r1598)
+++ trunk/ft2232_spi.c  Mon Sep 17 02:40:54 2012        (r1599)
@@ -283,7 +283,9 @@
                msg_perr("Unable to select interface: %s\n", ftdic->error_str);
        }
 
-       f = ftdi_usb_open(ftdic, ft2232_vid, ft2232_type);
+       arg = extract_programmer_param("serial");
+       f = ftdi_usb_open_desc(ftdic, ft2232_vid, ft2232_type, NULL, arg);
+       free(arg);
 
        if (f < 0 && f != -5) {
                msg_perr("Unable to open FTDI device: %d (%s)\n", f,

_______________________________________________
flashrom mailing list
[email protected]
http://www.flashrom.org/mailman/listinfo/flashrom

Reply via email to