[PATCH] loadb: only try to change the baudrate if the driver has this feature

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



this allows loadb to work over usbserial gadget

Signed-off-by: Eric Bénard <eric@xxxxxxxxxx>
---
 commands/loadb.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/commands/loadb.c b/commands/loadb.c
index 439a83a..d60340e 100644
--- a/commands/loadb.c
+++ b/commands/loadb.c
@@ -690,12 +690,13 @@ static int do_load_serial_bin(struct command *cmdtp, int argc, char *argv[])
 {
 	ulong offset = 0;
 	ulong addr;
-	int load_baudrate = 0, current_baudrate;
+	int load_baudrate = 0, current_baudrate = 0;
 	int rcode = 0;
 	int opt;
 	int open_mode = O_WRONLY;
 	char *output_file = NULL;
 	struct console_device *cdev = NULL;
+	unsigned char baudrate[16];
 
 	while ((opt = getopt(argc, argv, "f:b:o:c")) > 0) {
 		switch (opt) {
@@ -722,7 +723,8 @@ static int do_load_serial_bin(struct command *cmdtp, int argc, char *argv[])
 		printf("%s:No console device with STDIN and STDOUT\n", argv[0]);
 		return -ENODEV;
 	}
-	current_baudrate = (int)simple_strtoul(dev_get_param(&cdev->class_dev, "baudrate"), NULL, 10);
+	if (dev_get_param(&cdev->class_dev, "baudrate") != NULL)
+		current_baudrate = (int)simple_strtoul(dev_get_param(&cdev->class_dev, "baudrate"), NULL, 10);
 
 	/* Load Defaults */
 	if (load_baudrate == 0)
-- 
1.7.7.5


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux