summaryrefslogtreecommitdiffstats
path: root/tools/hcitool.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/hcitool.c')
-rw-r--r--tools/hcitool.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/tools/hcitool.c b/tools/hcitool.c
index c2ad6186..96348342 100644
--- a/tools/hcitool.c
+++ b/tools/hcitool.c
@@ -980,7 +980,11 @@ int main(int argc, char **argv)
while ((opt=getopt_long(argc, argv, "+i:h", main_options, NULL)) != -1) {
switch(opt) {
case 'i':
- dev_id = atoi(optarg + 3);
+ dev_id = hci_devid(optarg);
+ if (dev_id < 0) {
+ perror("Invalid device");
+ exit(1);
+ }
break;
case 'h':