diff options
author | Alok Barsode <alok.barsode@azingo.com> | 2009-07-10 15:16:00 +0530 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@nokia.com> | 2009-07-13 12:26:19 +0300 |
commit | 164ccf9a6641fe646d8476f6b860d5ff4905632b (patch) | |
tree | 3c6f7117c30921212766d1450f6597ce9c8882a1 /plugins | |
parent | 8a0285383c68f775b0b0e48369f5e7d2e7798d66 (diff) | |
download | bluez-164ccf9a6641fe646d8476f6b860d5ff4905632b.tar.gz |
Adding set_name to hciops plugin.
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/hciops.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/plugins/hciops.c b/plugins/hciops.c index 659f75422..7f63a494f 100644 --- a/plugins/hciops.c +++ b/plugins/hciops.c @@ -682,6 +682,28 @@ static int hciops_resolve_name(int index, bdaddr_t *bdaddr) return err; } +static int hciops_set_name(int index, const char *name) +{ + change_local_name_cp cp; + int dd, err = 0; + + dd = hci_open_dev(index); + if (dd < 0) + return -EIO; + + memset(&cp, 0, sizeof(cp)); + strncpy((char *) cp.name, name, sizeof(cp.name)); + + err = hci_send_cmd(dd, OGF_HOST_CTL, OCF_CHANGE_LOCAL_NAME, + CHANGE_LOCAL_NAME_CP_SIZE, &cp); + if (err < 0) + err = -errno; + + hci_close_dev(dd); + + return err; +} + static int hciops_cancel_resolve_name(int index, bdaddr_t *bdaddr) { remote_name_req_cancel_cp cp; @@ -717,6 +739,7 @@ static struct btd_adapter_ops hci_ops = { .stop_discovery = hciops_stop_discovery, .resolve_name = hciops_resolve_name, .cancel_resolve_name = hciops_cancel_resolve_name, + .set_name = hciops_set_name, }; static int hciops_init(void) |