More Management interface patches
Subsystems (2)
cover More Management interface patches
Hi,
Here's a new set of patches for the Management interface. Combined with the latest user space git these patches enable both legacy and Secure Simple Pairing procedures. After these the only big missing feature in the management interface is device discovery which I'm just about to start working on.
Johan
PATCH 1/8 Bluetooth: Make pending_add return a pointer to the added entry
From: Johan Hedberg <[email protected]>
This makes it more convenient to do manipulations on the entry (needed by later commits).
--- net/bluetooth/mgmt.c | 62 ++++++++++++++++++++++++++++++++----------------- 1 files changed, 40 insertions(+), 22 deletions(-)
net/bluetooth/mgmt.c +40 -22
@@ -219,14 +219,14 @@ static void mgmt_pending_free(struct pending_cmd *cmd)kfree (cmd); } -static int mgmt_pending_add (struct sock *sk,u16 opcode,int index, -void *data,u16 len) +static struct pending_cmd *mgmt_pending_add (struct sock *sk,u16 opcode, +u16 index,void *data,u16 len) {struct pending_cmd *cmd; cmd =kmalloc (sizeof (*cmd),GFP_ATOMIC );if (!cmd) -return -ENOMEM ; +return NULL ; cmd->opcode = opcode; cmd->index = index;
@@ -234,7 +234,7 @@ static int mgmt_pending_add(struct sock *sk, u16 opcode, int index, cmd->cmd =kmalloc (len,GFP_ATOMIC );if (!cmd->cmd) {kfree (cmd); -return -ENOMEM ; +return NULL ; }memcpy (cmd->cmd, data, len);
@@ -244,7 +244,7 @@ static int mgmt_pending_add(struct sock *sk, u16 opcode, int index,list_add (&cmd->list, &cmd_list); -return 0 ; +return cmd; } static void mgmt_pending_foreach(u16 opcode, int index,
@@ -305,8 +305,9 @@ static int set_powered(struct sock *sk, unsigned char *data, u16 len) {struct mgmt_mode *cp;struct hci_dev *hdev; +struct pending_cmd *cmd;u16 dev_id; -int ret, up; +int err, up; cp = (void *) data; dev_id =get_unaligned_le16 (&cp->index);
@@ -321,36 +322,39 @@ static int set_powered(struct sock *sk, unsigned char *data, u16 len) up =test_bit (HCI_UP , &hdev->flags);if ((cp->val && up) || (!cp->val && !up)) { - ret =cmd_status (sk,MGMT_OP_SET_POWERED ,EALREADY ); + err =cmd_status (sk,MGMT_OP_SET_POWERED ,EALREADY ); goto failed; }if (mgmt_pending_find (MGMT_OP_SET_POWERED , dev_id)) { - ret =cmd_status (sk,MGMT_OP_SET_POWERED ,EBUSY ); + err =cmd_status (sk,MGMT_OP_SET_POWERED ,EBUSY ); goto failed; } - ret =mgmt_pending_add (sk,MGMT_OP_SET_POWERED , dev_id, data, len); -if (ret <0 ) + cmd =mgmt_pending_add (sk,MGMT_OP_SET_POWERED , dev_id, data, len); +if (!cmd) { + err = -ENOMEM ; goto failed; + }if (cp->val)queue_work (hdev->workqueue, &hdev->power_on);else queue_work (hdev->workqueue, &hdev->power_off); - ret =0 ; + err =0 ; failed:hci_dev_unlock_bh (hdev);hci_dev_put (hdev); -return ret; +return err; }static int set_discoverable (struct sock *sk,unsigned char *data,u16 len) {struct mgmt_mode *cp;struct hci_dev *hdev; +struct pending_cmd *cmd;u16 dev_id;u8 scan;int err;
@@ -383,9 +387,11 @@ static int set_discoverable(struct sock *sk, unsigned char *data, u16 len) goto failed; } - err =mgmt_pending_add (sk,MGMT_OP_SET_DISCOVERABLE , dev_id, data, len); -if (err <0 ) + cmd =mgmt_pending_add (sk,MGMT_OP_SET_DISCOVERABLE , dev_id, data, len); +if (!cmd) { + err = -ENOMEM ; goto failed; + } scan =SCAN_PAGE ;
@@ -407,6 +413,7 @@ static int set_connectable(struct sock *sk, unsigned char *data, u16 len) {struct mgmt_mode *cp;struct hci_dev *hdev; +struct pending_cmd *cmd;u16 dev_id;u8 scan;int err;
@@ -438,9 +445,11 @@ static int set_connectable(struct sock *sk, unsigned char *data, u16 len) goto failed; } - err =mgmt_pending_add (sk,MGMT_OP_SET_CONNECTABLE , dev_id, data, len); -if (err <0 ) + cmd =mgmt_pending_add (sk,MGMT_OP_SET_CONNECTABLE , dev_id, data, len); +if (!cmd) { + err = -ENOMEM ; goto failed; + }if (cp->val) scan =SCAN_PAGE ;
@@ -828,6 +837,7 @@ static int disconnect(struct sock *sk, unsigned char *data, u16 len)struct hci_dev *hdev;struct mgmt_cp_disconnect *cp;struct hci_cp_disconnect dc; +struct pending_cmd *cmd;struct hci_conn *conn;u16 dev_id;int err;
@@ -859,9 +869,11 @@ static int disconnect(struct sock *sk, unsigned char *data, u16 len) goto failed; } - err =mgmt_pending_add (sk,MGMT_OP_DISCONNECT , dev_id, data, len); -if (err <0 ) + cmd =mgmt_pending_add (sk,MGMT_OP_DISCONNECT , dev_id, data, len); +if (!cmd) { + err = -ENOMEM ; goto failed; + }put_unaligned_le16 (conn->handle, &dc.handle); dc.reason =0x13 ;/* Remote User Terminated Connection */
@@ -938,6 +950,7 @@ static int pin_code_reply(struct sock *sk, unsigned char *data, u16 len)struct hci_dev *hdev;struct mgmt_cp_pin_code_reply *cp;struct hci_cp_pin_code_reply reply; +struct pending_cmd *cmd;u16 dev_id;int err;
@@ -957,9 +970,11 @@ static int pin_code_reply(struct sock *sk, unsigned char *data, u16 len) goto failed; } - err =mgmt_pending_add (sk,MGMT_OP_PIN_CODE_REPLY , dev_id, data, len); -if (err <0 ) + cmd =mgmt_pending_add (sk,MGMT_OP_PIN_CODE_REPLY , dev_id, data, len); +if (!cmd) { + err = -ENOMEM ; goto failed; + }bacpy (&reply.bdaddr, &cp->bdaddr); reply.pin_len = cp->pin_len;
@@ -980,6 +995,7 @@ static int pin_code_neg_reply(struct sock *sk, unsigned char *data, u16 len) {struct hci_dev *hdev;struct mgmt_cp_pin_code_neg_reply *cp; +struct pending_cmd *cmd;u16 dev_id;int err;
@@ -999,10 +1015,12 @@ static int pin_code_neg_reply(struct sock *sk, unsigned char *data, u16 len) goto failed; } - err =mgmt_pending_add (sk,MGMT_OP_PIN_CODE_NEG_REPLY , dev_id, + cmd =mgmt_pending_add (sk,MGMT_OP_PIN_CODE_NEG_REPLY , dev_id, data, len); -if (err <0 ) +if (!cmd) { + err = -ENOMEM ; goto failed; + } err =hci_send_cmd (hdev,HCI_OP_PIN_CODE_NEG_REPLY ,sizeof (bdaddr_t), &cp->bdaddr);
Signature · 1 line
1.7.4.1
PATCH 2/8 Bluetooth: Add mgmt_pair_device command
In reply to [email protected]From: Johan Hedberg <[email protected]>
This patch adds a new mgmt_pair_device which can be used to initiate a dedicated bonding procedure. Some extra callbacks are added to the hci_conn struct so that the pairing code can get notified of the completion of the procedure.
--- include/net/bluetooth/hci_core.h | 16 +++++ include/net/bluetooth/mgmt.h | 12 ++++ net/bluetooth/mgmt.c | 133 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 161 insertions(+), 0 deletions(-)
include/net/bluetooth/hci_core.h +16 -0
@@ -248,6 +248,10 @@ struct hci_conn {void *priv;struct hci_conn *link; + +void (*connect_cfm_cb) (struct hci_conn *conn,u8 status); +void (*security_cfm_cb) (struct hci_conn *conn,u8 status); +void (*disconn_cfm_cb) (struct hci_conn *conn,u8 reason); };extern struct hci_proto *hci_proto[];
@@ -571,6 +575,9 @@ static inline void hci_proto_connect_cfm(struct hci_conn *conn, __u8 status) hp = hci_proto[HCI_PROTO_SCO ];if (hp && hp->connect_cfm) hp->connect_cfm (conn, status); + +if (conn->connect_cfm_cb) + conn->connect_cfm_cb (conn, status); }static inline int hci_proto_disconn_ind (struct hci_conn *conn)
@@ -600,6 +607,9 @@ static inline void hci_proto_disconn_cfm(struct hci_conn *conn, __u8 reason) hp = hci_proto[HCI_PROTO_SCO ];if (hp && hp->disconn_cfm) hp->disconn_cfm (conn, reason); + +if (conn->disconn_cfm_cb) + conn->disconn_cfm_cb (conn, reason); }static inline void hci_proto_auth_cfm (struct hci_conn *conn,__u8 status)
@@ -619,6 +629,9 @@ static inline void hci_proto_auth_cfm(struct hci_conn *conn, __u8 status) hp = hci_proto[HCI_PROTO_SCO ];if (hp && hp->security_cfm) hp->security_cfm (conn, status, encrypt); + +if (conn->security_cfm_cb) + conn->security_cfm_cb (conn, status); }static inline void hci_proto_encrypt_cfm (struct hci_conn *conn,__u8 status,__u8 encrypt)
@@ -632,6 +645,9 @@ static inline void hci_proto_encrypt_cfm(struct hci_conn *conn, __u8 status, __u hp = hci_proto[HCI_PROTO_SCO ];if (hp && hp->security_cfm) hp->security_cfm (conn, status, encrypt); + +if (conn->security_cfm_cb) + conn->security_cfm_cb (conn, status); }int hci_register_proto (struct hci_proto *hproto);
include/net/bluetooth/mgmt.h +12 -0
@@ -160,6 +160,18 @@ struct mgmt_cp_set_io_capability {__u8 io_capability; } __packed; +#define MGMT_OP_PAIR_DEVICE 0x0014 +struct mgmt_cp_pair_device { +__le16 index; +bdaddr_t bdaddr; +__u8 io_cap; +} __packed; +struct mgmt_rp_pair_device { +__le16 index; +bdaddr_t bdaddr; +__u8 status; +} __packed; +#define MGMT_EV_CMD_COMPLETE 0x0001struct mgmt_ev_cmd_complete {__le16 opcode;
net/bluetooth/mgmt.c +133 -0
151 lines not on this page · raw message
Signature · 1 line
1.7.4.1
PATCH 3/8 Bluetooth: Add management support for user confirmation request
In reply to [email protected]From: Johan Hedberg <[email protected]>
This patch adds support for the user confirmation (numeric comparison) Secure Simple Pairing authentication method.
--- include/net/bluetooth/hci.h | 17 ++++++ include/net/bluetooth/hci_core.h | 4 ++ include/net/bluetooth/mgmt.h | 20 +++++++ net/bluetooth/hci_event.c | 50 ++++++++++++++++++ net/bluetooth/mgmt.c | 103 ++++++++++++++++++++++++++++++++++++++ 5 files changed, 194 insertions(+), 0 deletions(-)
include/net/bluetooth/hci.h +17 -0
@@ -415,6 +415,17 @@ struct hci_cp_io_capability_reply {__u8 authentication; } __packed; +#define HCI_OP_USER_CONFIRM_REPLY 0x042c +struct hci_cp_user_confirm_reply { +bdaddr_t bdaddr; +} __packed; +struct hci_rp_user_confirm_reply { +__u8 status; +bdaddr_t bdaddr; +} __packed; + +#define HCI_OP_USER_CONFIRM_NEG_REPLY 0x042d +#define HCI_OP_IO_CAPABILITY_NEG_REPLY 0x0434struct hci_cp_io_capability_neg_reply {bdaddr_t bdaddr;
@@ -936,6 +947,12 @@ struct hci_ev_io_capa_reply {__u8 authentication; } __packed; +#define HCI_EV_USER_CONFIRM_REQUEST 0x33 +struct hci_ev_user_confirm_req { +bdaddr_t bdaddr; +__le32 passkey; +} __packed; +#define HCI_EV_SIMPLE_PAIR_COMPLETE 0x36struct hci_ev_simple_pair_complete {__u8 status;
include/net/bluetooth/hci_core.h +4 -0
@@ -762,6 +762,10 @@ int mgmt_connect_failed(u16 index, bdaddr_t *bdaddr, u8 status);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_neg_reply_complete (u16 index,bdaddr_t *bdaddr,u8 status); +int mgmt_user_confirm_request (u16 index,bdaddr_t *bdaddr,__le32 value); +int mgmt_user_confirm_reply_complete (u16 index,bdaddr_t *bdaddr,u8 status); +int mgmt_user_confirm_neg_reply_complete (u16 index,bdaddr_t *bdaddr, +u8 status);/* HCI info for socket */ #define hci_pi (sk) ((struct hci_pinfo *) sk)
include/net/bluetooth/mgmt.h +20 -0
@@ -172,6 +172,19 @@ struct mgmt_rp_pair_device {__u8 status; } __packed; +#define MGMT_OP_USER_CONFIRM_REPLY 0x0015 +struct mgmt_cp_user_confirm_reply { +__le16 index; +bdaddr_t bdaddr; +} __packed; +struct mgmt_rp_user_confirm_reply { +__le16 index; +bdaddr_t bdaddr; +__u8 status; +} __packed; + +#define MGMT_OP_USER_CONFIRM_NEG_REPLY 0x0016 +#define MGMT_EV_CMD_COMPLETE 0x0001struct mgmt_ev_cmd_complete {__le16 opcode;
@@ -239,3 +252,10 @@ struct mgmt_ev_pin_code_request {__le16 index;bdaddr_t bdaddr; } __packed; + +#define MGMT_EV_USER_CONFIRM_REQUEST 0x000F +struct mgmt_ev_user_confirm_request { +__le16 index; +bdaddr_t bdaddr; +__le32 value; +} __packed;
net/bluetooth/hci_event.c +50 -0
74 lines not on this page · raw message
net/bluetooth/mgmt.c +103 -0
118 lines not on this page · raw message
Signature · 1 line
1.7.4.1
PATCH 4/8 Bluetooth: Fix mgmt_pin_code_reply command status opcode
In reply to [email protected]From: Johan Hedberg <[email protected]>
The opcode for the ENODEV case was wrong (probably copy-paste mistake).
--- net/bluetooth/mgmt.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
net/bluetooth/mgmt.c +1 -1
@@ -962,7 +962,7 @@ static int pin_code_reply(struct sock *sk, unsigned char *data, u16 len) hdev =hci_dev_get (dev_id);if (!hdev) -return cmd_status (sk,MGMT_OP_DISCONNECT ,ENODEV ); +return cmd_status (sk,MGMT_OP_PIN_CODE_REPLY ,ENODEV );hci_dev_lock_bh (hdev);
Signature · 1 line
1.7.4.1
PATCH 5/8 Bluetooth: Fix mgmt_pin_code_reply return parameters
In reply to [email protected]From: Johan Hedberg <[email protected]>
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.
--- include/net/bluetooth/mgmt.h | 5 +++++ net/bluetooth/mgmt.c | 23 +++++++++++++---------- 2 files changed, 18 insertions(+), 10 deletions(-)
include/net/bluetooth/mgmt.h +5 -0
@@ -147,6 +147,11 @@ struct mgmt_cp_pin_code_reply {__u8 pin_len;__u8 pin_code[16 ]; } __packed; +struct mgmt_rp_pin_code_reply { +__le16 index; +bdaddr_t bdaddr; +uint8_t status; +} __packed;#define MGMT_OP_PIN_CODE_NEG_REPLY 0x0012struct mgmt_cp_pin_code_neg_reply {
net/bluetooth/mgmt.c +13 -10
@@ -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) {struct pending_cmd *cmd; +struct mgmt_rp_pin_code_reply rp;int err; cmd =mgmt_pending_find (MGMT_OP_PIN_CODE_REPLY , index);if (!cmd)return -ENOENT ; -if (status !=0 ) - err =cmd_status (cmd->sk,MGMT_OP_PIN_CODE_REPLY , status); -else - err =cmd_complete (cmd->sk,MGMT_OP_PIN_CODE_REPLY , - bdaddr,sizeof (*bdaddr)); +put_unaligned_le16 (index, &rp.index); +bacpy (&rp.bdaddr, bdaddr); + rp.status = status; + + err =cmd_complete (cmd->sk,MGMT_OP_PIN_CODE_REPLY , &rp,sizeof (rp));list_del (&cmd->list);mgmt_pending_free (cmd);
@@ -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) {struct pending_cmd *cmd; +struct mgmt_rp_pin_code_reply rp;int err; cmd =mgmt_pending_find (MGMT_OP_PIN_CODE_NEG_REPLY , index);if (!cmd)return -ENOENT ; -if (status !=0 ) - err =cmd_status (cmd->sk,MGMT_OP_PIN_CODE_NEG_REPLY , status); -else - err =cmd_complete (cmd->sk,MGMT_OP_PIN_CODE_NEG_REPLY , - bdaddr,sizeof (*bdaddr)); +put_unaligned_le16 (index, &rp.index); +bacpy (&rp.bdaddr, bdaddr); + rp.status = status; + + err =cmd_complete (cmd->sk,MGMT_OP_PIN_CODE_NEG_REPLY , + &rp,sizeof (rp));list_del (&cmd->list);mgmt_pending_free (cmd);
Signature · 1 line
1.7.4.1
PATCH 6/8 Bluetooth: Add mgmt_auth_failed event
In reply to [email protected]From: Johan Hedberg <[email protected]>
To properly track bonding completion an event to indicate authentication failure is needed. This event will be sent whenever an authentication complete HCI event with a non-zero status comes. It will also be sent when we're acting in acceptor role for SSP authentication in which case the controller will send a Simple Pairing Complete event.
--- include/net/bluetooth/hci_core.h | 1 + include/net/bluetooth/mgmt.h | 7 +++++++ net/bluetooth/hci_event.c | 19 ++++++++++++++++--- net/bluetooth/mgmt.c | 11 +++++++++++ 4 files changed, 35 insertions(+), 3 deletions(-)
include/net/bluetooth/hci_core.h +1 -0
@@ -766,6 +766,7 @@ int mgmt_user_confirm_request(u16 index, bdaddr_t *bdaddr, __le32 value);int mgmt_user_confirm_reply_complete (u16 index,bdaddr_t *bdaddr,u8 status);int mgmt_user_confirm_neg_reply_complete (u16 index,bdaddr_t *bdaddr,u8 status); +int mgmt_auth_failed (u16 index,bdaddr_t *bdaddr,u8 status);/* HCI info for socket */ #define hci_pi (sk) ((struct hci_pinfo *) sk)
include/net/bluetooth/mgmt.h +7 -0
@@ -264,3 +264,10 @@ struct mgmt_ev_user_confirm_request {bdaddr_t bdaddr;__le32 value; } __packed; + +#define MGMT_EV_AUTH_FAILED 0x0010 +struct mgmt_ev_auth_failed { +__le16 index; +bdaddr_t bdaddr; +__u8 status; +} __packed;
net/bluetooth/hci_event.c +16 -3
@@ -1424,8 +1424,10 @@ static inline void hci_auth_complete_evt(struct hci_dev *hdev, struct sk_buff *sif (!ev->status) { conn->link_mode |=HCI_LM_AUTH ; conn->sec_level = conn->pending_sec_level; - }else + }else { +mgmt_auth_failed (hdev->id, &conn->dst, ev->status); conn->sec_level =BT_SECURITY_LOW ; + }clear_bit (HCI_CONN_AUTH_PEND , &conn->pend);
@@ -2418,9 +2420,20 @@ static inline void hci_simple_pair_complete_evt(struct hci_dev *hdev, struct sk_hci_dev_lock (hdev); conn =hci_conn_hash_lookup_ba (hdev,ACL_LINK , &ev->bdaddr); -if (conn) -hci_conn_put (conn); +if (!conn) + goto unlock; + +/* To avoid duplicate auth_failed events to user space we check +* the HCI_CONN_AUTH_PEND flag which will be set if we +* initiated the authentication. A traditional auth_complete +* event gets always produced as initiator and is also mapped to +* the mgmt_auth_failed event */ +if (!test_bit (HCI_CONN_AUTH_PEND , &conn->pend) && ev->status !=0 ) +mgmt_auth_failed (hdev->id, &conn->dst, ev->status); +hci_conn_put (conn); + +unlock:hci_dev_unlock (hdev); }
net/bluetooth/mgmt.c +11 -0
@@ -1647,3 +1647,14 @@ int mgmt_user_confirm_neg_reply_complete(u16 index, bdaddr_t *bdaddr,return confirm_reply_complete (index, bdaddr, status,MGMT_OP_USER_CONFIRM_NEG_REPLY ); } + +int mgmt_auth_failed (u16 index,bdaddr_t *bdaddr,u8 status) +{ +struct mgmt_ev_auth_failed ev; + +put_unaligned_le16 (index, &ev.index); +bacpy (&ev.bdaddr, bdaddr); + ev.status = status; + +return mgmt_event (MGMT_EV_AUTH_FAILED , &ev,sizeof (ev),NULL ); +}
Signature · 1 line
1.7.4.1
PATCH 7/8 Bluetooth: Fix inititial value for remote authentication requirements
In reply to [email protected]From: Johan Hedberg <[email protected]>
The remote authentication requirements for conections need to be initialized to 0xff (unknown) since it is possible that we receive a IO Capability Request before we have received information about the remote requirements.
--- net/bluetooth/hci_conn.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
net/bluetooth/hci_conn.c +1 -0
@@ -286,6 +286,7 @@ struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst) conn->state =BT_OPEN ; conn->auth_type =HCI_AT_GENERAL_BONDING ; conn->io_capability = hdev->io_capability; + conn->remote_auth =0xff ; conn->power_save =1 ; conn->disc_timeout =HCI_DISCONN_TIMEOUT ;
Signature · 1 line
1.7.4.1
PATCH 8/8 Bluetooth: Fix unnecessary list traversal in mgmt_pending_remove
In reply to [email protected]From: Johan Hedberg <[email protected]>
All of the places that need to call mgmt_pending_remove already have a pointer to the pending command, so searching for the command in the list doesn't make sense. The added benefit is that many places that previously had to call list_del + mgmt_pending_free can just call mgmt_pending_remove now.
--- net/bluetooth/mgmt.c | 42 ++++++++++++++---------------------------- 1 files changed, 14 insertions(+), 28 deletions(-)
net/bluetooth/mgmt.c +14 -28
@@ -290,14 +290,8 @@ static struct pending_cmd *mgmt_pending_find(u16 opcode, int index)return NULL ; } -static void mgmt_pending_remove (u16 opcode,int index) +static void mgmt_pending_remove (struct pending_cmd *cmd) { -struct pending_cmd *cmd; - - cmd =mgmt_pending_find (opcode, index); -if (cmd ==NULL ) -return ; -list_del (&cmd->list);mgmt_pending_free (cmd); }
@@ -401,7 +395,7 @@ static int set_discoverable(struct sock *sk, unsigned char *data, u16 len) err =hci_send_cmd (hdev,HCI_OP_WRITE_SCAN_ENABLE ,1 , &scan);if (err <0 ) -mgmt_pending_remove (MGMT_OP_SET_DISCOVERABLE , dev_id); +mgmt_pending_remove (cmd); failed:hci_dev_unlock_bh (hdev);
@@ -459,7 +453,7 @@ static int set_connectable(struct sock *sk, unsigned char *data, u16 len) err =hci_send_cmd (hdev,HCI_OP_WRITE_SCAN_ENABLE ,1 , &scan);if (err <0 ) -mgmt_pending_remove (MGMT_OP_SET_CONNECTABLE , dev_id); +mgmt_pending_remove (cmd); failed:hci_dev_unlock_bh (hdev);
@@ -881,7 +875,7 @@ static int disconnect(struct sock *sk, unsigned char *data, u16 len) err =hci_send_cmd (hdev,HCI_OP_DISCONNECT ,sizeof (dc), &dc);if (err <0 ) -mgmt_pending_remove (MGMT_OP_DISCONNECT , dev_id); +mgmt_pending_remove (cmd); failed:hci_dev_unlock_bh (hdev);
@@ -983,7 +977,7 @@ static int pin_code_reply(struct sock *sk, unsigned char *data, u16 len) err =hci_send_cmd (hdev,HCI_OP_PIN_CODE_REPLY ,sizeof (reply), &reply);if (err <0 ) -mgmt_pending_remove (MGMT_OP_PIN_CODE_REPLY , dev_id); +mgmt_pending_remove (cmd); failed:hci_dev_unlock_bh (hdev);
@@ -1026,7 +1020,7 @@ static int pin_code_neg_reply(struct sock *sk, unsigned char *data, u16 len) err =hci_send_cmd (hdev,HCI_OP_PIN_CODE_NEG_REPLY ,sizeof (bdaddr_t), &cp->bdaddr);if (err <0 ) -mgmt_pending_remove (MGMT_OP_PIN_CODE_NEG_REPLY , dev_id); +mgmt_pending_remove (cmd); failed:hci_dev_unlock_bh (hdev);
@@ -1107,8 +1101,7 @@ static void pairing_complete(struct pending_cmd *cmd, u8 status)hci_conn_put (conn); -list_del (&cmd->list); -mgmt_pending_free (cmd); +mgmt_pending_remove (cmd); }static void pairing_complete_cb (struct hci_conn *conn,u8 status)
@@ -1230,10 +1223,8 @@ static int user_confirm_reply(struct sock *sk, unsigned char *data, u16 len, } err =hci_send_cmd (hdev, hci_op,sizeof (cp->bdaddr), &cp->bdaddr); -if (err <0 ) { -list_del (&cmd->list); -mgmt_pending_free (cmd); - } +if (err <0 ) +mgmt_pending_remove (cmd); failed:hci_dev_unlock_bh (hdev);
@@ -1494,8 +1485,7 @@ static void disconnect_rsp(struct pending_cmd *cmd, void *data) *sk = cmd->sk;sock_hold (*sk); -list_del (&cmd->list); -mgmt_pending_free (cmd); +mgmt_pending_remove (cmd); }int mgmt_disconnected (u16 index,bdaddr_t *bdaddr)
@@ -1528,8 +1518,7 @@ int mgmt_disconnect_failed(u16 index) err =cmd_status (cmd->sk,MGMT_OP_DISCONNECT ,EIO ); -list_del (&cmd->list); -mgmt_pending_free (cmd); +mgmt_pending_remove (cmd);return err; }
@@ -1571,8 +1560,7 @@ int mgmt_pin_code_reply_complete(u16 index, bdaddr_t *bdaddr, u8 status) err =cmd_complete (cmd->sk,MGMT_OP_PIN_CODE_REPLY , &rp,sizeof (rp)); -list_del (&cmd->list); -mgmt_pending_free (cmd); +mgmt_pending_remove (cmd);return err; }
@@ -1594,8 +1582,7 @@ int mgmt_pin_code_neg_reply_complete(u16 index, bdaddr_t *bdaddr, u8 status) err =cmd_complete (cmd->sk,MGMT_OP_PIN_CODE_NEG_REPLY , &rp,sizeof (rp)); -list_del (&cmd->list); -mgmt_pending_free (cmd); +mgmt_pending_remove (cmd);return err; }
@@ -1629,8 +1616,7 @@ static int confirm_reply_complete(u16 index, bdaddr_t *bdaddr, u8 status, rp.status = status; err =cmd_complete (cmd->sk, opcode, &rp,sizeof (rp)); -list_del (&cmd->list); -mgmt_pending_free (cmd); +mgmt_pending_remove (cmd);return err; }
Signature · 1 line
1.7.4.1
Hi Johan,
Quoted 7 lines · * [email protected] <[email protected]> [2011-02-19 12:05:54 -0300]:
Hi,
Here's a new set of patches for the Management interface. Combined with the latest user space git these patches enable both legacy and Secure Simple Pairing procedures. After these the only big missing feature in the management interface is device discovery which I'm just about to start working on.
All 8 patches are in my tree now, Thanks.
Signature · 2 lines
Gustavo F. Padovan http://profusion.mobi