summaryrefslogtreecommitdiff
path: root/tools/btattach.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/btattach.c')
-rw-r--r--tools/btattach.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/tools/btattach.c b/tools/btattach.c
index a08444067..87ea78474 100644
--- a/tools/btattach.c
+++ b/tools/btattach.c
@@ -84,7 +84,7 @@ static int open_serial(const char *path)
static int attach_proto(const char *path, unsigned int proto,
unsigned int flags)
{
- int fd;
+ int fd, dev_id;
fd = open_serial(path);
if (fd < 0)
@@ -102,6 +102,15 @@ static int attach_proto(const char *path, unsigned int proto,
return -1;
}
+ dev_id = ioctl(fd, HCIUARTGETDEVICE, NULL);
+ if (dev_id < 0) {
+ perror("Failed to get device id");
+ close(fd);
+ return -1;
+ }
+
+ printf("Device index %d attached\n", dev_id);
+
return fd;
}