Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp948136imm; Wed, 10 Oct 2018 06:53:43 -0700 (PDT) X-Google-Smtp-Source: ACcGV60Juxt6gtCyrOt2Q7CV6TDk02jrHPUjc/lGLz+0vibrS9K5+vc49tNtlIZ6Ss/yUnRacchm X-Received: by 2002:a63:5c63:: with SMTP id n35-v6mr29693811pgm.402.1539179623903; Wed, 10 Oct 2018 06:53:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539179623; cv=none; d=google.com; s=arc-20160816; b=IYdFwnZnqmWzsrUWsJ3zPKtOMj/7NBF7KE9MwN4rTPklQXq+EWRTLxTWdFktNxuRL6 38j12ikNpLw3fN/phYuEGMy1IZzrPzjWiL5uSOaOST6oMkOuK+EzoCo2L3MzlXavYZdD 9pu+BzTaAy6JqdzA4ZhbvHneGIzKfiY5/jINR8xjbqXIiU4TErU0MM5HPLITzFDzTLRc Aa/Tn5LfeHNn4iwtQC9doQ2Y0lzgFQu7daqAnWu8+xVEOFyaqRqN3xD7VLUK8xMkrNyb W5vdqGTGdgyjAt5ychcLn0h7i2l4PrEfLri/1JHpbBEuTSCOaHljCVFnihEiANLuIBjN 75ag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=ZJUBLsUUYGuCw2X3PsGelapzRpFyVfpY6Jx62WnqIE8=; b=KwaKAcKTwihZncr4WmFm5eElf7pd14Znn2DIFT2SrNFYHzjQ8shRTeVNLFGeZMvEKc KRm4Qz698weJFqX1I+am8w3oEHjmHMJMgOcP8O7jU8C31QEjkflpfDR1zydyDWX78Nm5 CkQqapQMLPmEwYVtcfDX5o60dDt1gZk4uROrYh2P9quqILF2GhLGuLLNmnERWYQePD9d 9fsalt1rwNYd5mpJSDDsuLVPBjiY6Vc4fkyEm19tgUh137e7AemZEI4x+cDGy5uOzz3p WKJQRZkWXEDPbLcWsKkoDgvCIpB5l8irMk8do1/N2nd312Jx1JmPCVV35I9DeUxtfSMt 3F1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nanometrics.ca header.s=google header.b="Yz4/3Q4Y"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=nanometrics.ca Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a1-v6si23857466pld.313.2018.10.10.06.53.28; Wed, 10 Oct 2018 06:53:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nanometrics.ca header.s=google header.b="Yz4/3Q4Y"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=nanometrics.ca Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726728AbeJJVPP (ORCPT + 99 others); Wed, 10 Oct 2018 17:15:15 -0400 Received: from mail-lj1-f195.google.com ([209.85.208.195]:44338 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726664AbeJJVPP (ORCPT ); Wed, 10 Oct 2018 17:15:15 -0400 Received: by mail-lj1-f195.google.com with SMTP id v6-v6so4952909ljc.11 for ; Wed, 10 Oct 2018 06:52:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nanometrics.ca; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ZJUBLsUUYGuCw2X3PsGelapzRpFyVfpY6Jx62WnqIE8=; b=Yz4/3Q4YPBRn+1tB3up2OkqdpfIlrDeDT933/ry2pXM2pkQsliKWEOtMQSIQKxvwem UXLZ/kugAt55Miflo3xL2An5oEsXo2fLafUoPqaHlrrg3+lrurbG//C1MW9OFZXBT3vQ YYJlI/mC7u5EEh371IZKrysh7MM71/L1BVSk0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ZJUBLsUUYGuCw2X3PsGelapzRpFyVfpY6Jx62WnqIE8=; b=GObfoLf3pezxEAbAbFfTZewajUGLfvibktdE20llBVcp6AL5YyyWLl5BsAmCQMIbfA YjIGPISsHLwV3Ds5CgcxBCoXAsjg1kGGEu0ZqookiglJOhwAyjCdhV4XY1FQUQOkjRhi JMnGaCAQ6FPCeOKuDGNGAUIHO5z7EvRkEAbZrPeGPOCxa35+JiTTwTLdGUi4exGhCvw0 ihXMD0/qWje4+DETOPIkamgNSRqkX4jnurEyyyaQmoWKS0RJOMYf0rtJECIsXyOQx6XT GUSIAUCYV/Ai+CWTtRxfqfRZAE6dt6+lzBzOQLR/+CYg8BIjCvbuMX69kHlAYVsbqkRW +cKQ== X-Gm-Message-State: ABuFfogJmrCBmZzKVzgRNQeN85MiRwOsiXLQnHqiiRxJxFqNEI0H8hFD /B3BahXQ+8iFnudg2e4BHGA4FALPRwY8m496O8WhtkS+zSlM0xYYTSznhkXGt722U6bXEqauSgz Qt923blmpHozXrGsfNTkMIH9jQ1hVND2q X-Received: by 2002:a2e:3101:: with SMTP id x1-v6mr18441439ljx.83.1539179575461; Wed, 10 Oct 2018 06:52:55 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: James Nuss Date: Wed, 10 Oct 2018 09:52:44 -0400 Message-ID: Subject: Re: [PATCH 2/7] mmc-utils: treat FIRMWARE_VERSION as binary field instead of string To: Avri.Altman@wdc.com Cc: linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 10, 2018 at 4:43 AM Avri Altman 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. > > Thanks, > Avri > -- -- This message is intended exclusively for the individual or entity to which it is addressed. This communication may contain information that is proprietary, privileged, confidential or otherwise legally exempt from disclosure. If you are not the named addressee, or have been inadvertently and erroneously referenced in the address line, you are not authorized to read, print, retain, copy or disseminate this message or any part of it. If you have received this message in error, please notify the sender immediately by e-mail and delete all copies of the message.