summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorMax Krasnyansky <maxk@qualcomm.com>2002-06-25 04:36:09 +0000
committerMax Krasnyansky <maxk@qualcomm.com>2002-06-25 04:36:09 +0000
commitaaa64a3108d3bb8eba3e49f2b58d3909627bbca0 (patch)
treeabb8811c8a3ecc50d5217b5d51a771f52a27ddc3 /tools
parentcd7dd46bb4c182c1ea81c123eb1820d738ea03e6 (diff)
Move revision command to hciconfig.
Diffstat (limited to 'tools')
-rw-r--r--tools/hciconfig.c57
-rw-r--r--tools/hcitool.c77
2 files changed, 52 insertions, 82 deletions
diff --git a/tools/hciconfig.c b/tools/hciconfig.c
index 9d52dcf3..093c3100 100644
--- a/tools/hciconfig.c
+++ b/tools/hciconfig.c
@@ -617,6 +617,52 @@ void cmd_page_to(int ctl, int hdev, char *opt)
}
}
+static void cmd_revision(int ctl, int hdev, char *opt)
+{
+ struct hci_version ver;
+ struct hci_request rq;
+ unsigned char buf[102];
+ int dd;
+
+ dd = hci_open_dev(hdev);
+ if (dd < 0) {
+ printf("Can't open device hci%d. %s(%d)\n", hdev, strerror(errno), errno);
+ return;
+ }
+
+ if (hci_read_local_version(dd, &ver, 1000) < 0) {
+ printf("Can't read version info hci%d. %s(%d)\n",
+ hdev, strerror(errno), errno);
+ return;
+ }
+
+ print_dev_hdr(&di);
+ switch (ver.manufacturer) {
+ case 0:
+ memset(&rq, 0, sizeof(rq));
+ rq.ogf = 0x3f;
+ rq.ocf = 0x000f;
+ rq.cparam = NULL;
+ rq.clen = 0;
+ rq.rparam = &buf;
+ rq.rlen = sizeof(buf);
+
+ if (hci_send_req(dd, &rq, 1000) < 0) {
+ printf("\n Can't read revision info. %s(%d)\n",
+ strerror(errno), errno);
+ return;
+ }
+
+ printf("\t%s\n", buf + 1);
+ break;
+
+ default:
+ printf("\tUnsuported manufacturer\n");
+ break;
+ }
+ return;
+}
+
void print_dev_hdr(struct hci_dev_info *di)
{
static int hdr = -1;
@@ -687,13 +733,14 @@ struct {
{ "lp", cmd_lp, "[policy]", "Get/Set default link policy" },
{ "name", cmd_name, "[name]", "Get/Set local name" },
{ "class", cmd_class, "[class]", "Get/Set class of device" },
- { "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" },
- { "ptimeo", cmd_page_to, "[to]", "Get/Set page timeout" },
+ { "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" },
{ "aclmtu", cmd_aclmtu, "<mtu:pkt>","Set ACL MTU and number of packets" },
{ "scomtu", cmd_scomtu, "<mtu:pkt>","Set SCO MTU and number of packets" },
- { "version", cmd_version, 0, "Display version information" },
- { "features", cmd_features, 0,"Display device features" },
+ { "features", cmd_features, 0, "Display device features" },
+ { "version", cmd_version, 0, "Display version information" },
+ { "revision", cmd_revision, 0, "Display revision information" },
{ NULL, NULL, 0}
};
diff --git a/tools/hcitool.c b/tools/hcitool.c
index ae03ee96..8eaa2cc2 100644
--- a/tools/hcitool.c
+++ b/tools/hcitool.c
@@ -65,57 +65,6 @@ static int dev_info(int s, int dev_id, long arg)
return 0;
}
-static int rev_info(int s, int dev_id, long arg)
-{
- struct hci_version ver;
- int id = arg;
- int dd;
-
- struct hci_request rq;
- unsigned char buf[102];
-
- if (id != -1 && dev_id != id)
- return 0;
-
- dd = hci_open_dev(dev_id);
- if (dd < 0) {
- printf("Can't open device hci%d. %s(%d)\n", dev_id, strerror(errno), errno);
- return -1;
- }
-
- if (hci_read_local_version(dd, &ver, 1000) < 0) {
- printf("Can't read version info hci%d. %s(%d)\n",
- dev_id, strerror(errno), errno);
- return -1;
- }
-
- printf("hci%d:", dev_id);
- switch (ver.manufacturer) {
- case 0:
- memset(&rq, 0, sizeof(rq));
- rq.ogf = 0x3f;
- rq.ocf = 0x000f;
- rq.cparam = NULL;
- rq.clen = 0;
- rq.rparam = &buf;
- rq.rlen = sizeof(buf);
-
- if (hci_send_req(dd, &rq, 1000) < 0) {
- printf("\n Can't read revision info. %s(%d)\n",
- strerror(errno), errno);
- return -1;
- }
-
- printf("%s\n", buf + 1);
- break;
- default:
- printf("\n Manufacturer not supported\n");
- break;
- }
- printf("\n");
- return 0;
-}
-
static int conn_list(int s, int dev_id, long arg)
{
struct hci_conn_list_req *cl;
@@ -591,31 +540,6 @@ static void cmd_cmd(int dev_id, int argc, char **argv)
return;
}
-/* Display revision info */
-
-static struct option rev_options[] = {
- {"help", 0,0, 'h'},
- {0, 0, 0, 0}
-};
-
-static char *rev_help =
- "Usage:\n"
- "\trev\n";
-
-static void cmd_rev(int dev_id, int argc, char **argv)
-{
- int opt;
-
- for_each_opt(opt, rev_options, NULL) {
- switch(opt) {
- default:
- printf(rev_help);
- return;
- }
- }
- hci_for_each_dev(HCI_UP, rev_info, dev_id);
-}
-
/* Display active connections */
static struct option con_options[] = {
@@ -948,7 +872,6 @@ struct {
char *doc;
} command[] = {
{ "dev", cmd_dev, "Display local devices" },
- { "rev", cmd_rev, "Display revison information" },
{ "inq", cmd_inq, "Inquire remote devices" },
{ "scan", cmd_scan, "Scan for remote devices" },
{ "name", cmd_name, "Get name from remote device" },