diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2005-07-09 17:09:10 +0000 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2005-07-09 17:09:10 +0000 |
commit | b809fb039119546a8b5b4fbb4bcbfbad6666cf24 (patch) | |
tree | 6b5bf45f796cc798a1cce7a66d73a5acac36c215 /src/hci.c | |
parent | cfa3a02e2593bd72ce4a83f521e1e89a5874ea7d (diff) |
Fix the routing for dealing with raw devices
Diffstat (limited to 'src/hci.c')
-rw-r--r-- | src/hci.c | 15 |
1 files changed, 8 insertions, 7 deletions
@@ -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); |