27 #include <linux/module.h>
28 #include <asm/unaligned.h>
37 #define MGMT_VERSION 1
38 #define MGMT_REVISION 2
40 static const u16 mgmt_commands[] = {
81 static const u16 mgmt_events[] = {
109 #define LE_SCAN_TYPE 0x01
110 #define LE_SCAN_WIN 0x12
111 #define LE_SCAN_INT 0x12
112 #define LE_SCAN_TIMEOUT_LE_ONLY 10240
113 #define LE_SCAN_TIMEOUT_BREDR_LE 5120
115 #define INQUIRY_LEN_BREDR 0x08
116 #define INQUIRY_LEN_BREDR_LE 0x04
118 #define CACHE_TIMEOUT msecs_to_jiffies(2 * 1000)
120 #define hdev_is_powered(hdev) (test_bit(HCI_UP, &hdev->flags) && \
121 !test_bit(HCI_AUTO_OFF, &hdev->dev_flags))
133 static u8 mgmt_status_table[] = {
202 static u8 mgmt_status(
u8 hci_status)
204 if (hci_status <
ARRAY_SIZE(mgmt_status_table))
205 return mgmt_status_table[hci_status];
217 BT_DBG(
"sock %p, index %u, cmd %u, status %u", sk, index, cmd, status);
219 skb = alloc_skb(
sizeof(*hdr) +
sizeof(*ev),
GFP_KERNEL);
223 hdr = (
void *)
skb_put(skb,
sizeof(*hdr));
229 ev = (
void *)
skb_put(skb,
sizeof(*ev));
240 static int cmd_complete(
struct sock *sk,
u16 index,
u16 cmd,
u8 status,
241 void *
rp,
size_t rp_len)
250 skb = alloc_skb(
sizeof(*hdr) +
sizeof(*ev) + rp_len,
GFP_KERNEL);
254 hdr = (
void *)
skb_put(skb,
sizeof(*hdr));
260 ev = (
void *)
skb_put(skb,
sizeof(*ev) + rp_len);
274 static int read_version(
struct sock *sk,
struct hci_dev *hdev,
void *
data,
288 static int read_commands(
struct sock *sk,
struct hci_dev *hdev,
void *data,
300 rp_size =
sizeof(*rp) + ((num_commands +
num_events) *
sizeof(
u16));
309 for (i = 0, opcode = rp->opcodes; i < num_commands; i++, opcode++)
310 put_unaligned_le16(mgmt_commands[i], opcode);
313 put_unaligned_le16(mgmt_events[i], opcode);
322 static int read_index_list(
struct sock *sk,
struct hci_dev *hdev,
void *data,
343 rp_len =
sizeof(*rp) + (2 *
count);
363 rp_len =
sizeof(*rp) + (2 *
count);
375 static u32 get_supported_settings(
struct hci_dev *hdev)
402 static u32 get_current_settings(
struct hci_dev *hdev)
436 #define PNP_INFO_SVCLASS_ID 0x1200
438 static u8 bluetooth_base_uuid[] = {
439 0xFB, 0x34, 0x9B, 0x5F, 0x80, 0x00, 0x00, 0x80,
440 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
443 static u16 get_uuid16(
u8 *uuid128)
448 for (i = 0; i < 12; i++) {
449 if (bluetooth_base_uuid[i] != uuid128[i])
460 static void create_eir(
struct hci_dev *hdev,
u8 *data)
465 int i, truncated = 0;
480 ptr[0] = name_len + 1;
484 eir_len += (name_len + 2);
485 ptr += (name_len + 2);
510 memset(uuid16_list, 0,
sizeof(uuid16_list));
516 uuid16 = get_uuid16(uuid->
uuid);
533 for (i = 0; uuid16_list[
i] != 0; i++)
534 if (uuid16_list[i] == uuid16)
537 if (uuid16_list[i] == 0) {
538 uuid16_list[
i] = uuid16;
539 eir_len +=
sizeof(
u16);
543 if (uuid16_list[0] != 0) {
552 for (i = 0; uuid16_list[
i] != 0; i++) {
553 *ptr++ = (uuid16_list[
i] & 0x00ff);
554 *ptr++ = (uuid16_list[
i] & 0xff00) >> 8;
558 *length = (i *
sizeof(
u16)) + 1;
562 static int update_eir(
struct hci_dev *hdev)
580 create_eir(hdev,
cp.data);
590 static u8 get_service_classes(
struct hci_dev *hdev)
614 cod[0] = hdev->minor_class;
615 cod[1] = hdev->major_class;
616 cod[2] = get_service_classes(hdev);
618 if (
memcmp(cod, hdev->dev_class, 3) == 0)
644 static void mgmt_init_hdev(
struct sock *sk,
struct hci_dev *hdev)
659 static int read_controller_info(
struct sock *sk,
struct hci_dev *hdev,
660 void *data,
u16 data_len)
668 memset(&rp, 0,
sizeof(rp));
670 bacpy(&rp.bdaddr, &hdev->
bdaddr);
675 rp.supported_settings =
cpu_to_le32(get_supported_settings(hdev));
676 rp.current_settings =
cpu_to_le32(get_current_settings(hdev));
689 static void mgmt_pending_free(
struct pending_cmd *cmd)
697 struct hci_dev *hdev,
void *data,
726 static void mgmt_pending_foreach(
u16 opcode,
struct hci_dev *hdev,
738 if (opcode > 0 && cmd->
opcode != opcode)
750 if (cmd->
opcode == opcode)
757 static void mgmt_pending_remove(
struct pending_cmd *cmd)
760 mgmt_pending_free(cmd);
763 static int send_settings_rsp(
struct sock *sk,
u16 opcode,
struct hci_dev *hdev)
767 return cmd_complete(sk, hdev->
id, opcode, 0, &settings,
771 static int set_powered(
struct sock *sk,
struct hci_dev *hdev,
void *data,
822 struct sock *skip_sk)
827 skb = alloc_skb(
sizeof(*hdr) + data_len,
GFP_KERNEL);
831 hdr = (
void *)
skb_put(skb,
sizeof(*hdr));
843 __net_timestamp(skb);
860 static int set_discoverable(
struct sock *sk,
struct hci_dev *hdev,
void *data,
872 if (!cp->
val && timeout > 0)
910 err = new_settings(hdev, sk);
921 if (cp->
val && timeout > 0) {
946 mgmt_pending_remove(cmd);
956 static int set_connectable(
struct sock *sk,
struct hci_dev *hdev,
void *data,
969 bool changed =
false;
986 err = new_settings(hdev, sk);
1021 mgmt_pending_remove(cmd);
1028 static int set_pairable(
struct sock *sk,
struct hci_dev *hdev,
void *data,
1047 err = new_settings(hdev, sk);
1054 static int set_link_security(
struct sock *sk,
struct hci_dev *hdev,
void *data,
1067 bool changed =
false;
1080 err = new_settings(hdev, sk);
1106 mgmt_pending_remove(cmd);
1115 static int set_ssp(
struct sock *sk,
struct hci_dev *hdev,
void *data,
u16 len)
1135 bool changed =
false;
1147 err = new_settings(hdev, sk);
1171 mgmt_pending_remove(cmd);
1180 static int set_hs(
struct sock *sk,
struct hci_dev *hdev,
void *data,
u16 len)
1198 static int set_le(
struct sock *sk,
struct hci_dev *hdev,
void *data,
u16 len)
1220 bool changed =
false;
1232 err = new_settings(hdev, sk);
1249 memset(&hci_cp, 0,
sizeof(hci_cp));
1259 mgmt_pending_remove(cmd);
1266 static int add_uuid(
struct sock *sk,
struct hci_dev *hdev,
void *data,
u16 len)
1294 err = update_class(hdev);
1298 err = update_eir(hdev);
1317 static bool enable_service_cache(
struct hci_dev *hdev)
1330 static int remove_uuid(
struct sock *sk,
struct hci_dev *hdev,
void *data,
1336 u8 bt_uuid_any[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
1349 if (
memcmp(cp->
uuid, bt_uuid_any, 16) == 0) {
1352 if (enable_service_cache(hdev)) {
1381 err = update_class(hdev);
1385 err = update_eir(hdev);
1404 static int set_dev_class(
struct sock *sk,
struct hci_dev *hdev,
void *data,
1437 err = update_class(hdev);
1456 static int load_link_keys(
struct sock *sk,
struct hci_dev *hdev,
void *data,
1465 expected_len =
sizeof(*cp) + key_count *
1467 if (expected_len != len) {
1468 BT_ERR(
"load_link_keys: expected %u bytes, got %u bytes",
1488 for (i = 0; i < key_count; i++) {
1502 static int device_unpaired(
struct hci_dev *hdev, bdaddr_t *bdaddr,
1503 u8 addr_type,
struct sock *skip_sk)
1507 bacpy(&ev.addr.bdaddr, bdaddr);
1508 ev.addr.type = addr_type;
1514 static int unpair_device(
struct sock *sk,
struct hci_dev *hdev,
void *data,
1526 memset(&rp, 0,
sizeof(rp));
1527 bacpy(&rp.addr.bdaddr, &cp->
addr.bdaddr);
1528 rp.addr.type = cp->
addr.type;
1549 conn = hci_conn_hash_lookup_ba(hdev,
ACL_LINK,
1552 conn = hci_conn_hash_lookup_ba(hdev,
LE_LINK,
1561 device_unpaired(hdev, &cp->
addr.bdaddr, cp->
addr.type, sk);
1576 mgmt_pending_remove(cmd);
1609 conn = hci_conn_hash_lookup_ba(hdev,
ACL_LINK,
1612 conn = hci_conn_hash_lookup_ba(hdev,
LE_LINK, &cp->
addr.bdaddr);
1631 mgmt_pending_remove(cmd);
1638 static u8 link_to_bdaddr(
u8 link_type,
u8 addr_type)
1640 switch (link_type) {
1642 switch (addr_type) {
1657 static int get_connections(
struct sock *sk,
struct hci_dev *hdev,
void *data,
1693 bacpy(&rp->addr[i].bdaddr, &c->
dst);
1715 static int send_pin_code_neg_reply(
struct sock *sk,
struct hci_dev *hdev,
1727 sizeof(cp->
addr.bdaddr), &cp->
addr.bdaddr);
1729 mgmt_pending_remove(cmd);
1734 static int pin_code_reply(
struct sock *sk,
struct hci_dev *hdev,
void *data,
1753 conn = hci_conn_hash_lookup_ba(hdev,
ACL_LINK, &cp->
addr.bdaddr);
1763 memcpy(&ncp.addr, &cp->
addr,
sizeof(ncp.addr));
1765 BT_ERR(
"PIN code is not 16 bytes long");
1767 err = send_pin_code_neg_reply(sk, hdev, &ncp);
1781 bacpy(&reply.bdaddr, &cp->
addr.bdaddr);
1787 mgmt_pending_remove(cmd);
1794 static int set_io_capability(
struct sock *sk,
struct hci_dev *hdev,
void *data,
1805 BT_DBG(
"%s IO capability set to 0x%02x", hdev->
name,
1832 static void pairing_complete(
struct pending_cmd *cmd,
u8 status)
1837 bacpy(&rp.addr.bdaddr, &conn->
dst);
1838 rp.addr.type = link_to_bdaddr(conn->
type, conn->
dst_type);
1850 mgmt_pending_remove(cmd);
1853 static void pairing_complete_cb(
struct hci_conn *conn,
u8 status)
1857 BT_DBG(
"status %u", status);
1859 cmd = find_pairing(conn);
1861 BT_DBG(
"Unable to find a pending command");
1863 pairing_complete(cmd, mgmt_status(status));
1866 static void le_connect_complete_cb(
struct hci_conn *conn,
u8 status)
1870 BT_DBG(
"status %u", status);
1875 cmd = find_pairing(conn);
1877 BT_DBG(
"Unable to find a pending command");
1879 pairing_complete(cmd, mgmt_status(status));
1882 static int pair_device(
struct sock *sk,
struct hci_dev *hdev,
void *data,
1888 u8 sec_level, auth_type;
1910 cp->
addr.type, sec_level, auth_type);
1913 cp->
addr.type, sec_level, auth_type);
1915 memset(&rp, 0,
sizeof(rp));
1916 bacpy(&rp.addr.bdaddr, &cp->
addr.bdaddr);
1917 rp.addr.type = cp->
addr.type;
1922 if (PTR_ERR(conn) == -
EBUSY)
1960 pairing_complete(cmd, 0);
1969 static int cancel_pair_device(
struct sock *sk,
struct hci_dev *hdev,
void *data,
1996 if (bacmp(&addr->
bdaddr, &conn->
dst) != 0) {
2005 addr,
sizeof(*addr));
2011 static int user_pairing_resp(
struct sock *sk,
struct hci_dev *hdev,
2028 conn = hci_conn_hash_lookup_ba(hdev,
ACL_LINK, bdaddr);
2030 conn = hci_conn_hash_lookup_ba(hdev,
LE_LINK, bdaddr);
2052 cmd = mgmt_pending_add(sk, mgmt_op, hdev, bdaddr,
sizeof(*bdaddr));
2062 bacpy(&cp.bdaddr, bdaddr);
2066 err =
hci_send_cmd(hdev, hci_op,
sizeof(*bdaddr), bdaddr);
2069 mgmt_pending_remove(cmd);
2076 static int pin_code_neg_reply(
struct sock *sk,
struct hci_dev *hdev,
2077 void *data,
u16 len)
2083 return user_pairing_resp(sk, hdev, &cp->
addr.bdaddr, cp->
addr.type,
2088 static int user_confirm_reply(
struct sock *sk,
struct hci_dev *hdev,
void *data,
2095 if (len !=
sizeof(*cp))
2099 return user_pairing_resp(sk, hdev, &cp->
addr.bdaddr, cp->
addr.type,
2104 static int user_confirm_neg_reply(
struct sock *sk,
struct hci_dev *hdev,
2105 void *data,
u16 len)
2111 return user_pairing_resp(sk, hdev, &cp->
addr.bdaddr, cp->
addr.type,
2116 static int user_passkey_reply(
struct sock *sk,
struct hci_dev *hdev,
void *data,
2123 return user_pairing_resp(sk, hdev, &cp->
addr.bdaddr, cp->
addr.type,
2128 static int user_passkey_neg_reply(
struct sock *sk,
struct hci_dev *hdev,
2129 void *data,
u16 len)
2135 return user_pairing_resp(sk, hdev, &cp->
addr.bdaddr, cp->
addr.type,
2140 static int update_name(
struct hci_dev *hdev,
const char *
name)
2144 memcpy(cp.name, name,
sizeof(cp.name));
2149 static int set_local_name(
struct sock *sk,
struct hci_dev *hdev,
void *data,
2182 err = update_name(hdev, cp->
name);
2184 mgmt_pending_remove(cmd);
2191 static int read_local_oob_data(
struct sock *sk,
struct hci_dev *hdev,
2192 void *data,
u16 data_len)
2227 mgmt_pending_remove(cmd);
2234 static int add_remote_oob_data(
struct sock *sk,
struct hci_dev *hdev,
2235 void *data,
u16 len)
2267 static int remove_remote_oob_data(
struct sock *sk,
struct hci_dev *hdev,
2268 void *data,
u16 len)
2279 err = cmd_complete(sk, hdev->
id,
2293 status, &cp->
addr,
sizeof(cp->
addr));
2317 static int start_discovery(
struct sock *sk,
struct hci_dev *hdev,
2318 void *data,
u16 len)
2340 if (hdev->
discovery.state != DISCOVERY_STOPPED) {
2384 mgmt_pending_remove(cmd);
2393 static int stop_discovery(
struct sock *sk,
struct hci_dev *hdev,
void *data,
2409 sizeof(mgmt_cp->
type));
2416 sizeof(mgmt_cp->
type));
2427 case DISCOVERY_FINDING:
2435 case DISCOVERY_RESOLVING:
2439 mgmt_pending_remove(cmd);
2440 err = cmd_complete(sk, hdev->
id,
2443 sizeof(mgmt_cp->
type));
2448 bacpy(&cp.bdaddr, &e->
data.bdaddr);
2460 mgmt_pending_remove(cmd);
2469 static int confirm_name(
struct sock *sk,
struct hci_dev *hdev,
void *data,
2533 static int unblock_device(
struct sock *sk,
struct hci_dev *hdev,
void *data,
2558 static int set_device_id(
struct sock *sk,
struct hci_dev *hdev,
void *data,
2569 if (source > 0x0002)
2589 static int set_fast_connectable(
struct sock *sk,
struct hci_dev *hdev,
2590 void *data,
u16 len)
2646 static int load_long_term_keys(
struct sock *sk,
struct hci_dev *hdev,
2647 void *cp_data,
u16 len)
2655 expected_len =
sizeof(*cp) + key_count *
2657 if (expected_len != len) {
2658 BT_ERR(
"load_keys: expected %u bytes, got %u bytes",
2664 BT_DBG(
"%s key_count %u", hdev->
name, key_count);
2670 for (i = 0; i < key_count; i++) {
2690 static const struct mgmt_handler {
2695 } mgmt_handlers[] = {
2747 const struct mgmt_handler *
handler;
2750 BT_DBG(
"got %zu bytes", msglen);
2752 if (msglen <
sizeof(*hdr))
2769 if (len != msglen -
sizeof(*hdr)) {
2784 mgmt_handlers[opcode].
func ==
NULL) {
2785 BT_DBG(
"Unknown op %u", opcode);
2798 handler = &mgmt_handlers[
opcode];
2800 if ((handler->var_len && len < handler->data_len) ||
2801 (!handler->var_len && len != handler->data_len)) {
2808 mgmt_init_hdev(sk, hdev);
2810 cp = buf +
sizeof(*hdr);
2812 err = handler->func(sk, hdev, cp, len);
2826 static void cmd_status_rsp(
struct pending_cmd *cmd,
void *data)
2831 mgmt_pending_remove(cmd);
2849 mgmt_pending_foreach(0, hdev, cmd_status_rsp, &status);
2860 static void settings_rsp(
struct pending_cmd *cmd,
void *data)
2869 match->
sk = cmd->
sk;
2870 sock_hold(match->
sk);
2873 mgmt_pending_free(cmd);
2918 mgmt_pending_foreach(0, hdev, cmd_status_rsp, &status);
2921 err = new_settings(hdev, match.
sk);
2932 bool changed =
false;
2947 err = new_settings(hdev, match.
sk);
2958 bool changed =
false;
2973 err = new_settings(hdev, match.
sk);
2987 cmd_status_rsp, &mgmt_err);
2991 cmd_status_rsp, &mgmt_err);
3001 memset(&ev, 0,
sizeof(ev));
3004 bacpy(&ev.
key.addr.bdaddr, &key->
bdaddr);
3017 memset(&ev, 0,
sizeof(ev));
3020 bacpy(&ev.
key.addr.bdaddr, &key->
bdaddr);
3044 bacpy(&ev->
addr.bdaddr, bdaddr);
3045 ev->
addr.type = link_to_bdaddr(link_type, addr_type);
3053 if (dev_class &&
memcmp(dev_class,
"\0\0\0", 3) != 0)
3054 eir_len = eir_append_data(ev->
eir, eir_len,
3060 sizeof(*ev) + eir_len,
NULL);
3063 static void disconnect_rsp(
struct pending_cmd *cmd,
void *data)
3069 bacpy(&rp.addr.bdaddr, &cp->
addr.bdaddr);
3070 rp.addr.type = cp->
addr.type;
3078 mgmt_pending_remove(cmd);
3081 static void unpair_device_rsp(
struct pending_cmd *cmd,
void *data)
3087 memset(&rp, 0,
sizeof(rp));
3088 bacpy(&rp.addr.bdaddr, &cp->
addr.bdaddr);
3089 rp.addr.type = cp->
addr.type;
3091 device_unpaired(hdev, &cp->
addr.bdaddr, cp->
addr.type, cmd->
sk);
3093 cmd_complete(cmd->
sk, cmd->
index, cmd->
opcode, 0, &rp,
sizeof(rp));
3095 mgmt_pending_remove(cmd);
3107 bacpy(&ev.
addr.bdaddr, bdaddr);
3108 ev.
addr.type = link_to_bdaddr(link_type, addr_type);
3124 u8 link_type,
u8 addr_type,
u8 status)
3134 bacpy(&rp.
addr.bdaddr, bdaddr);
3135 rp.
addr.type = link_to_bdaddr(link_type, addr_type);
3138 mgmt_status(status), &rp,
sizeof(rp));
3140 mgmt_pending_remove(cmd);
3148 u8 addr_type,
u8 status)
3152 bacpy(&ev.
addr.bdaddr, bdaddr);
3153 ev.
addr.type = link_to_bdaddr(link_type, addr_type);
3154 ev.
status = mgmt_status(status);
3163 bacpy(&ev.
addr.bdaddr, bdaddr);
3182 bacpy(&rp.
addr.bdaddr, bdaddr);
3186 mgmt_status(status), &rp,
sizeof(rp));
3188 mgmt_pending_remove(cmd);
3204 bacpy(&rp.
addr.bdaddr, bdaddr);
3208 mgmt_status(status), &rp,
sizeof(rp));
3210 mgmt_pending_remove(cmd);
3223 bacpy(&ev.
addr.bdaddr, bdaddr);
3224 ev.
addr.type = link_to_bdaddr(link_type, addr_type);
3233 u8 link_type,
u8 addr_type)
3239 bacpy(&ev.
addr.bdaddr, bdaddr);
3240 ev.
addr.type = link_to_bdaddr(link_type, addr_type);
3246 static int user_pairing_resp_complete(
struct hci_dev *hdev, bdaddr_t *bdaddr,
3247 u8 link_type,
u8 addr_type,
u8 status,
3254 cmd = mgmt_pending_find(opcode, hdev);
3258 bacpy(&rp.addr.bdaddr, bdaddr);
3259 rp.addr.type = link_to_bdaddr(link_type, addr_type);
3260 err = cmd_complete(cmd->
sk, hdev->
id, opcode, mgmt_status(status),
3263 mgmt_pending_remove(cmd);
3269 u8 link_type,
u8 addr_type,
u8 status)
3271 return user_pairing_resp_complete(hdev, bdaddr, link_type, addr_type,
3276 u8 link_type,
u8 addr_type,
u8 status)
3278 return user_pairing_resp_complete(hdev, bdaddr, link_type, addr_type,
3284 u8 link_type,
u8 addr_type,
u8 status)
3286 return user_pairing_resp_complete(hdev, bdaddr, link_type, addr_type,
3291 u8 link_type,
u8 addr_type,
u8 status)
3293 return user_pairing_resp_complete(hdev, bdaddr, link_type, addr_type,
3299 u8 link_type,
u8 addr_type,
u32 passkey,
3306 bacpy(&ev.
addr.bdaddr, bdaddr);
3307 ev.
addr.type = link_to_bdaddr(link_type, addr_type);
3315 u8 addr_type,
u8 status)
3319 bacpy(&ev.
addr.bdaddr, bdaddr);
3320 ev.
addr.type = link_to_bdaddr(link_type, addr_type);
3321 ev.
status = mgmt_status(status);
3329 bool changed =
false;
3335 cmd_status_rsp, &mgmt_err);
3351 err = new_settings(hdev, match.
sk);
3359 static int clear_eir(
struct hci_dev *hdev)
3368 memset(&cp, 0,
sizeof(cp));
3376 bool changed =
false;
3384 err = new_settings(hdev,
NULL);
3403 err = new_settings(hdev, match.
sk);
3416 static void class_rsp(
struct pending_cmd *cmd,
void *data)
3421 match->
hdev->dev_class, 3);
3426 match->
sk = cmd->
sk;
3427 sock_hold(match->
sk);
3430 mgmt_pending_free(cmd);
3459 bool changed =
false;
3467 memset(&ev, 0,
sizeof(ev));
3481 mgmt_status(status));
3493 sizeof(ev), cmd ? cmd->
sk :
NULL);
3499 mgmt_pending_remove(cmd);
3504 u8 *randomizer,
u8 status)
3517 mgmt_status(status));
3524 err = cmd_complete(cmd->
sk, hdev->
id,
3529 mgmt_pending_remove(cmd);
3537 bool changed =
false;
3545 err = new_settings(hdev,
NULL);
3561 mgmt_pending_foreach(
MGMT_OP_SET_LE, hdev, settings_rsp, &match);
3564 err = new_settings(hdev, match.
sk);
3581 if (
sizeof(*ev) + eir_len + 5 >
sizeof(
buf))
3584 memset(buf, 0,
sizeof(buf));
3586 bacpy(&ev->
addr.bdaddr, bdaddr);
3587 ev->
addr.type = link_to_bdaddr(link_type, addr_type);
3602 ev_size =
sizeof(*ev) +
eir_len;
3616 memset(buf, 0,
sizeof(buf));
3618 bacpy(&ev->
addr.bdaddr, bdaddr);
3619 ev->
addr.type = link_to_bdaddr(link_type, addr_type);
3628 sizeof(*ev) + eir_len,
NULL);
3645 err = cmd_complete(cmd->
sk, hdev->
id, cmd->
opcode, mgmt_status(status),
3646 &type,
sizeof(type));
3647 mgmt_pending_remove(cmd);
3661 err = cmd_complete(cmd->
sk, hdev->
id, cmd->
opcode, mgmt_status(status),
3663 mgmt_pending_remove(cmd);
3673 BT_DBG(
"%s discovering %u", hdev->
name, discovering);
3683 cmd_complete(cmd->
sk, hdev->
id, cmd->
opcode, 0, &type,
3685 mgmt_pending_remove(cmd);
3688 memset(&ev, 0,
sizeof(ev));
3702 bacpy(&ev.
addr.bdaddr, bdaddr);
3706 cmd ? cmd->sk :
NULL);
3716 bacpy(&ev.
addr.bdaddr, bdaddr);
3720 cmd ? cmd->sk :
NULL);