X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=lib%2Fcc-usb.c;h=dc764c24e99f79fd326226cbb8f795063ab58340;hp=2efe572ed701043340b8030b94cd4190085bd7ce;hb=17d2432a8b9c15963cd3b821f025ad33972ef477;hpb=8a9a3f02b951382573ff74dd6ce5a1c0f335fa86 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); } -