mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: "Ulrich Ölmann" <u.oelmann@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH 2/2] commands: spi: do not restrict spi's data to be hex-formatted
Date: Thu, 19 Oct 2017 08:53:08 +0200	[thread overview]
Message-ID: <20171019065308.2507-3-u.oelmann@pengutronix.de> (raw)
In-Reply-To: <20171019065308.2507-1-u.oelmann@pengutronix.de>

Change the default base to 0 to be consistent with the "mw" command and
particularly allow decimally formatted data.

The price to pay is needing the usual prefix "0x" for each hex-formatted number.

Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de>
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 commands/spi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/commands/spi.c b/commands/spi.c
index 6603b34b673c..7bf193b0bbbb 100644
--- a/commands/spi.c
+++ b/commands/spi.c
@@ -84,7 +84,7 @@ static int do_spi(int argc, char *argv[])
 	rx_buf = xmalloc(read);
 
 	for (i = 0; i < count; i++)
-		tx_buf[i] = (u8) simple_strtol(argv[optind + i], NULL, 16);
+		tx_buf[i] = (u8) simple_strtol(argv[optind + i], NULL, 0);
 
 	ret = spi_write_then_read(&spi, tx_buf, count, rx_buf, read);
 	if (ret)
-- 
2.11.0


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

  parent reply	other threads:[~2017-10-19  6:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-19  6:53 [PATCH 0/2] Allow decimally formatted data for the commands "i2c_write" and "spi" Ulrich Ölmann
2017-10-19  6:53 ` [PATCH 1/2] commands: i2c: do not restrict i2c_write's data to be hex-formatted Ulrich Ölmann
2017-10-19  6:53 ` Ulrich Ölmann [this message]
2017-10-19  7:44 ` [PATCH 0/2] Allow decimally formatted data for the commands "i2c_write" and "spi" Ulrich Ölmann
2017-10-23  7:27 ` Sascha Hauer
  -- strict thread matches above, loose matches on Subject: below --
2017-10-17 13:16 Ulrich Ölmann
2017-10-17 13:16 ` [PATCH 2/2] commands: spi: do not restrict spi's data to be hex-formatted Ulrich Ölmann

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=20171019065308.2507-3-u.oelmann@pengutronix.de \
    --to=u.oelmann@pengutronix.de \
    --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