projects
/
fw
/
altos
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge ccdbg and altos sources into one giant repository
[fw/altos]
/
lib
/
cc-usb.c
diff --git
a/lib/cc-usb.c
b/lib/cc-usb.c
index 2efe572ed701043340b8030b94cd4190085bd7ce..dc764c24e99f79fd326226cbb8f795063ab58340 100644
(file)
--- 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;
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
*/
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++;
/*
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++;
}
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,
/* 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;
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);
/* 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;
{
int this_len;
int ret = len;
-
+
while (len) {
this_len = len;
if (this_len > 8)
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;
{
struct cc_usb *cc;
struct termios termios;
-
+
if (!tty)
tty = DEFAULT_TTY;
cc = calloc (sizeof (struct cc_usb), 1);
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);
}
close (cc->fd);
free (cc);
}
-