summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2004-04-25 19:10:25 +0000
committerMarcel Holtmann <marcel@holtmann.org>2004-04-25 19:10:25 +0000
commit2facfcf46852253bfd96c3888128a419d3a04c6a (patch)
treecf61714ff2d6278dbb1c2a1b75d9e0c7ca27e4ba /tools
parent241112a349dde07429e27098be760476c99f556d (diff)
Add support for AFH mode
Diffstat (limited to 'tools')
-rw-r--r--tools/hciconfig.86
-rw-r--r--tools/hciconfig.c53
2 files changed, 59 insertions, 0 deletions
diff --git a/tools/hciconfig.8 b/tools/hciconfig.8
index 8e9fb257..b8b780ee 100644
--- a/tools/hciconfig.8
+++ b/tools/hciconfig.8
@@ -157,6 +157,12 @@ to
to
slots.
.TP
+.BI afhmode " [mode]"
+With no
+.IR mode ,
+prints out the current AFH mode. Otherwise, sets AFH mode to
+.IR mode .
+.TP
.BI aclmtu " <mtu:pkt>"
Sets ACL MTU to
to
diff --git a/tools/hciconfig.c b/tools/hciconfig.c
index 7134bfc1..6393764b 100644
--- a/tools/hciconfig.c
+++ b/tools/hciconfig.c
@@ -898,6 +898,58 @@ void cmd_page_to(int ctl, int hdev, char *opt)
}
}
+void cmd_afh_mode(int ctl, int hdev, char *opt)
+{
+ struct hci_request rq;
+ int dd;
+
+ dd = hci_open_dev(hdev);
+ if (dd < 0) {
+ printf("Can't open device hci%d. %s(%d)\n", hdev, strerror(errno), errno);
+ exit(1);
+ }
+
+ memset(&rq, 0, sizeof(rq));
+
+ if (opt) {
+ write_afh_mode_cp cp;
+
+ cp.mode = atoi(opt);
+
+ rq.ogf = OGF_HOST_CTL;
+ rq.ocf = OCF_WRITE_AFH_MODE;
+ rq.cparam = &cp;
+ rq.clen = WRITE_AFH_MODE_RP_SIZE;
+
+ if (hci_send_req(dd, &rq, 1000) < 0) {
+ printf("Can't set AFH mode on hci%d. %s(%d)\n",
+ hdev, strerror(errno), errno);
+ exit(1);
+ }
+ } else {
+ read_afh_mode_rp rp;
+
+ rq.ogf = OGF_HOST_CTL;
+ rq.ocf = OCF_READ_AFH_MODE;
+ rq.rparam = &rp;
+ rq.rlen = READ_AFH_MODE_RP_SIZE;
+
+ if (hci_send_req(dd, &rq, 1000) < 0) {
+ printf("Can't read AFH mode on hci%d. %s(%d)\n",
+ hdev, strerror(errno), errno);
+ exit(1);
+ }
+ if (rp.status) {
+ printf("Read AFH mode on hci%d returned status %d\n",
+ hdev, rp.status);
+ exit(1);
+ }
+
+ print_dev_hdr(&di);
+ printf("\tAFH mode: %s\n", rp.mode == 1 ? "Enabled" : "Disabled");
+ }
+}
+
static void print_rev_ericsson(int dd)
{
struct hci_request rq;
@@ -1068,6 +1120,7 @@ struct {
{ "inqparms", cmd_inq_parms, "[win:int]", "Get/Set inquiry scan window and interval" },
{ "pageparms", cmd_page_parms, "[win:int]", "Get/Set page scan window and interval" },
{ "pageto", cmd_page_to, "[to]", "Get/Set page timeout" },
+ { "afhmode", cmd_afh_mode, "[mode]", "Get/Set AFH mode" },
{ "aclmtu", cmd_aclmtu, "<mtu:pkt>", "Set ACL MTU and number of packets" },
{ "scomtu", cmd_scomtu, "<mtu:pkt>", "Set SCO MTU and number of packets" },
{ "features", cmd_features, 0, "Display device features" },