Message ID | 20230522214818.2038252-2-ejo@pengutronix.de |
---|---|
State | New |
Headers | show |
Series | [1/3] mmc-utils: add SanDisk to manufacturer database | expand |
> > 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> Reviewed-by: Avri Altman <avri.altman@wdc.com> > --- > 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
On Mon, 22 May 2023 at 23:49, Enrico Jorns <ejo@pengutronix.de> wrote: > > 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> Applied to git.kernel.org/pub/scm/utils/mmc/mmc-utils.git master, thanks! Kind regards Uffe > --- > 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 >
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);
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(-)