diff options
author | Max Krasnyansky <maxk@qualcomm.com> | 2002-03-19 17:35:54 +0000 |
---|---|---|
committer | Max Krasnyansky <maxk@qualcomm.com> | 2002-03-19 17:35:54 +0000 |
commit | 9ff2c721bb4ff84ad15e4593404bf47941315337 (patch) | |
tree | 82f65da83b02c2bb0a26bf3e262a28dbe3613126 | |
parent | aced690cd4c623607a5ac1ebc0bb12b8b213fac8 (diff) |
Added hci_local_name function.
-rw-r--r-- | include/hci_lib.h | 1 | ||||
-rw-r--r-- | src/hci.c | 23 |
2 files changed, 24 insertions, 0 deletions
diff --git a/include/hci_lib.h b/include/hci_lib.h index 0776e1ba..5a5d2ae7 100644 --- a/include/hci_lib.h +++ b/include/hci_lib.h @@ -62,6 +62,7 @@ int hci_disconnect(int dd, int hndl, int res, int to); inquiry_info *hci_inquiry(int dev_id, int len, int *num_rsp, uint8_t *lap, long flags); int hci_devinfo(int dev_id, struct hci_dev_info *di); +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_remote_features(int dd, int hndl, uint8_t *features, int to); int hci_read_remote_version(int dd, int hndl, struct hci_version *ver, int to); @@ -503,6 +503,29 @@ int hci_disconnect(int dd, int hndl, int res, int to) return 0; } +int hci_local_name(int dd, int len, char *name, int to) +{ + read_local_name_rp rp; + struct hci_request rq; + + rq.ogf = OGF_HOST_CTL; + rq.ocf = OCF_READ_LOCAL_NAME; + rq.rparam = &rp; + rq.rlen = READ_LOCAL_NAME_RP_SIZE; + + if (hci_send_req(dd, &rq, to) < 0) + return -1; + + if (rp.status) { + errno = EIO; + return -1; + } + + rp.name[247] = '\0'; + strncpy(name, rp.name, len); + return 0; +} + int hci_remote_name(int dd, bdaddr_t *ba, int len, char *name, int to) { evt_remote_name_req_complete rn; |