mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: "Eric Bénard" <eric@eukrea.com>
To: barebox@lists.infradead.org
Subject: [PATCH] loadb: only try to change the baudrate if the driver has this feature
Date: Wed,  4 Jan 2012 16:01:16 +0100	[thread overview]
Message-ID: <1325689276-12863-1-git-send-email-eric@eukrea.com> (raw)
In-Reply-To: <20120104114533.GB1810@game.jcrosoft.org>

this allows loadb to work over usbserial gadget

Signed-off-by: Eric Bénard <eric@eukrea.com>
---
 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@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2012-01-04 15:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-04 10:35 [PATCH] u_serial: add setbrg to be able to use loadb & co Eric Bénard
2012-01-04 11:45 ` Jean-Christophe PLAGNIOL-VILLARD
2012-01-04 15:01   ` Eric Bénard [this message]
2012-01-04 16:37     ` [PATCH] loadb: only try to change the baudrate if the driver has this feature Sascha Hauer
2012-01-04 17:04       ` Eric Bénard
2012-01-05  8:28         ` Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1325689276-12863-1-git-send-email-eric@eukrea.com \
    --to=eric@eukrea.com \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox