提交 ac56fb13 编写于 作者: J Johan Hedberg 提交者: Gustavo F. Padovan

Bluetooth: Fix mgmt_pin_code_reply return parameters

The command complete event for mgmt_pin_code_reply &
mgmt_pin_code_neg_reply should have the adapter index, Bluetooth address
as well as the status.
Signed-off-by: NJohan Hedberg <johan.hedberg@nokia.com>
Signed-off-by: NGustavo F. Padovan <padovan@profusion.mobi>
上级 59a24b5d
...@@ -147,6 +147,11 @@ struct mgmt_cp_pin_code_reply { ...@@ -147,6 +147,11 @@ struct mgmt_cp_pin_code_reply {
__u8 pin_len; __u8 pin_len;
__u8 pin_code[16]; __u8 pin_code[16];
} __packed; } __packed;
struct mgmt_rp_pin_code_reply {
__le16 index;
bdaddr_t bdaddr;
uint8_t status;
} __packed;
#define MGMT_OP_PIN_CODE_NEG_REPLY 0x0012 #define MGMT_OP_PIN_CODE_NEG_REPLY 0x0012
struct mgmt_cp_pin_code_neg_reply { struct mgmt_cp_pin_code_neg_reply {
......
...@@ -1558,17 +1558,18 @@ int mgmt_pin_code_request(u16 index, bdaddr_t *bdaddr) ...@@ -1558,17 +1558,18 @@ int mgmt_pin_code_request(u16 index, bdaddr_t *bdaddr)
int mgmt_pin_code_reply_complete(u16 index, bdaddr_t *bdaddr, u8 status) int mgmt_pin_code_reply_complete(u16 index, bdaddr_t *bdaddr, u8 status)
{ {
struct pending_cmd *cmd; struct pending_cmd *cmd;
struct mgmt_rp_pin_code_reply rp;
int err; int err;
cmd = mgmt_pending_find(MGMT_OP_PIN_CODE_REPLY, index); cmd = mgmt_pending_find(MGMT_OP_PIN_CODE_REPLY, index);
if (!cmd) if (!cmd)
return -ENOENT; return -ENOENT;
if (status != 0) put_unaligned_le16(index, &rp.index);
err = cmd_status(cmd->sk, MGMT_OP_PIN_CODE_REPLY, status); bacpy(&rp.bdaddr, bdaddr);
else rp.status = status;
err = cmd_complete(cmd->sk, MGMT_OP_PIN_CODE_REPLY,
bdaddr, sizeof(*bdaddr)); err = cmd_complete(cmd->sk, MGMT_OP_PIN_CODE_REPLY, &rp, sizeof(rp));
list_del(&cmd->list); list_del(&cmd->list);
mgmt_pending_free(cmd); mgmt_pending_free(cmd);
...@@ -1579,17 +1580,19 @@ int mgmt_pin_code_reply_complete(u16 index, bdaddr_t *bdaddr, u8 status) ...@@ -1579,17 +1580,19 @@ int mgmt_pin_code_reply_complete(u16 index, bdaddr_t *bdaddr, u8 status)
int mgmt_pin_code_neg_reply_complete(u16 index, bdaddr_t *bdaddr, u8 status) int mgmt_pin_code_neg_reply_complete(u16 index, bdaddr_t *bdaddr, u8 status)
{ {
struct pending_cmd *cmd; struct pending_cmd *cmd;
struct mgmt_rp_pin_code_reply rp;
int err; int err;
cmd = mgmt_pending_find(MGMT_OP_PIN_CODE_NEG_REPLY, index); cmd = mgmt_pending_find(MGMT_OP_PIN_CODE_NEG_REPLY, index);
if (!cmd) if (!cmd)
return -ENOENT; return -ENOENT;
if (status != 0) put_unaligned_le16(index, &rp.index);
err = cmd_status(cmd->sk, MGMT_OP_PIN_CODE_NEG_REPLY, status); bacpy(&rp.bdaddr, bdaddr);
else rp.status = status;
err = cmd_complete(cmd->sk, MGMT_OP_PIN_CODE_NEG_REPLY,
bdaddr, sizeof(*bdaddr)); err = cmd_complete(cmd->sk, MGMT_OP_PIN_CODE_NEG_REPLY,
&rp, sizeof(rp));
list_del(&cmd->list); list_del(&cmd->list);
mgmt_pending_free(cmd); mgmt_pending_free(cmd);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册