summaryrefslogtreecommitdiffstats
path: root/tools/bccmd.c
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2005-08-22 20:38:18 +0000
committerMarcel Holtmann <marcel@holtmann.org>2005-08-22 20:38:18 +0000
commit87af78afc0d5753583825f061c36f7705762c576 (patch)
tree9635e055d1986e29b276e8c8655b9eeac331b044 /tools/bccmd.c
parentb207244243cb0407728fbbb5ff8cbe95f9d74260 (diff)
Add support for reset and transmitter modification
Diffstat (limited to 'tools/bccmd.c')
-rw-r--r--tools/bccmd.c49
1 files changed, 45 insertions, 4 deletions
diff --git a/tools/bccmd.c b/tools/bccmd.c
index df39a3df..e476165e 100644
--- a/tools/bccmd.c
+++ b/tools/bccmd.c
@@ -95,6 +95,22 @@ static int cmd_clock(int dd, int argc, char *argv[])
return 0;
}
+static int cmd_rand(int dd, int argc, char *argv[])
+{
+ uint16_t rand = 0;
+ int err;
+
+ err = csr_read_varid_uint16(dd, 5, CSR_VARID_RAND, &rand);
+ if (err < 0) {
+ errno = -err;
+ return -1;
+ }
+
+ printf("Random number: 0x%02x (%d)\n", rand, rand);
+
+ return 0;
+}
+
static int cmd_panicarg(int dd, int argc, char *argv[])
{
uint16_t error = 0;
@@ -129,16 +145,41 @@ static int cmd_faultarg(int dd, int argc, char *argv[])
return 0;
}
+static int cmd_coldreset(int dd, int argc, char *argv[])
+{
+ return csr_write_varid_valueless(dd, 0, CSR_VARID_COLD_RESET);
+}
+
+static int cmd_warmreset(int dd, int argc, char *argv[])
+{
+ return csr_write_varid_valueless(dd, 0, CSR_VARID_WARM_RESET);
+}
+
+static int cmd_disabletx(int dd, int argc, char *argv[])
+{
+ return csr_write_varid_valueless(dd, 0, CSR_VARID_DISABLE_TX);
+}
+
+static int cmd_enabletx(int dd, int argc, char *argv[])
+{
+ return csr_write_varid_valueless(dd, 0, CSR_VARID_ENABLE_TX);
+}
+
static struct {
char *str;
int (*func)(int dd, int argc, char **argv);
char *arg;
char *doc;
} commands[] = {
- { "keylen", cmd_keylen, "<handle>", "Get current crypt key length" },
- { "clock", cmd_clock, "", "Get local Bluetooth clock" },
- { "panicarg", cmd_panicarg, "", "Get panic code argument" },
- { "faultarg", cmd_faultarg, "", "Get fault code argument" },
+ { "keylen", cmd_keylen, "<handle>", "Get current crypt key length" },
+ { "clock", cmd_clock, "", "Get local Bluetooth clock" },
+ { "rand", cmd_rand, "", "Get random number" },
+ { "panicarg", cmd_panicarg, "", "Get panic code argument" },
+ { "faultarg", cmd_faultarg, "", "Get fault code argument" },
+ { "coldreset", cmd_coldreset, "", "Perform cold reset" },
+ { "warmreset", cmd_warmreset, "", "Perform warm reset" },
+ { "disabletx", cmd_disabletx, "", "Disable TX on the device" },
+ { "enabletx", cmd_enabletx, "", "Enable TX on the device" },
{ NULL },
};