summaryrefslogtreecommitdiff
path: root/altosui/libaltos/cjnitest.c
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2010-11-24 21:00:52 -0800
committerKeith Packard <keithp@keithp.com>2010-11-24 21:00:52 -0800
commit51c7741040d95c5deece939dae5e4136cc04afc4 (patch)
tree96631ee5aa9fd0c8c45f019ff154cc4fc8ca85d0 /altosui/libaltos/cjnitest.c
parentd1dbe3b69e6f95ef8ecd4cf959863b922ab47c66 (diff)
parent4e47c44d335276cf0dc5ed3a0756e50c98c1b9b9 (diff)
Merge branch 'buttonbox'
Conflicts: doc/telemetrum-doc.xsl Pull the buttbox version of the docs in as it had been updated. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'altosui/libaltos/cjnitest.c')
-rw-r--r--altosui/libaltos/cjnitest.c43
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();
+}