From patchwork Thu Aug 31 18:20:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 111441 Delivered-To: patch@linaro.org Received: by 10.140.95.112 with SMTP id h103csp2951310qge; Thu, 31 Aug 2017 11:20:15 -0700 (PDT) X-Received: by 10.80.241.27 with SMTP id w27mr2044290edl.223.1504203615194; Thu, 31 Aug 2017 11:20:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504203615; cv=none; d=google.com; s=arc-20160816; b=CswtdjcBHDax5YM7+yPkw0G6k0hmsNKgn/BeqVl/08jE3BLS2cHFrLQVmjabYEKUgX FWdr/+WRhEaPOrw+/13eV9d+H7V4AWWrWjn6oD+EdBfNi72nKm0KVKQYi71UtstEt4Pp jwWN/501xAZMQBEOzFpKZyJcPUQFfvb1DtcTExbtN+tapujDoNfppfL+DbCntlJqh5eN VifBXC2LSCH9IjZeNhZre2aGqtKJEwkrSDiK65V64B843vuo5qR/C9CerQVjA3J4OvyS a8h60Ty7ODrKAqHQvFND+obSg3qHjjVYDj3QcTxFzbiJC5nLBjK2dtk4PAnkHBoq06OA s8Vw== 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=2D/reaCt58QfVhFRohno2PLSZX8vQWKpizzVspQicVg=; b=0T9qDQWt1/zi+U6dMBaOlo2OE6ma/z2kdYuguijpYg9VtrbF2ru0qBdqEQGYJF7+wN CwnSsYjZZRruNpjA6G2YA9uID21qKLXX9filKrrBbij61dk8yd7nfP31EXCmIgbk5RuV Nue2TfBmmpH4QqhHeBUlnE4fIZb2O4LHM/ET1cmtUeSYN1WtEZKZhtqHhs4IX4vuQIpg 4ydCywSCoMup3CpBghDSdnPxX+CWWJvGr3A52Stu04kSBduLkqNasBx5bMdsCT13V33D VeRUl6K4AfZoThHX2fnz7+DExVgE1CcCBigMuhq/ZMzjy8O+zErHrdkBMDD+kjVkpzh4 fAZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=OVftNcSR; 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 x9si671324edk.385.2017.08.31.11.20.14; Thu, 31 Aug 2017 11:20: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=OVftNcSR; 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 713B9C21E29; Thu, 31 Aug 2017 18:20:10 +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 C8A3AC21D7B; Thu, 31 Aug 2017 18:20:08 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 53B94C21D7B; Thu, 31 Aug 2017 18:20:08 +0000 (UTC) Received: from mail-lf0-f47.google.com (mail-lf0-f47.google.com [209.85.215.47]) by lists.denx.de (Postfix) with ESMTPS id E1752C21D63 for ; Thu, 31 Aug 2017 18:20:07 +0000 (UTC) Received: by mail-lf0-f47.google.com with SMTP id z12so1586601lfd.3 for ; Thu, 31 Aug 2017 11:20: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=jTiVoCj/T8KKEKAlVORBAG6Q5f4AeFZ+4iGElPCDYwE=; b=OVftNcSRnMOrVLaJa0CukHxulHn9ujYdg3l534E8lbtgpORNZTk2LjBDgCd1lc1cEl XdleUiO9+yffnyj5uIUlNuNOSXcF5MAEfwb3+IPouH5dELj8vRHkS5CToOhhvmPe0ojO 7cv9KfyL+Vda1EzLepuI0wq6Ui1e5BK09XoSA= 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=jTiVoCj/T8KKEKAlVORBAG6Q5f4AeFZ+4iGElPCDYwE=; b=ExYwwJy56d4HEBmlZ+Ylb9MUzwMrbm3f0H5kULmPWM73N3c5QGGSXik6iA7cZqXlMw UpK5CodiyREpd+K65qvh+uZ4X0rIKzVVQbLm6ZwWK9weWizoUjvl/mGV/6BlxCV4t5Ek KsSii75o3WxX/vBCrsAi0xOW0Xm95+zeG+eXJuakKVeTOsS8TNq2wNI23W/Lk+6IXTek RsosO4ojjqYk1KsYnRowUBKI55W2K8Kc1lBq2zXtMp/g4BR6d+UrpsFzG5p6PcgElUbc D+sH5O0DWYIOKNGdABrUBXqQ8e/8dOwFrpoWNj8N15UvwIXe80wemxaVpb6QDGYqfXg2 kWiA== X-Gm-Message-State: AHYfb5igVGaA1rsNLGyNFxRZGi4xqz/n7ZNXcf2oqffVsy+AjeDJ3eFV GG/45LPBOxZ3P5iW7ZcgtQ== X-Google-Smtp-Source: ADKCNb5LQEkGKHYEM53IZwd6PDsKTJCbSPz0G46I+sJLngJwWAIwb9Bw658pQlmDnPU2Sjb3/2BDXQ== X-Received: by 10.46.7.67 with SMTP id i3mr2598034ljd.110.1504203607038; Thu, 31 Aug 2017 11:20:07 -0700 (PDT) Received: from localhost ([195.238.92.132]) by smtp.gmail.com with ESMTPSA id k184sm76198lfg.51.2017.08.31.11.20.05 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 31 Aug 2017 11:20:05 -0700 (PDT) From: Sam Protsenko To: u-boot@lists.denx.de Date: Thu, 31 Aug 2017 21:20:04 +0300 Message-Id: <20170831182004.24946-1-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.14.1 Cc: Marek Vasut , Tom Rini , Praneeth Bajjuri Subject: [U-Boot] [PATCH 1/1] usb: gadget: g_dnl: Use serial# variable to set g_dnl_serial 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 842778a09104 commit, "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, before checking g_dnl_serial, let's re-check if we have valid serial# value. And if so, let's set it as g_dnl_serial value. Signed-off-by: Sam Protsenko --- drivers/usb/gadget/g_dnl.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/usb/gadget/g_dnl.c b/drivers/usb/gadget/g_dnl.c index 0491a0eea9..e4d0289757 100644 --- a/drivers/usb/gadget/g_dnl.c +++ b/drivers/usb/gadget/g_dnl.c @@ -226,6 +226,15 @@ static int g_dnl_bind(struct usb_composite_dev *cdev) g_dnl_bind_fixup(&device_desc, cdev->driver->name); + /* First try to obtain serial number from serial# variable */ + if (strlen(g_dnl_serial) == 0) { + const char *s; + + s = env_get("serial#"); + if (s) + g_dnl_set_serialnumber((char *)s); + } + if (strlen(g_dnl_serial)) { id = usb_string_id(cdev); if (id < 0)