summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2005-01-24 18:33:49 +0000
committerMarcel Holtmann <marcel@holtmann.org>2005-01-24 18:33:49 +0000
commitd198227a6d76b6fb6bff050e6fda9f2e4ffc4544 (patch)
tree1f3705e327be1b2a0d3a85cb2d0407dc13227746
parenta5fcb1982de75e464c1c41a660975c5d8ab4b47b (diff)
Show connection information
-rw-r--r--test/l2test.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/test/l2test.c b/test/l2test.c
index 859ce079..272f40f6 100644
--- a/test/l2test.c
+++ b/test/l2test.c
@@ -257,6 +257,7 @@ static void do_listen(void (*handler)(int sk))
{
struct sockaddr_l2 loc_addr, rem_addr;
struct l2cap_options opts;
+ struct l2cap_conninfo conn;
int s, s1, opt;
char ba[18];
@@ -332,15 +333,26 @@ static void do_listen(void (*handler)(int sk))
close(s);
+ memset(&opts, 0, sizeof(opts));
opt = sizeof(opts);
if (getsockopt(s1, SOL_L2CAP, L2CAP_OPTIONS, &opts, &opt) < 0) {
syslog(LOG_ERR, "Can't get L2CAP options: %s (%d)", strerror(errno), errno);
+ close(s1);
+ exit(1);
+ }
+
+ memset(&conn, 0, sizeof(conn));
+ opt = sizeof(conn);
+ if (getsockopt(s1, SOL_L2CAP, L2CAP_CONNINFO, &conn, &opt) < 0) {
+ syslog(LOG_ERR, "Can't get L2CAP connection information: %s (%d)", strerror(errno), errno);
+ close(s1);
exit(1);
}
ba2str(&rem_addr.l2_bdaddr, ba);
- syslog(LOG_INFO, "Connect from %s [imtu %d, omtu %d, flush_to %d]\n",
- ba, opts.imtu, opts.omtu, opts.flush_to);
+ syslog(LOG_INFO, "Connect from %s [imtu %d, omtu %d, flush_to %d, mode %d, handle %d, class 0x%02x%02x%02x]\n",
+ ba, opts.imtu, opts.omtu, opts.flush_to, opts.mode, conn.hci_handle,
+ conn.dev_class[2], conn.dev_class[1], conn.dev_class[0]);
/* Enable SO_LINGER */
if (linger) {