From e329c9ff80a76cb34ff616bce80df0d161731d0b Mon Sep 17 00:00:00 2001 From: Stephen Crane Date: Thu, 22 Aug 2002 10:04:18 +0000 Subject: hci_write_local_name() --- include/hci_lib.h | 5 +++-- src/hci.c | 21 +++++++++++++++++++-- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/include/hci_lib.h b/include/hci_lib.h index ba33be73..4108dc06 100644 --- a/include/hci_lib.h +++ b/include/hci_lib.h @@ -64,8 +64,9 @@ int hci_devinfo(int dev_id, struct hci_dev_info *di); int hci_devba(int dev_id, bdaddr_t *ba); int hci_devid(char *str); -int hci_local_name(int dd, int len, char *name, int to); -int hci_remote_name(int dd, bdaddr_t *ba, int len, char *name, int to); +int hci_read_local_name(int dd, int len, char *name, int to); +int hci_write_local_name(int dd, char *name, int to); +int hci_read_remote_name(int dd, bdaddr_t *ba, int len, char *name, int to); int hci_read_remote_features(int dd, uint16_t handle, uint8_t *features, int to); int hci_read_remote_version(int dd, uint16_t handle, struct hci_version *ver, int to); int hci_read_local_version(int dd, struct hci_version *ver, int to); diff --git a/src/hci.c b/src/hci.c index 6b60477a..7f2c1745 100644 --- a/src/hci.c +++ b/src/hci.c @@ -755,7 +755,7 @@ int hci_disconnect(int dd, uint16_t handle, uint8_t reason, int to) return 0; } -int hci_local_name(int dd, int len, char *name, int to) +int hci_read_local_name(int dd, int len, char *name, int to) { read_local_name_rp rp; struct hci_request rq; @@ -779,7 +779,24 @@ int hci_local_name(int dd, int len, char *name, int to) return 0; } -int hci_remote_name(int dd, bdaddr_t *ba, int len, char *name, int to) +int hci_write_local_name(int dd, char *name, int to) +{ + change_local_name_cp cp; + struct hci_request rq; + + strncpy(cp.name, name, sizeof(cp.name)); + memset(&rq, 0, sizeof(rq)); + rq.ogf = OGF_HOST_CTL; + rq.ocf = OCF_CHANGE_LOCAL_NAME; + rq.cparam = &cp; + rq.clen = CHANGE_LOCAL_NAME_CP_SIZE; + + if (hci_send_req(dd, &rq, to) < 0) + return -1; + return 0; +} + +int hci_read_remote_name(int dd, bdaddr_t *ba, int len, char *name, int to) { evt_remote_name_req_complete rn; remote_name_req_cp cp; -- cgit