summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2012-07-11 15:56:31 -0700
committerElliott Hughes <enh@google.com>2012-07-11 16:07:09 -0700
commitbf6696874d1b57ffddc7848450b20e926ad5d0a4 (patch)
tree6071d4ef53f27a4e3b17ff79d9dee5af9f92a083
parent5f728e907ce9370732d457cb48fd771963765b3f (diff)
downloadbluetooth-bf6696874d1b57ffddc7848450b20e926ad5d0a4.tar.gz
Fix the timeout in bt_enable.
1000 * 100ms == 100s, not 10s. This means my AOSP maguro takes 100s to start system_server, which is a very long time to stare at a blank screen. The intended 10s is perfectly reasonable; we're doing useful work in parallel for most of that time anyway. I've also made the logging more like the other logging in this file: bluedroid: bt_enable: ioctl(248, HCIDEVUP, HCI_DEV_ID) failed: No such device (19) Change-Id: I8321bfed380720e57c43f2f94569ab4f983685f3
-rw-r--r--bluedroid/bluetooth.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/bluedroid/bluetooth.c b/bluedroid/bluetooth.c
index ee104c9..3ad2189 100644
--- a/bluedroid/bluetooth.c
+++ b/bluedroid/bluetooth.c
@@ -164,13 +164,12 @@ int bt_enable() {
// Try for 10 seconds, this can only succeed once hciattach has sent the
// firmware and then turned on hci device via HCIUARTSETPROTO ioctl
- for (attempt = 1000; attempt > 0; attempt--) {
+ for (attempt = 100; attempt > 0; attempt--) {
hci_sock = create_hci_sock();
if (hci_sock < 0) goto out;
ret = ioctl(hci_sock, HCIDEVUP, HCI_DEV_ID);
- ALOGI("bt_enable: ret: %d, errno: %d", ret, errno);
if (!ret) {
break;
} else if (errno == EALREADY) {
@@ -178,8 +177,11 @@ int bt_enable() {
break;
}
+ ALOGI("%s: ioctl(%d, HCIDEVUP, HCI_DEV_ID) failed: %s (%d)",
+ __FUNCTION__, hci_sock, strerror(errno), errno);
+
close(hci_sock);
- usleep(100000); // 100 ms retry delay
+ usleep(100 * 1000); // 100 ms retry delay
}
if (attempt == 0) {
ALOGE("%s: Timeout waiting for HCI device to come up, error- %d, ",