]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
Bluetooth: Enhance error codes pair device command
authorLukasz Rymanowski <lukasz.rymanowski@tieto.com>
Wed, 11 Feb 2015 11:31:42 +0000 (12:31 +0100)
committerMarcel Holtmann <marcel@holtmann.org>
Sat, 14 Feb 2015 04:19:59 +0000 (05:19 +0100)
If user space is trying to pair on not enabled transport
MGMT_STATUS_REJECT will be returned.

If user space is trying to pair on transport which controller does not
support, MGMT_STATUS_NOT_SUPPORTED will be returned.

Having separate error code for that scenario might be useful for
debugging at least.

Signed-off-by: Lukasz Rymanowski <lukasz.rymanowski@tieto.com>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
net/bluetooth/mgmt.c

index 9ec5390c85eba61c3c3bcb5a813c8d8af326cf33..1b528dea98444ec3c85079199b1ab985340cdfe9 100644 (file)
@@ -3249,6 +3249,10 @@ static int pair_device(struct sock *sk, struct hci_dev *hdev, void *data,
 
                if (PTR_ERR(conn) == -EBUSY)
                        status = MGMT_STATUS_BUSY;
+               else if (PTR_ERR(conn) == -EOPNOTSUPP)
+                       status = MGMT_STATUS_NOT_SUPPORTED;
+               else if (PTR_ERR(conn) == -ECONNREFUSED)
+                       status = MGMT_STATUS_REJECTED;
                else
                        status = MGMT_STATUS_CONNECT_FAILED;