bdaddr_t bdaddr;
u8 addr_type;
u8 val[16];
+#ifdef CONFIG_TIZEN_WIP
+ u8 rpa_res_support;
+#endif
};
struct link_key {
int hci_get_dev_info(void __user *arg);
int hci_get_conn_list(void __user *arg);
#ifdef CONFIG_TIZEN_WIP
+int hci_set_rpa_res_support(struct hci_dev *hdev, bdaddr_t *bdaddr,
+ u8 addr_type, u8 enabled);
u32 get_link_mode(struct hci_conn *conn);
#endif
int hci_get_conn_info(struct hci_dev *hdev, void __user *arg);
} __packed;
#define MGMT_LE_SET_DATA_LENGTH_RSP_SIZE 3
+#define MGMT_OP_SET_DEV_RPA_RES_SUPPORT (TIZEN_OP_CODE_BASE + 0x19)
+struct mgmt_cp_set_dev_rpa_res_support {
+ struct mgmt_addr_info addr;
+ __u8 res_support;
+} __packed;
+#define MGMT_OP_SET_DEV_RPA_RES_SUPPORT_SIZE 8
+
/* BEGIN TIZEN_Bluetooth :: name update changes */
#define MGMT_EV_DEVICE_NAME_UPDATE (TIZEN_EV_BASE + 0x01)
struct mgmt_ev_device_name_update {
conn->state = BT_CONNECT;
}
+#ifdef CONFIG_TIZEN_WIP
+static void hci_req_directed_advertising(struct hci_request *req,
+ struct hci_conn *conn,
+ u8 rpa_res_support)
+#else
static void hci_req_directed_advertising(struct hci_request *req,
struct hci_conn *conn)
+#endif
{
struct hci_dev *hdev = req->hdev;
struct hci_cp_le_set_adv_param cp;
u8 own_addr_type;
u8 enable;
+#ifdef CONFIG_TIZEN_WIP
+ bool require_privacy;
+#endif
/* Clear the HCI_LE_ADV bit temporarily so that the
* hci_update_random_address knows that it's safe to go ahead
*/
clear_bit(HCI_LE_ADV, &hdev->dev_flags);
+#ifdef CONFIG_TIZEN_WIP
+ /* Set require_privacy to true if remote device is able to
+ * resolve RPA (As per BT spec 4.2 & Enhanced privacy feature)
+ * otherwise, set require_privacy to false so that the remote
+ * device has a chance of identifying us.
+ */
+ if (rpa_res_support)
+ require_privacy = true;
+ else
+ require_privacy = false;
+
+ if (hci_update_random_address(req, require_privacy, &own_addr_type) < 0)
+ return;
+#else
/* Set require_privacy to false so that the remote device has a
* chance of identifying us.
*/
if (hci_update_random_address(req, false, &own_addr_type) < 0)
return;
+#endif
memset(&cp, 0, sizeof(cp));
cp.type = LE_ADV_DIRECT_IND;
return ERR_PTR(-EBUSY);
}
+#ifdef CONFIG_TIZEN_WIP
+ hci_req_directed_advertising(&req, conn, irk->rpa_res_support);
+#else
hci_req_directed_advertising(&req, conn);
+#endif
goto create_conn;
}
}
#ifdef CONFIG_TIZEN_WIP
+int hci_set_rpa_res_support(struct hci_dev *hdev, bdaddr_t *bdaddr,
+ u8 addr_type, u8 enabled)
+{
+ struct smp_irk *irk;
+
+ irk = hci_find_irk_by_addr(hdev, bdaddr, addr_type);
+ if (!irk)
+ return -ENOENT;
+
+ irk->rpa_res_support = enabled;
+
+ return 0;
+}
+
/* Timeout Error Event is being handled */
static void hci_tx_timeout_error_evt(struct hci_dev *hdev)
{
hci_dev_unlock(hdev);
return err;
}
+
+static int set_dev_rpa_res_support(struct sock *sk, struct hci_dev *hdev,
+ void *data, u16 len)
+{
+ struct mgmt_cp_set_dev_rpa_res_support *cp = data;
+ int err;
+
+ BT_DBG("Set resolve RPA as %u for %s", cp->res_support, hdev->name);
+
+ hci_dev_lock(hdev);
+
+ if (!lmp_le_capable(hdev)) {
+ err = cmd_status(sk, hdev->id,
+ MGMT_OP_SET_DEV_RPA_RES_SUPPORT,
+ MGMT_STATUS_NOT_SUPPORTED);
+ goto unlocked;
+ }
+
+ if (!hdev_is_powered(hdev)) {
+ err = cmd_status(sk, hdev->id,
+ MGMT_OP_SET_DEV_RPA_RES_SUPPORT,
+ MGMT_STATUS_REJECTED);
+ goto unlocked;
+ }
+
+ if (hci_set_rpa_res_support(hdev, &cp->addr.bdaddr, cp->addr.type,
+ cp->res_support)) {
+ err = cmd_complete(sk, hdev->id,
+ MGMT_OP_SET_DEV_RPA_RES_SUPPORT,
+ MGMT_STATUS_NOT_PAIRED, NULL, 0);
+ goto unlocked;
+ }
+
+ err = cmd_complete(sk, hdev->id, MGMT_OP_SET_DEV_RPA_RES_SUPPORT,
+ MGMT_STATUS_SUCCESS, NULL, 0);
+
+unlocked:
+ hci_dev_unlock(hdev);
+ return err;
+}
/* END TIZEN_Bluetooth */
#endif
MGMT_LE_READ_HOST_SUGGESTED_DATA_LENGTH_SIZE },
{ set_le_data_length_params, false,
MGMT_LE_SET_DATA_LENGTH_SIZE },
+ { set_dev_rpa_res_support, false, MGMT_OP_SET_DEV_RPA_RES_SUPPORT_SIZE },
};
#endif