summaryrefslogtreecommitdiffstats
path: root/src/hci.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/hci.c')
-rw-r--r--src/hci.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/hci.c b/src/hci.c
index 59f2afa7..0aca162f 100644
--- a/src/hci.c
+++ b/src/hci.c
@@ -522,10 +522,8 @@ static int __same_bdaddr(int dd, int dev_id, long arg)
int hci_get_route(bdaddr_t *bdaddr)
{
- if (bdaddr)
- return hci_for_each_dev(HCI_UP, __other_bdaddr, (long) bdaddr);
- else
- return hci_for_each_dev(HCI_UP, NULL, 0);
+ return hci_for_each_dev(HCI_UP, __other_bdaddr,
+ (long) (bdaddr ? bdaddr : BDADDR_ANY));
}
int hci_devid(const char *str)
@@ -593,9 +591,12 @@ int hci_inquiry(int dev_id, int len, int nrsp, const uint8_t *lap, inquiry_info
nrsp = 255;
}
- if (dev_id < 0 && (dev_id = hci_get_route(NULL)) < 0) {
- errno = ENODEV;
- return -1;
+ if (dev_id < 0) {
+ dev_id = hci_get_route(NULL);
+ if (dev_id < 0) {
+ errno = ENODEV;
+ return -1;
+ }
}
dd = socket(AF_BLUETOOTH, SOCK_RAW, BTPROTO_HCI);