From bf19cd7953fbc8cc916b9514d8f11fc8557f0cec Mon Sep 17 00:00:00 2001 From: Max Krasnyansky Date: Fri, 17 May 2002 17:12:30 +0000 Subject: Add hci_devba function --- include/hci_lib.h | 1 + src/hci.c | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/include/hci_lib.h b/include/hci_lib.h index ecf180be..02c56a1f 100644 --- a/include/hci_lib.h +++ b/include/hci_lib.h @@ -61,6 +61,7 @@ int hci_disconnect(int dd, uint16_t handle, uint8_t reason, 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_devba(int dev_id, bdaddr_t *ba); 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); diff --git a/src/hci.c b/src/hci.c index 6af14864..426eb91e 100644 --- a/src/hci.c +++ b/src/hci.c @@ -369,6 +369,22 @@ int hci_devinfo(int dev_id, struct hci_dev_info *di) return err; } +int hci_devba(int dev_id, bdaddr_t *ba) +{ + struct hci_dev_info di; + + if (hci_devinfo(dev_id, &di)) + return -1; + + if (!hci_test_bit(HCI_UP, &di.flags)) { + errno = ENETDOWN; + return -1; + } + + bacpy(ba, &di.bdaddr); + return 0; +} + inquiry_info *hci_inquiry(int dev_id, int len, int *num_rsp, uint8_t *lap, long flags) { struct hci_inquiry_req *ir; -- cgit