diff options
author | Sudha Bheemanna <b.sudha@samsung.com> | 2016-09-07 15:22:08 +0530 |
---|---|---|
committer | Seung-Woo Kim <sw0312.kim@samsung.com> | 2016-12-14 13:53:15 +0900 |
commit | 963f8315cd63ff4424f37ef581e933b0b0a415d1 (patch) | |
tree | be7fd51fda516218cd0f5c4b97662d891aa21b86 | |
parent | ccfffda9305969ccbf32f18e6c8ba696d632d51b (diff) |
Bluetooth: Get Advertising TX power
This patch adds MGMT command to read the advertising TX power.
Change-Id: Ide9e5d332f034928d2eae2cbd68a025a0d42be1b
Signed-off-by: Sudha Bheemanna <b.sudha@samsung.com>
-rw-r--r-- | include/net/bluetooth/mgmt_tizen.h | 6 | ||||
-rw-r--r-- | net/bluetooth/mgmt.c | 32 |
2 files changed, 38 insertions, 0 deletions
diff --git a/include/net/bluetooth/mgmt_tizen.h b/include/net/bluetooth/mgmt_tizen.h index 1f861a0ae62f..d1bba50d09be 100644 --- a/include/net/bluetooth/mgmt_tizen.h +++ b/include/net/bluetooth/mgmt_tizen.h @@ -161,6 +161,12 @@ struct mgmt_cp_set_voice_setting { } __packed; #define MGMT_SET_VOICE_SETTING_SIZE 9 +#define MGMT_OP_GET_ADV_TX_POWER (TIZEN_OP_CODE_BASE + 0x11) +#define MGMT_GET_ADV_TX_POWER_SIZE 0 +struct mgmt_rp_get_adv_tx_power { + __s8 adv_tx_power; +} __packed; + /* EVENTS */ /* For device name update changes */ diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index 7e573fa97c66..6377782f17ec 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c @@ -7220,6 +7220,37 @@ unlock: return err; } +static int get_adv_tx_power(struct sock *sk, struct hci_dev *hdev, + void *data, u16 len) +{ + struct mgmt_rp_get_adv_tx_power *rp; + size_t rp_len; + int err; + + BT_DBG("%s", hdev->name); + + hci_dev_lock(hdev); + + rp_len = sizeof(*rp); + rp = kmalloc(rp_len, GFP_KERNEL); + if (!rp) { + err = -ENOMEM; + goto unlock; + } + + rp->adv_tx_power = hdev->adv_tx_power; + + err = mgmt_cmd_complete(sk, hdev->id, MGMT_OP_GET_ADV_TX_POWER, 0, rp, + rp_len); + + kfree(rp); + +unlock: + hci_dev_unlock(hdev); + + return err; +} + void mgmt_hardware_error(struct hci_dev *hdev, u8 err_code) { struct mgmt_ev_hardware_error ev; @@ -9138,6 +9169,7 @@ static const struct hci_mgmt_handler tizen_mgmt_handlers[] = { { set_manufacturer_data, MGMT_SET_MANUFACTURER_DATA_SIZE }, { le_set_scan_params, MGMT_LE_SET_SCAN_PARAMS_SIZE }, { set_voice_setting, MGMT_SET_VOICE_SETTING_SIZE }, + { get_adv_tx_power, MGMT_GET_ADV_TX_POWER_SIZE }, }; #endif |