summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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" },