summaryrefslogtreecommitdiff
path: root/ao-tools
diff options
context:
space:
mode:
Diffstat (limited to 'ao-tools')
-rw-r--r--ao-tools/ao-chaosread/ao-chaosread.16
-rw-r--r--ao-tools/ao-chaosread/ao-chaosread.c9
-rw-r--r--ao-tools/ao-dumplog/ao-dumplog.c17
3 files changed, 28 insertions, 4 deletions
diff --git a/ao-tools/ao-chaosread/ao-chaosread.1 b/ao-tools/ao-chaosread/ao-chaosread.1
index e6ed2fac..94ca5ce9 100644
--- a/ao-tools/ao-chaosread/ao-chaosread.1
+++ b/ao-tools/ao-chaosread/ao-chaosread.1
@@ -47,6 +47,12 @@ from the noise source.
.TP
\-r | --raw
Read raw data from the noise source. This is the default.
+.TP
+\-f | --flash
+Read the contents of flash memory on the device. This loops through
+flash memory, so you can read the contents more than once, but there's
+no way to reset the pointer back to the start other than making sure
+you read the whole contents.
.SH USAGE
.I ao-chaosread
reads noise data.
diff --git a/ao-tools/ao-chaosread/ao-chaosread.c b/ao-tools/ao-chaosread/ao-chaosread.c
index 8a814a00..5c0de125 100644
--- a/ao-tools/ao-chaosread/ao-chaosread.c
+++ b/ao-tools/ao-chaosread/ao-chaosread.c
@@ -174,6 +174,7 @@ chaoskey_close(struct chaoskey *ck)
#define COOKED_ENDPOINT 0x85
#define RAW_ENDPOINT 0x86
+#define FLASH_ENDPOINT 0x87
int
chaoskey_read(struct chaoskey *ck, int endpoint, void *buffer, int len)
@@ -208,12 +209,13 @@ static const struct option options[] = {
{ .name = "bytes", .has_arg = 0, .val = 'b' },
{ .name = "cooked", .has_arg = 0, .val = 'c' },
{ .name = "raw", .has_arg = 0, .val = 'r' },
+ { .name = "flash", .has_arg = 0, .val = 'f' },
{ 0, 0, 0, 0},
};
static void usage(char *program)
{
- fprintf(stderr, "usage: %s [--serial=<serial>] [--length=<length>[kMG]] [--infinite] [--bytes] [--cooked] [--raw]\n", program);
+ fprintf(stderr, "usage: %s [--serial=<serial>] [--length=<length>[kMG]] [--infinite] [--bytes] [--cooked] [--raw] [--flash]\n", program);
exit(1);
}
@@ -233,7 +235,7 @@ main (int argc, char **argv)
int bytes = 0;
int endpoint = RAW_ENDPOINT;
- while ((c = getopt_long(argc, argv, "s:l:ibcr", options, NULL)) != -1) {
+ while ((c = getopt_long(argc, argv, "s:l:ibcrf", options, NULL)) != -1) {
switch (c) {
case 's':
serial = optarg;
@@ -262,6 +264,9 @@ main (int argc, char **argv)
case 'r':
endpoint = RAW_ENDPOINT;
break;
+ case 'f':
+ endpoint = FLASH_ENDPOINT;
+ break;
default:
usage(argv[0]);
break;
diff --git a/ao-tools/ao-dumplog/ao-dumplog.c b/ao-tools/ao-dumplog/ao-dumplog.c
index 6d4fa5bf..41d0ac10 100644
--- a/ao-tools/ao-dumplog/ao-dumplog.c
+++ b/ao-tools/ao-dumplog/ao-dumplog.c
@@ -90,6 +90,8 @@ main (int argc, char **argv)
int any_valid;
int invalid;
char serial_line[8192];
+ unsigned storage_size;
+ int blocks;
while ((c = getopt_long(argc, argv, "T:D:C:R", options, NULL)) != -1) {
switch (c) {
@@ -140,10 +142,21 @@ main (int argc, char **argv)
cc_usb_close(cc);
exit(1);
}
- printf ("Serial number: %d\n", serial_number);
+ cc_usb_printf(cc, "f\n");
+ storage_size = 0;
+ for (;;) {
+ cc_usb_getline(cc, line, sizeof(line));
+ if (sscanf(line, "Storage size: %u", &storage_size) == 1)
+ break;
+ }
+ printf ("Serial number: %d Storage size: %u\n", serial_number, storage_size);
+ if (storage_size)
+ blocks = storage_size / 256;
+ else
+ blocks = 511;
done = 0;
column = 0;
- for (block = 0; !done && block < 511; block++) {
+ for (block = 0; !done && block < blocks; block++) {
cc_usb_printf(cc, "e %x\n", block);
if (column == 64) {
putchar('\n');