[PATCH 2/2] commands: spi: do not restrict spi's data to be hex-formatted

Ulrich Ölmann u.oelmann at pengutronix.de
Tue Oct 17 06:16:25 PDT 2017


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

Signed-off-by: Ulrich Ölmann <u.oelmann at 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




More information about the barebox mailing list