-
-
Redpine Signals, Inc. Proprietary and Confidential
Page 40
R
R
S
S
9
9
1
1
1
1
3
3
-
-
n
n
-
-
L
L
i
i
n
n
k
k
-
-
M
M
o
o
d
d
u
u
l
l
e
e
-
-
D
D
r
r
i
i
v
v
e
e
r
r
-
-
I
I
n
n
s
s
t
t
a
a
l
l
l
l
a
a
t
t
i
i
o
o
n
n
-
-
G
G
u
u
i
i
d
d
e
e
V
V
e
e
r
r
s
s
i
i
o
o
n
n
3
3
.
.
0
0
if (ret < 0 && errno == EAGAIN)
usleep(500000);
else
break;
}
if (ret != 0)
LOGD("Unable to unload driver module \"%s\": %s\n",
modname, strerror(errno));
return ret;
}
/*In bt_enable comment the hciattach and instead calling Redpine’s driver via
insmod. Follow the below changes */
int bt_enable() {
LOGV(__FUNCTION__);
int ret = -1;
int hci_sock = -1;
int attempt;
if(rmmod(DRIVER_MODULE_BT_ONEBOX_GPL_REM)==0)
{
usleep(500000);
}
if(rmmod(DRIVER_MODULE_BT_ONEBOX_NONGPL_REM)==0)
{
usleep(500000);
}
/* Inserting the driver */
insmod(DRIVER_MODULE_BT_ONEBOX_NONGPL, "");
insmod(DRIVER_MODULE_BT_ONEBOX_GPL, "");
/*
if (set_bluetooth_power(1) < 0) goto out;
LOGI("Starting hciattach daemon");
if (property_set("ctl.start", "hciattach") < 0) {
LOGE("Failed to start hciattach");
goto out;
}
*/
/* 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--) {
hci_sock = create_hci_sock();
if (hci_sock < 0) goto out;
if (!ioctl(hci_sock, HCIDEVUP, HCI_DEV_ID)) {