diff options
author | Keith Packard <keithp@keithp.com> | 2010-11-24 15:10:36 -0800 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2010-11-24 15:10:36 -0800 |
commit | 28d621c5885953afe3b7435e582b80b75314506e (patch) | |
tree | b5d6da55ce3e790a83352dd1433f88b4696e4171 /altosui/libaltos/cjnitest.c | |
parent | 6d0098e497ee2d9a1d1113bf3fb907dd48bdcf80 (diff) | |
parent | 3fbefb3eea981d34a09496cf8abf0119de2e35bf (diff) |
Merge branch 'buttonbox' into telemetrum-v1.1telemetrum-v1.1
Diffstat (limited to 'altosui/libaltos/cjnitest.c')
-rw-r--r-- | altosui/libaltos/cjnitest.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/altosui/libaltos/cjnitest.c b/altosui/libaltos/cjnitest.c new file mode 100644 index 00000000..c6d6e069 --- /dev/null +++ b/altosui/libaltos/cjnitest.c @@ -0,0 +1,43 @@ +#include <stdio.h> +#include "libaltos.h" + +static void +altos_puts(struct altos_file *file, char *string) +{ + char c; + + while ((c = *string++)) + altos_putchar(file, c); +} + +main () +{ + struct altos_device device; + struct altos_list *list; + + altos_init(); + list = altos_list_start(); + while (altos_list_next(list, &device)) { + struct altos_file *file; + int c; + + printf ("%04x:%04x %-20s %4d %s\n", device.vendor, device.product, + device.name, device.serial, device.path); + + file = altos_open(&device); + if (!file) { + printf("altos_open failed\n"); + continue; + } + altos_puts(file,"v\nc s\n"); + altos_flush(file); + while ((c = altos_getchar(file, 100)) >= 0) { + putchar (c); + } + if (c != LIBALTOS_TIMEOUT) + printf ("getchar returns %d\n", c); + altos_close(file); + } + altos_list_finish(list); + altos_fini(); +} |