summaryrefslogtreecommitdiff
path: root/tools/btattach.c
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2014-07-11 23:02:29 +0200
committerMarcel Holtmann <marcel@holtmann.org>2014-07-11 23:02:29 +0200
commitb58f66f55f7c79f99ccbaa73292bfee9c21b75dc (patch)
tree19207850c797e4a7f24cff0513f7bad4a84f9a17 /tools/btattach.c
parent4a7e8d54fd9603d22b01d3d92a4d6203234bb7e0 (diff)
downloadbluez-b58f66f55f7c79f99ccbaa73292bfee9c21b75dc.tar.gz
tools: Print controller index after attaching serial port
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;
}