diff options
author | Keith Packard <keithp@keithp.com> | 2009-11-03 01:27:37 -0800 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2009-11-03 01:27:37 -0800 |
commit | 27ebaf8e13aed06bb1ea6e770f767495a02be6c5 (patch) | |
tree | 5e685c8bf6b8e3fc158fa36c87ec60e88fb89006 /ao-tools/lib/cc-usb.c | |
parent | 1de322b960005c9a16051afa1881fadb00f4bcd6 (diff) |
Add ability to dump eeprom data over radio link.
This adds a '-R' option to ao-dumplog to redirect the connection
through a USB attached TeleDongle over the radio link to a remote
TeleMetrum device.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'ao-tools/lib/cc-usb.c')
-rw-r--r-- | ao-tools/lib/cc-usb.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/ao-tools/lib/cc-usb.c b/ao-tools/lib/cc-usb.c index 80d9c04f..9b3b831f 100644 --- a/ao-tools/lib/cc-usb.c +++ b/ao-tools/lib/cc-usb.c @@ -53,6 +53,8 @@ struct cc_usb { struct cc_hex_read hex_buf[CC_NUM_HEX_READ]; int hex_count; + + int remote; }; #define NOT_HEX 0xff @@ -372,6 +374,28 @@ cc_usb_reset(struct cc_usb *cc) return 1; } +void +cc_usb_open_remote(struct cc_usb *cc) +{ + if (!cc->remote) { + cc_usb_printf(cc, "p\nE 0\n"); + do { + cc->in_count = cc->in_pos = 0; + _cc_usb_sync(cc, 100); + } while (cc->in_count > 0); + cc->remote = 1; + } +} + +void +cc_usb_close_remote(struct cc_usb *cc) +{ + if (cc->remote) { + cc_usb_printf(cc, "~"); + cc->remote = 0; + } +} + static struct termios save_termios; struct cc_usb * @@ -406,6 +430,8 @@ cc_usb_open(char *tty) void cc_usb_close(struct cc_usb *cc) { + cc_usb_close_remote(cc); + cc_usb_sync(cc); tcsetattr(cc->fd, TCSAFLUSH, &save_termios); close (cc->fd); free (cc); |