summaryrefslogtreecommitdiffstats
path: root/src/hci.c
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2005-07-09 17:09:10 +0000
committerMarcel Holtmann <marcel@holtmann.org>2005-07-09 17:09:10 +0000
commitb809fb039119546a8b5b4fbb4bcbfbad6666cf24 (patch)
tree6b5bf45f796cc798a1cce7a66d73a5acac36c215 /src/hci.c
parentcfa3a02e2593bd72ce4a83f521e1e89a5874ea7d (diff)
Fix the routing for dealing with raw devices
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);