Module Name:    src
Committed By:   plunky
Date:           Fri Sep 11 19:22:15 UTC 2009

Modified Files:
        src/usr.sbin/btconfig: btconfig.c

Log Message:
print features from 3.0 + HS spec, including extended features


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/usr.sbin/btconfig/btconfig.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/btconfig/btconfig.c
diff -u src/usr.sbin/btconfig/btconfig.c:1.16 src/usr.sbin/btconfig/btconfig.c:1.17
--- src/usr.sbin/btconfig/btconfig.c:1.16	Tue Sep  1 18:04:33 2009
+++ src/usr.sbin/btconfig/btconfig.c	Fri Sep 11 19:22:15 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: btconfig.c,v 1.16 2009/09/01 18:04:33 plunky Exp $ */
+/* $NetBSD: btconfig.c,v 1.17 2009/09/11 19:22:15 plunky Exp $ */
 
 /*-
  * Copyright (c) 2006 Itronix Inc.
@@ -33,7 +33,7 @@
 
 #include <sys/cdefs.h>
 __COPYRIGHT("@(#) Copyright (c) 2006 Itronix, Inc.  All rights reserved.");
-__RCSID("$NetBSD: btconfig.c,v 1.16 2009/09/01 18:04:33 plunky Exp $");
+__RCSID("$NetBSD: btconfig.c,v 1.17 2009/09/11 19:22:15 plunky Exp $");
 
 #include <sys/ioctl.h>
 #include <sys/param.h>
@@ -70,7 +70,9 @@
 void print_class(const char *);
 void print_voice(int);
 void tag(const char *);
-void print_features(const char *, uint8_t *);
+void print_features(const char *, uint8_t, uint8_t *);
+void print_features0(uint8_t *);
+void print_features1(uint8_t *);
 void do_inquiry(void);
 void print_result(int, struct result *, int);
 
@@ -785,7 +787,19 @@
 		return;
 
 	load_value(HCI_CMD_READ_LOCAL_FEATURES, buf, HCI_FEATURES_SIZE);
-	print_features("\tfeatures:", buf);
+	if ((buf[7] & HCI_LMP_EXTENDED_FEATURES) == 0) {
+		print_features("\tfeatures:", 0, buf);
+	} else {
+		buf[0] = 0;
+
+		do {
+			hci_req(HCI_CMD_READ_LOCAL_EXTENDED_FEATURES, 0,
+				buf, 1,
+				buf, HCI_FEATURES_SIZE + 2);
+
+			print_features("\tfeatures page#%d:", buf[0], buf + 2);
+		} while (buf[0]++ < buf[1]);
+	}
 }
 
 void
@@ -816,10 +830,23 @@
 }
 
 void
-print_features(const char *str, uint8_t *f)
+print_features(const char *fmt, uint8_t page, uint8_t *f)
 {
 
-	width = printf("%s", str);
+	width = printf(fmt, page);
+
+	switch(page) {
+	case 0:	print_features0(f);	break;
+	case 1:	print_features1(f);	break;
+	default:			break;
+	}
+
+	tag(NULL);
+}
+
+void
+print_features0(uint8_t *f)
+{
 
 	/* ------------------- byte 0 --------------------*/
 	if (*f & HCI_LMP_3SLOT)		    tag("<3 slot>");
@@ -894,9 +921,16 @@
 	/* ------------------- byte 7 --------------------*/
 	if (*f & HCI_LMP_LINK_SUPERVISION_TO)tag("<link supervision timeout changed>");
 	if (*f & HCI_LMP_INQ_RSP_TX_POWER)  tag("<inquiry rsp TX power level>");
+	if (*f & HCI_LMP_ENHANCED_POWER_CONTROL)tag("<enhanced power control>");
 	if (*f & HCI_LMP_EXTENDED_FEATURES) tag("<extended features>");
+}
 
-	tag(NULL);
+void
+print_features1(uint8_t *f)
+{
+
+	/* ------------------- byte 0 --------------------*/
+	if (*f & HCI_LMP_SSP)		    tag("<secure simple pairing>");
 }
 
 void

Reply via email to