summaryrefslogtreecommitdiffstats
path: root/test/rctest.c
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2004-12-26 14:10:24 +0000
committerMarcel Holtmann <marcel@holtmann.org>2004-12-26 14:10:24 +0000
commit9e6e37723b8d8798ed9ba58734fd3022fdf49dc2 (patch)
treefd1be102d4d6d8ae05a505a851b6593c19720ba9 /test/rctest.c
parent84a66abab8579ab01c8715d8564155ad918235a2 (diff)
Update for connection information
Diffstat (limited to 'test/rctest.c')
-rw-r--r--test/rctest.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/test/rctest.c b/test/rctest.c
index 6e5fba27..2ffb47dd 100644
--- a/test/rctest.c
+++ b/test/rctest.c
@@ -90,7 +90,8 @@ float tv2fl(struct timeval tv)
int do_connect(char *svr)
{
struct sockaddr_rc rem_addr, loc_addr;
- int s;
+ struct rfcomm_conninfo conn;
+ int s, opt;
if( (s = socket(PF_BLUETOOTH, socktype, BTPROTO_RFCOMM)) < 0 ) {
syslog(LOG_ERR, "Can't create socket. %s(%d)", strerror(errno), errno);
@@ -125,7 +126,17 @@ int do_connect(char *svr)
return -1;
}
- syslog(LOG_INFO, "Connected");
+ memset(&conn, 0, sizeof(conn));
+ opt = sizeof(conn);
+ if (getsockopt(s, SOL_L2CAP, RFCOMM_CONNINFO, &conn, &opt) < 0) {
+ syslog(LOG_ERR, "Can't get RFCOMM connection information. %s(%d)", strerror(errno), errno);
+ close(s);
+ //return -1;
+ }
+
+ syslog(LOG_INFO, "Connected [handle %d, class 0x%02x%02x%02x]",
+ conn.hci_handle,
+ conn.dev_class[2], conn.dev_class[1], conn.dev_class[0]);
return s;
}