summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Krasnyansky <maxk@qualcomm.com>2002-06-18 18:32:44 +0000
committerMax Krasnyansky <maxk@qualcomm.com>2002-06-18 18:32:44 +0000
commit9942261d0febb9ef243ffe810421451e97925e68 (patch)
treeb7a32e1bf1c3cf4c14e2dacc86c3e5dd86e0dfae /src
parentd316a5fbab4a41ce3f8321eef407db9c53b57e85 (diff)
improved hci_devid
Diffstat (limited to 'src')
-rw-r--r--src/hci.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/hci.c b/src/hci.c
index f72ef760..c0be8df2 100644
--- a/src/hci.c
+++ b/src/hci.c
@@ -415,9 +415,20 @@ int hci_get_route(bdaddr_t *bdaddr)
return hci_for_each_dev(HCI_UP, NULL, 0);
}
-int hci_devid(bdaddr_t *bdaddr)
+int hci_devid(char *str)
{
- return hci_for_each_dev(HCI_UP, __same_bdaddr, (long) bdaddr);
+ bdaddr_t ba;
+ int id = -1;
+
+ if (!strncmp(str, "hci", 3) && strlen(str) >= 4) {
+ id = atoi(str + 3);
+ if (hci_devba(id, &ba) < 0)
+ return -1;
+ } else {
+ str2ba(str, &ba);
+ id = hci_for_each_dev(HCI_UP, __same_bdaddr, (long) &ba);
+ }
+ return id;
}
int hci_devinfo(int dev_id, struct hci_dev_info *di)