summaryrefslogtreecommitdiffstats
path: root/tools/bccmd.c
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 /tools/bccmd.c
parentb77c88f001624ea277b84c0521286490c0c60c46 (diff)
Add support for reading the build definitions
Diffstat (limited to 'tools/bccmd.c')
-rw-r--r--tools/bccmd.c36
1 files changed, 36 insertions, 0 deletions
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" },