diff options
Diffstat (limited to 'lib/cc-usb.c')
-rw-r--r-- | lib/cc-usb.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/lib/cc-usb.c b/lib/cc-usb.c index 2efe572e..dc764c24 100644 --- a/lib/cc-usb.c +++ b/lib/cc-usb.c @@ -77,14 +77,14 @@ cc_handle_in(struct cc_usb *cc) uint8_t h, l; int in_pos; int read_pos; - + in_pos = 0; read_pos = 0; while (read_pos < cc->read_count && in_pos < cc->in_count) { /* * Skip to next hex character */ - while (in_pos < cc->in_count && + while (in_pos < cc->in_count && cc_hex_nibble(cc->in_buf[in_pos]) == NOT_HEX) in_pos++; /* @@ -109,7 +109,7 @@ cc_handle_in(struct cc_usb *cc) if (--cc->read_buf[read_pos].len <= 0) read_pos++; } - + /* Move remaining bytes to the start of the input buffer */ if (in_pos) { memmove(cc->in_buf, cc->in_buf + in_pos, @@ -213,7 +213,7 @@ cc_usb_printf(struct cc_usb *cc, char *format, ...) char buf[1024], *b; va_list ap; int ret, this_time; - + /* sprintf to a local buffer */ va_start(ap, format); ret = vsnprintf(buf, sizeof(buf), format, ap); @@ -243,7 +243,7 @@ cc_usb_send_bytes(struct cc_usb *cc, uint8_t *bytes, int len) { int this_len; int ret = len; - + while (len) { this_len = len; if (this_len > 8) @@ -327,7 +327,7 @@ cc_usb_open(char *tty) { struct cc_usb *cc; struct termios termios; - + if (!tty) tty = DEFAULT_TTY; cc = calloc (sizeof (struct cc_usb), 1); @@ -357,4 +357,3 @@ cc_usb_close(struct cc_usb *cc) close (cc->fd); free (cc); } - |