RE: [PATCH 2/7] mmc-utils: treat FIRMWARE_VERSION as binary field instead of string
From: Avri Altman
Date: Wed Oct 10 2018 - 09:59:42 EST
>
> On Wed, Oct 10, 2018 at 4:43 AM Avri Altman <Avri.Altman@xxxxxxx> wrote:
> >
> >
> > > +++ b/mmc_cmds.c
> > > @@ -1758,8 +1758,15 @@ int do_read_extcsd(int nargs, char **argv)
> > > }
> > >
> > > if (ext_csd_rev >= 7) {
> > > - printf("eMMC Firmware Version: %s\n",
> > > - (char*)&ext_csd[EXT_CSD_FIRMWARE_VERSION]);
> > > + printf("Firmware Version:
> > > 0x%02x%02x%02x%02x%02x%02x%02x%02x\n",
> > > + ext_csd[EXT_CSD_FIRMWARE_VERSION_7],
> > > + ext_csd[EXT_CSD_FIRMWARE_VERSION_6],
> > > + ext_csd[EXT_CSD_FIRMWARE_VERSION_5],
> > > + ext_csd[EXT_CSD_FIRMWARE_VERSION_4],
> > > + ext_csd[EXT_CSD_FIRMWARE_VERSION_3],
> > > + ext_csd[EXT_CSD_FIRMWARE_VERSION_2],
> > > + ext_csd[EXT_CSD_FIRMWARE_VERSION_1],
> > > + ext_csd[EXT_CSD_FIRMWARE_VERSION_0]);
> > ExtCSD[261:254] is an ASCII string, just add a terminating null.
>
> Unfortunately I found two different manufacturers which put
> non-printable characters in this 8-byte field. So I don't think it can
> be treated as ASCII in all cases. Printing out the hex value seemed
> liked the most comprehensive solution.
NAK with prejudice.
This interfere with the output that we/our clients expects.