From b58f66f55f7c79f99ccbaa73292bfee9c21b75dc Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Fri, 11 Jul 2014 23:02:29 +0200 Subject: [PATCH] tools: Print controller index after attaching serial port --- tools/btattach.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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; } -- 2.47.3