#include <sys/socket.h>
#include <sys/ioctl.h>
-#include <cutils/properties.h>
-
#include "hci/include/bt_vendor_lib.h"
#include "osi/include/log.h"
+#include "osi/include/properties.h"
#define BTPROTO_HCI 1
#define HCI_CHANNEL_USER 1
memcpy(bt_vendor_local_bdaddr, local_bdaddr,
sizeof(bt_vendor_local_bdaddr));
- property_get("bluetooth.interface", prop_value, "0");
+ osi_property_get("bluetooth.interface", prop_value, "0");
errno = 0;
if (memcmp(prop_value, "hci", 3))
LOG_INFO(LOG_TAG, "Using interface hci%d", hci_interface);
- property_get("bluetooth.rfkill", prop_value, "0");
+ osi_property_get("bluetooth.rfkill", prop_value, "0");
rfkill_en = atoi(prop_value);
if (rfkill_en)
LOG_INFO(LOG_TAG, "RFKILL enabled");
- bt_hwcfg_en = property_get("bluetooth.hwcfg",
+ bt_hwcfg_en = osi_property_get("bluetooth.hwcfg",
prop_value, NULL) > 0 ? 1 : 0;
if (bt_hwcfg_en)
LOG_INFO(LOG_TAG, "HWCFG enabled");
return 0;
if (stop) {
- if (property_set("bluetooth.hwcfg", "stop") < 0) {
+ if (osi_property_set("bluetooth.hwcfg", "stop") < 0) {
LOG_ERROR(LOG_TAG, "%s cannot stop btcfg service via prop", __func__);
return 1;
}
} else {
- if (property_set("bluetooth.hwcfg", "start") < 0) {
+ if (osi_property_set("bluetooth.hwcfg", "start") < 0) {
LOG_ERROR(LOG_TAG, "%s cannot start btcfg service via prop", __func__);
return 1;
}
ev.opcode = MGMT_OP_INDEX_LIST;
ev.index = HCI_DEV_NONE;
ev.len = 0;
- if (write(fd, &ev, 6) != 6) {
+
+ ssize_t wrote;
+ OSI_NO_INTR(wrote = write(fd, &ev, 6));
+ if (wrote != 6) {
LOG_ERROR(LOG_TAG, "Unable to write mgmt command: %s", strerror(errno));
ret = -1;
goto end;
}
while (1) {
- int n = poll(fds, 1, MGMT_EV_POLL_TIMEOUT);
+ int n;
+ OSI_NO_INTR(n = poll(fds, 1, MGMT_EV_POLL_TIMEOUT));
if (n == -1) {
LOG_ERROR(LOG_TAG, "Poll error: %s", strerror(errno));
ret = -1;
}
if (fds[0].revents & POLLIN) {
- n = read(fd, &ev, sizeof(struct mgmt_pkt));
+ OSI_NO_INTR(n = read(fd, &ev, sizeof(struct mgmt_pkt)));
if (n < 0) {
- LOG_ERROR(LOG_TAG,
- "Error reading control channel");
+ LOG_ERROR(LOG_TAG, "Error reading control channel: %s",
+ strerror(errno));
ret = -1;
break;
}
static int bt_vendor_rfkill(int block)
{
struct rfkill_event event;
- int fd, len;
+ int fd;
LOG_INFO(LOG_TAG, "%s", __func__);
event.hard = block;
event.soft = block;
- len = write(fd, &event, sizeof(event));
+ ssize_t len;
+ OSI_NO_INTR(len = write(fd, &event, sizeof(event)));
if (len < 0) {
LOG_ERROR(LOG_TAG, "Failed to change rfkill state");
close(fd);
bt_vendor_callbacks = NULL;
}
-const bt_vendor_interface_t BLUETOOTH_VENDOR_LIB_INTERFACE = {
+EXPORT_SYMBOL const bt_vendor_interface_t BLUETOOTH_VENDOR_LIB_INTERFACE = {
sizeof(bt_vendor_interface_t),
bt_vendor_init,
bt_vendor_op,