aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2012-02-22 12:19:09 -0500
committerJohan Hedberg <johan.hedberg@intel.com>2012-02-23 06:07:00 -0500
commit490c5baba7a5ad80782d5eb778638d1cfc8d70ce (patch)
treee1963394e3f36165db4ce71fcd768f3b792c8495
parent7f9a903c57bb42b9f7ad8fb7867859d3252229ab (diff)
Bluetooth: Add hdev->short_name for EIR generation
It's possible to provide a short name through the mgmt interface and this name can be used for EIR generation when the full name doesn't fit there. This patch adds the preliminary tracking of the provided short name. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Acked-by: Marcel Holtmann <marcel@holtmann.org>
-rw-r--r--include/net/bluetooth/hci_core.h3
-rw-r--r--include/net/bluetooth/mgmt.h2
-rw-r--r--net/bluetooth/mgmt.c3
3 files changed, 7 insertions, 1 deletions
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 24dd770d442b..3fcc7f0d08c3 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -129,6 +129,8 @@ struct le_scan_params {
129 int timeout; 129 int timeout;
130}; 130};
131 131
132#define HCI_MAX_SHORT_NAME_LENGTH 10
133
132#define NUM_REASSEMBLY 4 134#define NUM_REASSEMBLY 4
133struct hci_dev { 135struct hci_dev {
134 struct list_head list; 136 struct list_head list;
@@ -141,6 +143,7 @@ struct hci_dev {
141 __u8 dev_type; 143 __u8 dev_type;
142 bdaddr_t bdaddr; 144 bdaddr_t bdaddr;
143 __u8 dev_name[HCI_MAX_NAME_LENGTH]; 145 __u8 dev_name[HCI_MAX_NAME_LENGTH];
146 __u8 short_name[HCI_MAX_SHORT_NAME_LENGTH];
144 __u8 eir[HCI_MAX_EIR_LENGTH]; 147 __u8 eir[HCI_MAX_EIR_LENGTH];
145 __u8 dev_class[3]; 148 __u8 dev_class[3];
146 __u8 major_class; 149 __u8 major_class;
diff --git a/include/net/bluetooth/mgmt.h b/include/net/bluetooth/mgmt.h
index ac59cdd0fa1b..495668c77fb6 100644
--- a/include/net/bluetooth/mgmt.h
+++ b/include/net/bluetooth/mgmt.h
@@ -75,7 +75,7 @@ struct mgmt_rp_read_index_list {
75/* Reserve one extra byte for names in management messages so that they 75/* Reserve one extra byte for names in management messages so that they
76 * are always guaranteed to be nul-terminated */ 76 * are always guaranteed to be nul-terminated */
77#define MGMT_MAX_NAME_LENGTH (HCI_MAX_NAME_LENGTH + 1) 77#define MGMT_MAX_NAME_LENGTH (HCI_MAX_NAME_LENGTH + 1)
78#define MGMT_MAX_SHORT_NAME_LENGTH (10 + 1) 78#define MGMT_MAX_SHORT_NAME_LENGTH (HCI_MAX_SHORT_NAME_LENGTH + 1)
79 79
80#define MGMT_SETTING_POWERED 0x00000001 80#define MGMT_SETTING_POWERED 0x00000001
81#define MGMT_SETTING_CONNECTABLE 0x00000002 81#define MGMT_SETTING_CONNECTABLE 0x00000002
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 16bddd22713f..3f6a2df9d150 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -2273,6 +2273,9 @@ static int set_local_name(struct sock *sk, u16 index, void *data,
2273 goto failed; 2273 goto failed;
2274 } 2274 }
2275 2275
2276 memcpy(hdev->short_name, mgmt_cp->short_name,
2277 sizeof(hdev->short_name));
2278
2276 memcpy(hci_cp.name, mgmt_cp->name, sizeof(hci_cp.name)); 2279 memcpy(hci_cp.name, mgmt_cp->name, sizeof(hci_cp.name));
2277 err = hci_send_cmd(hdev, HCI_OP_WRITE_LOCAL_NAME, sizeof(hci_cp), 2280 err = hci_send_cmd(hdev, HCI_OP_WRITE_LOCAL_NAME, sizeof(hci_cp),
2278 &hci_cp); 2281 &hci_cp);