RE: [PATCH 2/7] mmc-utils: treat FIRMWARE_VERSION as binary field instead of string

From: Avri Altman
Date: Wed Oct 10 2018 - 04:43:40 EST



> +++ 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.

Thanks,
Avri