diff options
author | Johan Hedberg <johan.hedberg@intel.com> | 2011-11-12 04:58:22 -0500 |
---|---|---|
committer | Gustavo F. Padovan <padovan@profusion.mobi> | 2011-11-16 13:32:00 -0500 |
commit | 450dfdafbcfbf19e39481d0e4737a832b991333a (patch) | |
tree | f94833b7b2ea9d96620a8320daf41ee07b4b40ff | |
parent | 0e5f875a8f4fa78edf5762d6d0a9843e1d9ae85e (diff) |
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: Johan Hedberg <johan.hedberg@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
-rw-r--r-- | include/net/bluetooth/mgmt.h | 3 | ||||
-rw-r--r-- | net/bluetooth/mgmt.c | 10 |
2 files changed, 11 insertions, 2 deletions
diff --git a/include/net/bluetooth/mgmt.h b/include/net/bluetooth/mgmt.h index bd6995d69931..2e501820f728 100644 --- a/include/net/bluetooth/mgmt.h +++ b/include/net/bluetooth/mgmt.h | |||
@@ -232,6 +232,9 @@ struct mgmt_cp_remove_remote_oob_data { | |||
232 | } __packed; | 232 | } __packed; |
233 | 233 | ||
234 | #define MGMT_OP_START_DISCOVERY 0x001B | 234 | #define MGMT_OP_START_DISCOVERY 0x001B |
235 | struct mgmt_cp_start_discovery { | ||
236 | __u8 type; | ||
237 | } __packed; | ||
235 | 238 | ||
236 | #define MGMT_OP_STOP_DISCOVERY 0x001C | 239 | #define MGMT_OP_STOP_DISCOVERY 0x001C |
237 | 240 | ||
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index e4a353cfa97d..1ae14c91bb0c 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c | |||
@@ -1779,14 +1779,20 @@ static int remove_remote_oob_data(struct sock *sk, u16 index, | |||
1779 | return err; | 1779 | return err; |
1780 | } | 1780 | } |
1781 | 1781 | ||
1782 | static int start_discovery(struct sock *sk, u16 index) | 1782 | static int start_discovery(struct sock *sk, u16 index, |
1783 | unsigned char *data, u16 len) | ||
1783 | { | 1784 | { |
1785 | struct mgmt_cp_start_discovery *cp = (void *) data; | ||
1784 | struct pending_cmd *cmd; | 1786 | struct pending_cmd *cmd; |
1785 | struct hci_dev *hdev; | 1787 | struct hci_dev *hdev; |
1786 | int err; | 1788 | int err; |
1787 | 1789 | ||
1788 | BT_DBG("hci%u", index); | 1790 | BT_DBG("hci%u", index); |
1789 | 1791 | ||
1792 | if (len != sizeof(*cp)) | ||
1793 | return cmd_status(sk, index, MGMT_OP_START_DISCOVERY, | ||
1794 | MGMT_STATUS_INVALID_PARAMS); | ||
1795 | |||
1790 | hdev = hci_dev_get(index); | 1796 | hdev = hci_dev_get(index); |
1791 | if (!hdev) | 1797 | if (!hdev) |
1792 | return cmd_status(sk, index, MGMT_OP_START_DISCOVERY, | 1798 | 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 | len); | 2089 | len); |
2084 | break; | 2090 | break; |
2085 | case MGMT_OP_START_DISCOVERY: | 2091 | case MGMT_OP_START_DISCOVERY: |
2086 | err = start_discovery(sk, index); | 2092 | err = start_discovery(sk, index, buf + sizeof(*hdr), len); |
2087 | break; | 2093 | break; |
2088 | case MGMT_OP_STOP_DISCOVERY: | 2094 | case MGMT_OP_STOP_DISCOVERY: |
2089 | err = stop_discovery(sk, index); | 2095 | err = stop_discovery(sk, index); |