Skip to contentSkip to conversation

usbtty: Added additional usbtty_configured() checks to get around hang when usb is not connected but multi-io is set up.

PATCH New Atin Malaviya 1 participant 1 message Feb 3, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usbtty: Added additional usbtty_configured() checks to get around hang when usb is not connected but multi-io is set up.

This adds additional checks in usbtty_puts() and usbtty_putc() to get around a hang when usb is not connected but multi-io (setenv stdout serial,usbtty etc) is set up by the user. We hang because the buffers get full because usb isn't connected.

---
 drivers/serial/usbtty.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
drivers/serial/usbtty.c +8 -1
index 7eba470..0e4e17d 100644
@@ -433,6 +433,9 @@ int usbtty_getc (void)
  */
 void usbtty_putc (const char c)
 {
+	if (!usbtty_configured ())
+		return;
+
 	buf_push (&usbtty_output, &c, 1);
 	/* If \n, also do \r */
 	if (c == '\n')
@@ -486,8 +489,12 @@ static void __usbtty_puts (const char *str, int len)
 void usbtty_puts (const char *str)
 {
 	int n;
-	int len = strlen (str);
+	int len;
+
+	if (!usbtty_configured ())
+		return;
 
+	len = strlen (str);
 	/* add '\r' for each '\n' */
 	while (len > 0) {
 		n = next_nl_pos (str);
Signature · 1 line
1.5.6.3