mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-12-27 18:25:05 +00:00
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>
This commit is contained in:
committed by
chrome-internal-fetch
parent
4e7e33f6e7
commit
08a030e152
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user