From 0775901e94904463328ded042bb53ee49d2c8c46 Mon Sep 17 00:00:00 2001 From: Mary Ruthven Date: Tue, 7 May 2019 16:00:27 -0700 Subject: iteflash: use serial number to find the ccd device There may be multiple ccd devices connected to the host. Use the serial number to choose the correct device. BUG=none BRANCH=none TEST=try to flash ampton with two CCD devices connected to the host Change-Id: I1554e94f31b5582955ea25c19da2c3da98012e46 Signed-off-by: Mary Ruthven Reviewed-on: https://chromium-review.googlesource.com/1600502 Reviewed-by: Matthew Blecker Reviewed-by: Vadim Bendebury --- util/iteflash.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/util/iteflash.c b/util/iteflash.c index f0d110f19e..e66b01cf55 100644 --- a/util/iteflash.c +++ b/util/iteflash.c @@ -809,8 +809,9 @@ static int connect_to_ccd_i2c_bridge(struct common_hnd *chnd) { int rv; - rv = usb_findit(NULL, chnd->conf.usb_vid, chnd->conf.usb_pid, - CR50_I2C_SUBCLASS, CR50_I2C_PROTOCOL, &chnd->uep); + rv = usb_findit(chnd->conf.usb_serial, chnd->conf.usb_vid, + chnd->conf.usb_pid, CR50_I2C_SUBCLASS, + CR50_I2C_PROTOCOL, &chnd->uep); if (rv) { fprintf(stderr, "%s: usb_findit returned error %d\n", @@ -1662,15 +1663,9 @@ static int linux_i2c_interface_shutdown(struct common_hnd *chnd) static int ccd_i2c_interface_init(struct common_hnd *chnd) { - int ret; chnd->conf.usb_vid = CR50_USB_VID; chnd->conf.usb_pid = CR50_USB_PID; - ret = connect_to_ccd_i2c_bridge(chnd); - if (!ret) { - printf("Using CCD device%s\n", - chnd->conf.usb_serial ? ", ignoring serial number" : ""); - } - return ret; + return connect_to_ccd_i2c_bridge(chnd); } static int ccd_i2c_interface_shutdown(struct common_hnd *chnd) -- cgit v1.2.1