-rw-r--r-- | Android.mk | 6 | ||||
-rw-r--r-- | conf/bcm_usb_bt/Android.mk | 14 | ||||
-rw-r--r-- | conf/bcm_usb_bt/bt_vendor.conf | 5 | ||||
-rwxr-xr-x | src/userial_vendor.c | 13 |
4 files changed, 34 insertions, 4 deletions
diff --git a/src/userial_vendor.c b/src/userial_vendor.c index 3ff518b..02a2678 100755 --- a/src/userial_vendor.c +++ b/src/userial_vendor.c @@ -195,6 +195,7 @@ int userial_vendor_open(tUSERIAL_CFG *p_cfg) uint8_t data_bits; uint16_t parity; uint8_t stop_bits; + uint8_t cnt = 0; vnd_userial.fd = -1; @@ -240,12 +241,18 @@ int userial_vendor_open(tUSERIAL_CFG *p_cfg) } ALOGI("userial vendor open: opening %s", vnd_userial.port_name); - - if ((vnd_userial.fd = open(vnd_userial.port_name, O_RDWR)) == -1) +open_retry: + if ((vnd_userial.fd = open(vnd_userial.port_name, O_RDWR)) < 0) { - ALOGE("userial vendor open: unable to open %s", vnd_userial.port_name); + ALOGE("userial vendor open: unable to open %s, retrying....", vnd_userial.port_name); + usleep(50000); + cnt++; + if (cnt < 40) + goto open_retry; + ALOGE("userial vendor open fail!!"); return -1; } + ALOGE("userial vendor open success!!"); tcflush(vnd_userial.fd, TCIOFLUSH); |