Commit 450dfdaf authored by Johan Hedberg's avatar Johan Hedberg Committed by Gustavo F. Padovan

Bluetooth: Pass all message parameters to mgmt_start_discovery

The mgmt_start_discovery command contains the type of discovery that
should be started so this should be passed to the start_discovery
function. This patch doesn't yet add any action depending on the type of
the requested discovery.
Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
Acked-by: default avatarMarcel Holtmann <marcel@holtmann.org>
Signed-off-by: default avatarGustavo F. Padovan <padovan@profusion.mobi>
parent 0e5f875a
...@@ -232,6 +232,9 @@ struct mgmt_cp_remove_remote_oob_data { ...@@ -232,6 +232,9 @@ struct mgmt_cp_remove_remote_oob_data {
} __packed; } __packed;
#define MGMT_OP_START_DISCOVERY 0x001B #define MGMT_OP_START_DISCOVERY 0x001B
struct mgmt_cp_start_discovery {
__u8 type;
} __packed;
#define MGMT_OP_STOP_DISCOVERY 0x001C #define MGMT_OP_STOP_DISCOVERY 0x001C
......
...@@ -1779,14 +1779,20 @@ static int remove_remote_oob_data(struct sock *sk, u16 index, ...@@ -1779,14 +1779,20 @@ static int remove_remote_oob_data(struct sock *sk, u16 index,
return err; return err;
} }
static int start_discovery(struct sock *sk, u16 index) static int start_discovery(struct sock *sk, u16 index,
unsigned char *data, u16 len)
{ {
struct mgmt_cp_start_discovery *cp = (void *) data;
struct pending_cmd *cmd; struct pending_cmd *cmd;
struct hci_dev *hdev; struct hci_dev *hdev;
int err; int err;
BT_DBG("hci%u", index); BT_DBG("hci%u", index);
if (len != sizeof(*cp))
return cmd_status(sk, index, MGMT_OP_START_DISCOVERY,
MGMT_STATUS_INVALID_PARAMS);
hdev = hci_dev_get(index); hdev = hci_dev_get(index);
if (!hdev) if (!hdev)
return cmd_status(sk, index, MGMT_OP_START_DISCOVERY, return cmd_status(sk, index, MGMT_OP_START_DISCOVERY,
...@@ -2083,7 +2089,7 @@ int mgmt_control(struct sock *sk, struct msghdr *msg, size_t msglen) ...@@ -2083,7 +2089,7 @@ int mgmt_control(struct sock *sk, struct msghdr *msg, size_t msglen)
len); len);
break; break;
case MGMT_OP_START_DISCOVERY: case MGMT_OP_START_DISCOVERY:
err = start_discovery(sk, index); err = start_discovery(sk, index, buf + sizeof(*hdr), len);
break; break;
case MGMT_OP_STOP_DISCOVERY: case MGMT_OP_STOP_DISCOVERY:
err = stop_discovery(sk, index); err = stop_discovery(sk, index);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment