From patchwork Fri Sep 1 12:42:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 111482 Delivered-To: patch@linaro.org Received: by 10.37.128.210 with SMTP id c18csp879667ybm; Fri, 1 Sep 2017 05:42:15 -0700 (PDT) X-Received: by 10.80.135.137 with SMTP id a9mr1618068eda.157.1504269735120; Fri, 01 Sep 2017 05:42:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504269735; cv=none; d=google.com; s=arc-20160816; b=Q4ff5eT8QeA32eNqVJRfhx89R6+o04Y/UdtmImFliRXZAWB/ZQ7QgVMbfZF4/ivSN1 vKaJg3ZuQ6e3VYjMZ9cNLZE1VpUJAdZwufPUBRpVwgk7FAnSMXKA/dLPIkh+4h7UMsge Ms9ofrfSLJQxOW6NplYGOnDbYtgBEi/3qJZjOXgaKjZqn0uCAygY+EJRV7UCj+qa54OW JO8PI1EGTqMGDlwBuRPx8utMsN13Dr39pRoSVVJ9ttXWaDsKZHlFS0fLAu8P3Em5CRYP C3NdYV8Em+aoRzLNpNgM8UbEiZkFkdB0rcd/cwxF7Ovv19jWCbglvfb98lMEpDfpO7lx Ezow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:message-id:date:to:from :dkim-signature:arc-authentication-results; bh=J92ip96WVvAttaKt38DhrUQM4WyMj04rvq3MCm4142M=; b=SR3FUEu33aun0M0jZO9EoWadaV9vk8tiCA8zMgEHwc6/aa5Xsj7f0dW5FysQuuhqYq 5rHRbXcVUam2R0GYhcg4wqrb9u0QHi2yWSOn0Je/gqoAr6rHXzWGQHqUytnFtIh+J1yd vJ9r4WnNaRzz3UBkLpozcsR5VrHNBcfUdFlup2ZH7RvDURXu02j6AJQIvjx3kckbn6nT UJcmOo1El8cO/HWllBbvxTM23k1sKikMuC6p+BEvBNd7xNlzILIW0AmVW/AeK4Rh6H+W wBPihd2t2JICSyD4Wa28djE2+d/QaTws/NQoJ/akt+jDujsfyefskon1gn2tp/nlje+R 3WWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=kcp7yu90; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id t14si34967edc.545.2017.09.01.05.42.14; Fri, 01 Sep 2017 05:42:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=kcp7yu90; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by lists.denx.de (Postfix, from userid 105) id 064CAC21F19; Fri, 1 Sep 2017 12:42:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 06B48C21D19; Fri, 1 Sep 2017 12:42:10 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id E5CE4C21D19; Fri, 1 Sep 2017 12:42:07 +0000 (UTC) Received: from mail-lf0-f53.google.com (mail-lf0-f53.google.com [209.85.215.53]) by lists.denx.de (Postfix) with ESMTPS id 5377EC21C72 for ; Fri, 1 Sep 2017 12:42:07 +0000 (UTC) Received: by mail-lf0-f53.google.com with SMTP id d202so340218lfd.5 for ; Fri, 01 Sep 2017 05:42:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=yCnCSXJFOquCkEsKzzsNnJ4NxP+twaxCpL4PsenLanE=; b=kcp7yu902qmmweYx4sk5Nbfe0biFgFMPC+BkLQdV4cehAFNLwS3WZ1CG5U4M8SSe3o GA8T7RiJO5rMzTD7QloSUaeh8InKaidKRMB+NKp00/GpthqRo0ydIZT4FJ0Ej/EmOzcS IntFUmVJcGHJL5gAIG1H2wsgdy5YPwGGPUoAs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=yCnCSXJFOquCkEsKzzsNnJ4NxP+twaxCpL4PsenLanE=; b=ZUmwQ1K0rb/6WXw5nOZkm6T/DHpeKHAKJFnHEjqnJNakXpurNJt9tKI5Gv/aXO1t7R MWZjKZcMC3H+IEMR0aMXqvCvzK/86MryzfQt93/pUnHmjlVi4c33fQQi31681J6scI0l t7hjWkrZxrGY6z4UpJJ2kZmGxvJGQAeOlSti517QSDlA6y4Synrm2H8B/iLBhwasNNM4 u+w+60m6/4iFtp7Ht7XptlipC1xuQswcrSVlgRiIgJ7GrYAYjE16eXDUQ4ZBZcuEm5tp 0pIuhr1z3pKw1O4R8lLUMif/qoT3KtMhYZPlQB1gEAu/PiQ8N9RbFsEhSWwdpzQEjSJm IJhw== X-Gm-Message-State: AHPjjUibU8sGuTxvp3BXEG+vkp9d/CnWn+w81GfE43AfDbuk1gJdb01u gnoNzUqd2arZjuvPdxQJuw== X-Google-Smtp-Source: ADKCNb6/JZkiX4v2z6dDROkStYT7KE5c0eK44ZaSvaku8Nd0B8Yw4fZvpIyuUjn2B4COziSCemeLUw== X-Received: by 10.25.154.72 with SMTP id c69mr750398lfe.173.1504269726496; Fri, 01 Sep 2017 05:42:06 -0700 (PDT) Received: from localhost ([195.238.92.132]) by smtp.gmail.com with ESMTPSA id h89sm9548lji.56.2017.09.01.05.42.04 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 01 Sep 2017 05:42:04 -0700 (PDT) From: Sam Protsenko To: u-boot@lists.denx.de Date: Fri, 1 Sep 2017 15:42:03 +0300 Message-Id: <20170901124203.19462-1-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.14.1 Cc: Marek Vasut , Tom Rini , Praneeth Bajjuri Subject: [U-Boot] [PATCH v3 1/1] usb: gadget: g_dnl: Sync internal SN variable with env X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Since commit 842778a09104 ("usb: gadget: g_dnl: only set iSerialNumber if we have a serial#") "fastboot devices" stopped to show correct device serial number for TI boards, showing this line instead: ???????????? fastboot This is because serial# env variable could be set after g_dnl gadget was initialized (e.g. by using env_set() in the board file). To fix this, let's update internal serial number variable (g_dnl_serial) when "serial#" env var is changed. Signed-off-by: Sam Protsenko Cc: Felipe Balbi Tested-by: Heiko Schocher Acked-by: Ɓukasz Majewski Reviewed-by: Marek Vasut --- drivers/usb/gadget/g_dnl.c | 15 +++++++++++++++ include/env_callback.h | 1 + 2 files changed, 16 insertions(+) diff --git a/drivers/usb/gadget/g_dnl.c b/drivers/usb/gadget/g_dnl.c index 0491a0eea9..039331a5af 100644 --- a/drivers/usb/gadget/g_dnl.c +++ b/drivers/usb/gadget/g_dnl.c @@ -19,6 +19,8 @@ #include #include +#include + #include "gadget_chips.h" #include "composite.c" @@ -202,6 +204,19 @@ static int g_dnl_get_bcd_device_number(struct usb_composite_dev *cdev) return g_dnl_get_board_bcd_device_number(gcnum); } +/** + * Update internal serial number variable when the "serial#" env var changes. + * + * Handle all cases, even when flags == H_PROGRAMMATIC or op == env_op_delete. + */ +static int on_serialno(const char *name, const char *value, enum env_op op, + int flags) +{ + g_dnl_set_serialnumber((char *)value); + return 0; +} +U_BOOT_ENV_CALLBACK(serialno, on_serialno); + static int g_dnl_bind(struct usb_composite_dev *cdev) { struct usb_gadget *gadget = cdev->gadget; diff --git a/include/env_callback.h b/include/env_callback.h index 90b95b5e66..5c4a30c2de 100644 --- a/include/env_callback.h +++ b/include/env_callback.h @@ -72,6 +72,7 @@ SILENT_CALLBACK \ SPLASHIMAGE_CALLBACK \ "stdin:console,stdout:console,stderr:console," \ + "serial#:serialno," \ CONFIG_ENV_CALLBACK_LIST_STATIC struct env_clbk_tbl {