Skip to contentSkip to conversation

usb_serial_console: fix command line parsing

PATCH New Aristeu Rozanski 1 participant 1 message Nov 12, 2007

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb_serial_console: fix command line parsing

Currently usb serial console support ignores the device and always use ttyUSB0.

---
 drivers/usb/serial/console.c |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/usb/serial/console.c +6 -3
@@ -133,11 +133,14 @@ static int usb_console_setup(struct cons
 	}
 	co->cflag = cflag;
 
-	/* grab the first serial port that happens to be connected */
-	serial = usb_serial_get_by_index(0);
+	/*
+	 * no need to check the index here: if the index is wrong, console
+	 * code won't call us
+	 */
+	serial = usb_serial_get_by_index(co->index);
 	if (serial == NULL) {
 		/* no device is connected yet, sorry :( */
-		err ("No USB device connected to ttyUSB0");
+		err ("No USB device connected to ttyUSB%i", co->index);
 		return -ENODEV;
 	}