Diff between 4a7e8d54fd9603d22b01d3d92a4d6203234bb7e0 and b58f66f55f7c79f99ccbaa73292bfee9c21b75dc
Changed Files
| File | Additions | Deletions | Status |
| tools/btattach.c | +10 | -1 | modified |
Full Patch
diff --git a/tools/btattach.c b/tools/btattach.c
index a084440..87ea784 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;
}