diff options
-rw-r--r-- | include/hci_lib.h | 1 | ||||
-rw-r--r-- | src/hci.c | 16 |
2 files changed, 17 insertions, 0 deletions
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); @@ -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; |