diff options
author | Matthew Xie <mattx@google.com> | 2011-10-27 10:25:15 -0700 |
---|---|---|
committer | Matthew Xie <mattx@google.com> | 2011-10-27 10:25:15 -0700 |
commit | 62432dd0bb4d59f640bde9309f86eef2fd984f18 (patch) | |
tree | 57c539323286b47eb1050dd5cfb942c74d184695 | |
parent | b9bcd9fe3a607df1589e55760cf5cef7fb5618ad (diff) | |
download | bluetooth-62432dd0bb4d59f640bde9309f86eef2fd984f18.tar.gz |
Check EALREADY status for HCIDEVUP commandandroid-sdk-4.0.3_r1android-sdk-4.0.3-tools_r1android-cts-verifier-4.0_r1android-cts-verifier-4.0.3_r1android-cts-4.0.3_r2android-cts-4.0.3_r1ics-mr1
Both bluez and bluedroid starts up HCI driver. If bluez starts the driver
before bluedroid. Current bluedroid fails incorrectly. Bluedroid should
treat EALREADY error code as success.
We place a warning message when EALREADY error happens. The reason is that
bluedroid should always starts up HCI driver first. bluedroid starts up
bluetoothd afterwards.
bug 5496360
Change-Id: I316a2b3ec52bfbe6d1cdf554eac3deabfd63f3da
-rw-r--r-- | bluedroid/bluetooth.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/bluedroid/bluetooth.c b/bluedroid/bluetooth.c index 252bdc4..4cc9204 100644 --- a/bluedroid/bluetooth.c +++ b/bluedroid/bluetooth.c @@ -168,11 +168,17 @@ int bt_enable() { if (hci_sock < 0) goto out; ret = ioctl(hci_sock, HCIDEVUP, HCI_DEV_ID); + + LOGI("bt_enable: ret: %d, errno: %d", ret, errno); if (!ret) { break; + } else if (errno == EALREADY) { + LOGW("Bluetoothd already started, unexpectedly!"); + break; } + close(hci_sock); - usleep(10000); // 10 ms retry delay + usleep(100000); // 100 ms retry delay } if (attempt == 0) { LOGE("%s: Timeout waiting for HCI device to come up, error- %d, ", |