summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2005-10-25 01:55:51 +0000
committerMarcel Holtmann <marcel@holtmann.org>2005-10-25 01:55:51 +0000
commit7dbda16a2352e6c935c47b49ecca3336bdc2a5da (patch)
tree0060aa6acb537e608fae0ad71aea9ed9e2c0f482
parentb77c88f001624ea277b84c0521286490c0c60c46 (diff)
Add support for reading the build definitions
-rw-r--r--tools/bccmd.83
-rw-r--r--tools/bccmd.c36
2 files changed, 39 insertions, 0 deletions
diff --git a/tools/bccmd.8 b/tools/bccmd.8
index a51be28e..58e8814f 100644
--- a/tools/bccmd.8
+++ b/tools/bccmd.8
@@ -23,6 +23,9 @@ devices. If run without the <command> argument, a short help page will be diapla
Specify a particular device to operate on. If not specified, default is the first available device.
.SH COMMANDS
.TP
+.BI builddef
+Get build definitions
+.TP
.BI keylen\ <handle>
Get current crypt key length
.TP
diff --git a/tools/bccmd.c b/tools/bccmd.c
index e476165e..4d32c089 100644
--- a/tools/bccmd.c
+++ b/tools/bccmd.c
@@ -42,6 +42,41 @@
#include "csr.h"
+static int cmd_builddef(int dd, int argc, char *argv[])
+{
+ uint8_t buf[8];
+ uint16_t seqnum = 0x4711, def = 0x0000, nextdef = 0x0000;
+ int err = 0;
+
+ printf("Build definitions:");
+
+ while (1) {
+ memset(buf, 0, sizeof(buf));
+ buf[0] = def & 0xff;
+ buf[1] = def >> 8;
+
+ err = csr_read_varid_complex(dd, seqnum++,
+ CSR_VARID_GET_NEXT_BUILDDEF, buf, sizeof(buf));
+ if (err < 0) {
+ errno = -err;
+ break;
+ }
+
+ nextdef = buf[2] | (buf[3] << 8);
+
+ if (nextdef == 0x0000)
+ break;
+
+ def = nextdef;
+
+ printf(" %s (0x%02x)", csr_builddeftostr(def), def);
+ }
+
+ printf("\n");
+
+ return err;
+}
+
static int cmd_keylen(int dd, int argc, char *argv[])
{
uint8_t buf[8];
@@ -171,6 +206,7 @@ static struct {
char *arg;
char *doc;
} commands[] = {
+ { "builddef", cmd_builddef, "", "Get build definitions" },
{ "keylen", cmd_keylen, "<handle>", "Get current crypt key length" },
{ "clock", cmd_clock, "", "Get local Bluetooth clock" },
{ "rand", cmd_rand, "", "Get random number" },