Thread (9 messages) 9 messages, 2 authors, 2012-02-17

Re: [PATCH 2/4] Bluetooth: mgmt: Add support for Set Link Security command

flat view

From: Johan Hedberg <hidden>
Date: 2012-02-16 23:39:04

Hi,

On Fri, Feb 17, 2012, johan.hedberg@gmail.com wrote:
quoted hunk ↗ jump to hunk
+	hdev = hci_dev_get(index);
+	if (!hdev)
+		return cmd_status(sk, index, MGMT_OP_SET_LINK_SECURITY,
+						MGMT_STATUS_INVALID_PARAMS);
+
+	hci_dev_lock(hdev);
+
+	if (mgmt_pending_find(MGMT_OP_SET_LINK_SECURITY, hdev)) {
+		err = cmd_status(sk, index, MGMT_OP_SET_LINK_SECURITY,
+							MGMT_STATUS_BUSY);
+		goto failed;
+	}
+
+	val = !!cp->val;
+
+	if (test_bit(HCI_AUTH, &hdev->flags) == val) {
+		err = send_settings_rsp(sk, MGMT_OP_SET_LINK_SECURITY, hdev);
+		goto failed;
+	}
+
+	cmd = mgmt_pending_add(sk, MGMT_OP_SET_LINK_SECURITY, hdev, data, len);
+	if (!cmd) {
+		err = -ENOMEM;
+		goto failed;
+	}
+
+	err = hci_send_cmd(hdev, HCI_OP_WRITE_AUTH_ENABLE, sizeof(val), &val);
+	if (err < 0) {
+		mgmt_pending_remove(cmd);
+		goto failed;
+	}
There's a missing check for HCI_UP here as well as in the corresponding
place of patch 3/4. I'll send v2's of 2/4 and 3/4 as a new patch-set
(1/4 and 4/4 are quite trivial so I wont bother resending them).

Johan
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help