diff options
author | Keith Packard <keithp@keithp.com> | 2010-08-17 18:19:43 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2010-08-17 18:19:43 -0700 |
commit | d14c96663a1027164fa30ed89b53f5a9d3fdb82b (patch) | |
tree | 65c0d7ba56fa0fd1b42cc70892e6fb3f81954627 /ao-tools/libaltos/cjnitest.c | |
parent | 294d9c7db21eaf1e71504dbcca5040371abcce55 (diff) |
libaltos: integrate Windows support.
This adds Windows support for discovery and I/O.
The API to the library is mostly unchanged, except that it now exports
product and vendor USB IDs as Win7 doesn't expose the product name
anywhere that we've been able to find, so we'll be updating the
firmware to use unique idProduct values for each product.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'ao-tools/libaltos/cjnitest.c')
-rw-r--r-- | ao-tools/libaltos/cjnitest.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/ao-tools/libaltos/cjnitest.c b/ao-tools/libaltos/cjnitest.c index cd3898ed..93d1f376 100644 --- a/ao-tools/libaltos/cjnitest.c +++ b/ao-tools/libaltos/cjnitest.c @@ -1,6 +1,15 @@ #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; @@ -12,12 +21,20 @@ main () 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); - altos_putchar(file, '?'); altos_putchar(file, '\n'); altos_flush(file); + if (!file) { + printf("altos_open failed\n"); + continue; + } + altos_puts(file,"v\nc s\n"); while ((c = altos_getchar(file, 100)) >= 0) { putchar (c); } - printf ("getchar returns %d\n", c); + if (c != LIBALTOS_TIMEOUT) + printf ("getchar returns %d\n", c); altos_close(file); } altos_list_finish(list); |