summaryrefslogtreecommitdiff
path: root/lib/hci.c
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2014-12-07 15:47:36 +0100
committerMarcel Holtmann <marcel@holtmann.org>2014-12-07 15:51:56 +0100
commit015aee415fca6c51b14c74d4227ea7f92a8f4d55 (patch)
treeadc3458645d6eeec2705484acfec814fa0ebcceb /lib/hci.c
parent899b06316bda4c64c9184f8d11ce56136d6bad96 (diff)
downloadbluez-015aee415fca6c51b14c74d4227ea7f92a8f4d55.tar.gz
lib: Use first HCI_UP adapter if non of them have a valid address
Diffstat (limited to 'lib/hci.c')
-rw-r--r--lib/hci.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/hci.c b/lib/hci.c
index 392df7144..e3cc513cd 100644
--- a/lib/hci.c
+++ b/lib/hci.c
@@ -900,8 +900,15 @@ static int __same_bdaddr(int dd, int dev_id, long arg)
int hci_get_route(bdaddr_t *bdaddr)
{
- return hci_for_each_dev(HCI_UP, __other_bdaddr,
+ int dev_id;
+
+ dev_id = hci_for_each_dev(HCI_UP, __other_bdaddr,
+ (long) (bdaddr ? bdaddr : BDADDR_ANY));
+ if (dev_id < 0)
+ dev_id = hci_for_each_dev(HCI_UP, __same_bdaddr,
(long) (bdaddr ? bdaddr : BDADDR_ANY));
+
+ return dev_id;
}
int hci_devid(const char *str)