diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2012-03-11 23:00:29 -0400 |
---|---|---|
committer | Gustavo Padovan <gustavo@padovan.org> | 2012-05-08 23:41:30 -0400 |
commit | cdbaccca733c9dde3faf150150102dade311c91f (patch) | |
tree | 75a4d5600a6ab8db1b9a6f6019981b651be7cac6 /net/bluetooth/mgmt.c | |
parent | 2b9be137b70bef9ec7835d83e225d8b35ba9c7ae (diff) |
Bluetooth: Add management command for setting Device ID
The Device ID details need to be programmed into the kernel for every
controller at least once. So provide management command for this.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Diffstat (limited to 'net/bluetooth/mgmt.c')
-rw-r--r-- | net/bluetooth/mgmt.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index 1da458d9b5ca..5e88fda42f1f 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c | |||
@@ -78,6 +78,7 @@ static const u16 mgmt_commands[] = { | |||
78 | MGMT_OP_CONFIRM_NAME, | 78 | MGMT_OP_CONFIRM_NAME, |
79 | MGMT_OP_BLOCK_DEVICE, | 79 | MGMT_OP_BLOCK_DEVICE, |
80 | MGMT_OP_UNBLOCK_DEVICE, | 80 | MGMT_OP_UNBLOCK_DEVICE, |
81 | MGMT_OP_SET_DEVICE_ID, | ||
81 | }; | 82 | }; |
82 | 83 | ||
83 | static const u16 mgmt_events[] = { | 84 | static const u16 mgmt_events[] = { |
@@ -2523,6 +2524,30 @@ static int unblock_device(struct sock *sk, struct hci_dev *hdev, void *data, | |||
2523 | return err; | 2524 | return err; |
2524 | } | 2525 | } |
2525 | 2526 | ||
2527 | static int set_device_id(struct sock *sk, struct hci_dev *hdev, void *data, | ||
2528 | u16 len) | ||
2529 | { | ||
2530 | struct mgmt_cp_set_device_id *cp = data; | ||
2531 | int err; | ||
2532 | |||
2533 | BT_DBG("%s", hdev->name); | ||
2534 | |||
2535 | hci_dev_lock(hdev); | ||
2536 | |||
2537 | hdev->devid_source = __le16_to_cpu(cp->source); | ||
2538 | hdev->devid_vendor = __le16_to_cpu(cp->vendor); | ||
2539 | hdev->devid_product = __le16_to_cpu(cp->product); | ||
2540 | hdev->devid_version = __le16_to_cpu(cp->version); | ||
2541 | |||
2542 | err = cmd_complete(sk, hdev->id, MGMT_OP_SET_DEVICE_ID, 0, NULL, 0); | ||
2543 | |||
2544 | update_eir(hdev); | ||
2545 | |||
2546 | hci_dev_unlock(hdev); | ||
2547 | |||
2548 | return err; | ||
2549 | } | ||
2550 | |||
2526 | static int set_fast_connectable(struct sock *sk, struct hci_dev *hdev, | 2551 | static int set_fast_connectable(struct sock *sk, struct hci_dev *hdev, |
2527 | void *data, u16 len) | 2552 | void *data, u16 len) |
2528 | { | 2553 | { |
@@ -2669,6 +2694,7 @@ struct mgmt_handler { | |||
2669 | { confirm_name, false, MGMT_CONFIRM_NAME_SIZE }, | 2694 | { confirm_name, false, MGMT_CONFIRM_NAME_SIZE }, |
2670 | { block_device, false, MGMT_BLOCK_DEVICE_SIZE }, | 2695 | { block_device, false, MGMT_BLOCK_DEVICE_SIZE }, |
2671 | { unblock_device, false, MGMT_UNBLOCK_DEVICE_SIZE }, | 2696 | { unblock_device, false, MGMT_UNBLOCK_DEVICE_SIZE }, |
2697 | { set_device_id, false, MGMT_SET_DEVICE_ID_SIZE }, | ||
2672 | }; | 2698 | }; |
2673 | 2699 | ||
2674 | 2700 | ||