diff options
author | Keith Packard <keithp@keithp.com> | 2013-04-22 17:20:51 -0500 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2013-04-22 17:20:51 -0500 |
commit | 33c3b2c57d0d4285b75d4dcf7ca67ad19da08c86 (patch) | |
tree | a9ff47afab29fe141dcd1da0ca276b367f911cb6 /ao-tools/lib/cc-usb.c | |
parent | 1a84db819a359be39be51c9105039ab28c9fc894 (diff) | |
parent | 90b0db1ae53182c94bf12d661446fc369d916366 (diff) |
Merge branch 'master' into stm-flash
Conflicts:
ao-tools/ao-stmload/ao-stmload.c
Diffstat (limited to 'ao-tools/lib/cc-usb.c')
-rw-r--r-- | ao-tools/lib/cc-usb.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/ao-tools/lib/cc-usb.c b/ao-tools/lib/cc-usb.c index 621a15c1..485583f9 100644 --- a/ao-tools/lib/cc-usb.c +++ b/ao-tools/lib/cc-usb.c @@ -258,10 +258,10 @@ cc_usb_printf(struct cc_usb *cc, char *format, ...) } int -cc_usb_getchar(struct cc_usb *cc) +cc_usb_getchar_timeout(struct cc_usb *cc, int timeout) { while (cc->in_pos == cc->in_count) { - if (_cc_usb_sync(cc, 5000) < 0) { + if (_cc_usb_sync(cc, timeout) < 0) { fprintf(stderr, "USB link timeout\n"); exit(1); } @@ -269,6 +269,12 @@ cc_usb_getchar(struct cc_usb *cc) return cc->in_buf[cc->in_pos++]; } +int +cc_usb_getchar(struct cc_usb *cc) +{ + return cc_usb_getchar_timeout(cc, 5000); +} + void cc_usb_getline(struct cc_usb *cc, char *line, int max) { @@ -424,6 +430,8 @@ cc_usb_open(char *tty) tcgetattr(cc->fd, &termios); save_termios = termios; cfmakeraw(&termios); + cfsetospeed(&termios, B9600); + cfsetispeed(&termios, B9600); tcsetattr(cc->fd, TCSAFLUSH, &termios); cc_usb_printf(cc, "\nE 0\nm 0\n"); do { |