X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=drivers%2Fserial%2Fusbtty.c;h=29799dce93a00fa1a547118fc16d493ad4323da7;hb=f5b5719cdf13f3ee1ae949a3bcffafb6431eead4;hp=75f0ec31bbfb9a6faedeaf9cf137ea1212ceefd5;hpb=bd5053ffa5b8162257537bdb79ba829372423096;p=oweals%2Fu-boot.git diff --git a/drivers/serial/usbtty.c b/drivers/serial/usbtty.c index 75f0ec31bb..29799dce93 100644 --- a/drivers/serial/usbtty.c +++ b/drivers/serial/usbtty.c @@ -434,11 +434,12 @@ void usbtty_putc(struct stdio_dev *dev, const char c) if (!usbtty_configured ()) return; - buf_push (&usbtty_output, &c, 1); /* If \n, also do \r */ if (c == '\n') buf_push (&usbtty_output, "\r", 1); + buf_push(&usbtty_output, &c, 1); + /* Poll at end to handle new data... */ if ((usbtty_output.size + 2) >= usbtty_output.totalsize) { usbtty_poll (); @@ -498,8 +499,8 @@ void usbtty_puts(struct stdio_dev *dev, const char *str) n = next_nl_pos (str); if (str[n] == '\n') { - __usbtty_puts (str, n + 1); - __usbtty_puts ("\r", 1); + __usbtty_puts("\r", 1); + __usbtty_puts(str, n + 1); str += (n + 1); len -= (n + 1); } else { @@ -849,6 +850,13 @@ static int write_buffer (circbuf_t * buf) struct urb *current_urb = NULL; current_urb = next_urb (device_instance, endpoint); + + if (!current_urb) { + TTYERR ("current_urb is NULL, buf->size %d\n", + buf->size); + return 0; + } + /* TX data still exists - send it now */ if(endpoint->sent < current_urb->actual_length){ @@ -870,12 +878,6 @@ static int write_buffer (circbuf_t * buf) */ while (buf->size > 0) { - if (!current_urb) { - TTYERR ("current_urb is NULL, buf->size %d\n", - buf->size); - return total; - } - dest = (char*)current_urb->buffer + current_urb->actual_length;