linux-mmc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Enrico Jorns <ejo@pengutronix.de>
To: linux-mmc@vger.kernel.org
Cc: Avri Altman <avri.altman@wdc.com>,
	Ulf Hansson <ulf.hansson@linaro.org>,
	ejo@pengutronix.de
Subject: [PATCH 2/3] mmc-utils: fix printing OID for mmc in non-verbose mode
Date: Mon, 22 May 2023 23:48:17 +0200	[thread overview]
Message-ID: <20230522214818.2038252-2-ejo@pengutronix.de> (raw)
In-Reply-To: <20230522214818.2038252-1-ejo@pengutronix.de>

It is parsed as an integer and printed as a char which does not really
make sense.
E.g. if OID is '0' (which does not seem to be uncommon), then this
prints a '\0' character and makes output nearly unreadable/unparsable.

Also, do not print it like it would be a string, instead use 0x<digit>
format.

Signed-off-by: Enrico Jorns <ejo@pengutronix.de>
---
 lsmmc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lsmmc.c b/lsmmc.c
index da9d69e..cea43af 100644
--- a/lsmmc.c
+++ b/lsmmc.c
@@ -636,10 +636,10 @@ void print_mmc_cid(struct config *config, char *cid)
 		printf("\tCRC: 0x%02x\n", crc);
 	} else {
 		if (config->mmc_ids[mid])
-			printf("manufacturer: '%s' '%c'\n",
+			printf("manufacturer: '%s' 0x%01x\n",
 			       config->mmc_ids[mid], oid);
 		else
-			printf("manufacturer: 'Unlisted' '%c'\n", oid);
+			printf("manufacturer: 'Unlisted' 0x%01x\n", oid);
 
 		printf("product: '%s' %u.%u\n", pnm, prv_major, prv_minor);
 		printf("serial: 0x%08x\n", psn);
-- 
2.39.2


  reply	other threads:[~2023-05-22 21:49 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-22 21:48 [PATCH 1/3] mmc-utils: add SanDisk to manufacturer database Enrico Jorns
2023-05-22 21:48 ` Enrico Jorns [this message]
2023-05-24  6:45   ` [PATCH 2/3] mmc-utils: fix printing OID for mmc in non-verbose mode Avri Altman
2023-05-24 15:15   ` Ulf Hansson
2023-05-22 21:48 ` [PATCH 3/3] mmc-utils: do not hide CID manufacturer information Enrico Jorns
2023-05-24  6:48   ` Avri Altman
2023-05-24 15:15   ` Ulf Hansson
2023-05-24  6:41 ` [PATCH 1/3] mmc-utils: add SanDisk to manufacturer database Avri Altman
2023-05-24 15:15 ` Ulf Hansson

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=20230522214818.2038252-2-ejo@pengutronix.de \
    --to=ejo@pengutronix.de \
    --cc=avri.altman@wdc.com \
    --cc=linux-mmc@vger.kernel.org \
    --cc=ulf.hansson@linaro.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;
as well as URLs for NNTP newsgroup(s).