diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2014-07-11 23:02:29 +0200 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2014-07-11 23:02:29 +0200 |
commit | b58f66f55f7c79f99ccbaa73292bfee9c21b75dc (patch) | |
tree | 19207850c797e4a7f24cff0513f7bad4a84f9a17 /tools/btattach.c | |
parent | 4a7e8d54fd9603d22b01d3d92a4d6203234bb7e0 (diff) | |
download | bluez-b58f66f55f7c79f99ccbaa73292bfee9c21b75dc.tar.gz |
tools: Print controller index after attaching serial port
Diffstat (limited to 'tools/btattach.c')
-rw-r--r-- | tools/btattach.c | 11 |
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; } |