summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVic (Chun-Ju) Yang <victoryang@chromium.org>2013-12-23 12:09:41 +0800
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2013-12-27 07:50:52 +0000
commit08a030e15267cabcd098a5a7989ce6b652039020 (patch)
tree12909e05f66a36276be8863d2ff5061009f971d2
parent4e7e33f6e7fe114ef94b5e068d723f621e54e5ab (diff)
downloadchrome-ec-08a030e15267cabcd098a5a7989ce6b652039020.tar.gz
Add support for igloo board to ec_uartd
The igloo board has a different product ID than bds board. Add the new product ID to ec_uartd. BUG=chrome-os-partner:24713 TEST=Run ec_uartd with igloo board BRANCH=None Change-Id: Idcbb08072661e12ed744a60fb04a55d4f58cf89b Signed-off-by: Vic (Chun-Ju) Yang <victoryang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/181082 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
-rw-r--r--util/ec_uartd.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/util/ec_uartd.c b/util/ec_uartd.c
index e930a34e69..fbf4a5e1b0 100644
--- a/util/ec_uartd.c
+++ b/util/ec_uartd.c
@@ -30,6 +30,9 @@
#include <termios.h>
#include <unistd.h>
+static const int ftdi_id[][2] = { {0x0403, 0xbcda},
+ {0x0403, 0xbcd9} };
+
int main(int argc, char **argv)
{
struct ftdi_context fcontext;
@@ -38,6 +41,8 @@ int main(int argc, char **argv)
char buf[1024];
int fd;
int rv;
+ int i;
+ int device_opened;
/* Init */
if (ftdi_init(&fcontext) < 0) {
@@ -47,12 +52,22 @@ int main(int argc, char **argv)
/* Open interface B (UART) in the FTDI device and set 115kbaud */
ftdi_set_interface(&fcontext, INTERFACE_B);
- rv = ftdi_usb_open(&fcontext, 0x0403, 0xbcda);
- if (rv < 0) {
+ device_opened = 0;
+ for (i = 0; i < sizeof(ftdi_id) / sizeof(ftdi_id[0]); ++i) {
+ rv = ftdi_usb_open(&fcontext, ftdi_id[i][0], ftdi_id[i][1]);
+ if (rv >= 0) {
+ fprintf(stderr, "Using FTDI device %04x:%04x\n",
+ ftdi_id[i][0], ftdi_id[i][1]);
+ device_opened = 1;
+ break;
+ }
+ }
+ if (!device_opened) {
fprintf(stderr, "error opening ftdi device: %d (%s)\n",
rv, ftdi_get_error_string(&fcontext));
return 2;
}
+
rv = ftdi_set_baudrate(&fcontext, 115200);
if (rv < 0) {
fprintf(stderr, "error setting baudrate: %d (%s)\n",