From patchwork Sat Aug 23 19:53:04 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Rae X-Patchwork-Id: 35875 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ie0-f199.google.com (mail-ie0-f199.google.com [209.85.223.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 46C462057E for ; Sat, 23 Aug 2014 19:54:21 +0000 (UTC) Received: by mail-ie0-f199.google.com with SMTP id tr6sf31973562ieb.2 for ; Sat, 23 Aug 2014 12:54:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:mime-version:cc:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :sender:errors-to:x-original-sender :x-original-authentication-results:mailing-list:content-type :content-transfer-encoding; bh=wg/dtNc8iA//Yj+v7vPSOSoKCiuEcUfZlQRW12ld1dw=; b=QFDNDihl0+JiX5Uj0NdHSR+Rc8U5EBB8oDlmjwQJ2bXRfc2H+BMVEoXFMylVg2SDZw cmdVAatHUbX5OCF0rtpOMJo0lNPvZ7avuYDI/TLmf2kovInkqClBUC+SJtiwkMyurFoT wR7cvIND1cAd4EYiyJxlyIvOZ8Z5sjWDHAwTxhs+bfWz99eXj3NI2Pnt+nBSHU5Qfhzw Z8QWcoTMkeB3G7+nEsaAdXR2Z+Szmn8kxkIeHU52rN/9DhZ+9b3rWAPzI9CYUxgzi7y1 AULdpQnDAOA77h3PmSXnCf/ns1Ukrc1pMtSrxWkwFm/iZ3HCCuyJTRuSMm2oW+h5Rvd6 G4CQ== X-Gm-Message-State: ALoCoQmnRlUSeRUG1QE3KeODuMeYEnPuAZOv5kNH5dhblsDl46Zwy4KBjT0xv6MPBKIqcJaqK7rK X-Received: by 10.182.4.73 with SMTP id i9mr8310284obi.28.1408823660553; Sat, 23 Aug 2014 12:54:20 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.98.212 with SMTP id o78ls1561486qge.55.gmail; Sat, 23 Aug 2014 12:54:20 -0700 (PDT) X-Received: by 10.52.52.136 with SMTP id t8mr8167049vdo.21.1408823660434; Sat, 23 Aug 2014 12:54:20 -0700 (PDT) Received: from mail-vc0-f176.google.com (mail-vc0-f176.google.com [209.85.220.176]) by mx.google.com with ESMTPS id xk3si11234311vdb.7.2014.08.23.12.54.20 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 23 Aug 2014 12:54:20 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.176 as permitted sender) client-ip=209.85.220.176; Received: by mail-vc0-f176.google.com with SMTP id id10so13524430vcb.21 for ; Sat, 23 Aug 2014 12:54:20 -0700 (PDT) X-Received: by 10.52.156.100 with SMTP id wd4mr759091vdb.39.1408823660327; Sat, 23 Aug 2014 12:54:20 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.45.67 with SMTP id uj3csp8611vcb; Sat, 23 Aug 2014 12:54:19 -0700 (PDT) X-Received: by 10.180.93.104 with SMTP id ct8mr5509433wib.30.1408823659294; Sat, 23 Aug 2014 12:54:19 -0700 (PDT) Received: from theia.denx.de (theia.denx.de. [85.214.87.163]) by mx.google.com with ESMTP id gr9si49047774wjc.150.2014.08.23.12.54.18 for ; Sat, 23 Aug 2014 12:54:19 -0700 (PDT) Received-SPF: none (google.com: u-boot-bounces@lists.denx.de does not designate permitted sender hosts) client-ip=85.214.87.163; Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 790104B58F; Sat, 23 Aug 2014 21:54:18 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 3pM3LEorflQL; Sat, 23 Aug 2014 21:54:18 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 1012C4A051; Sat, 23 Aug 2014 21:54:16 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C09304A04A for ; Sat, 23 Aug 2014 21:54:11 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7kpW2FKRCTPI for ; Sat, 23 Aug 2014 21:54:08 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-gw1-out.broadcom.com (mail-gw1-out.broadcom.com [216.31.210.62]) by theia.denx.de (Postfix) with ESMTP id 3A2D14A027 for ; Sat, 23 Aug 2014 21:54:04 +0200 (CEST) X-IronPort-AV: E=Sophos;i="5.04,387,1406617200"; d="scan'208";a="43686045" Received: from irvexchcas07.broadcom.com (HELO IRVEXCHCAS07.corp.ad.broadcom.com) ([10.9.208.55]) by mail-gw1-out.broadcom.com with ESMTP; 23 Aug 2014 13:46:17 -0700 Received: from IRVEXCHSMTP3.corp.ad.broadcom.com (10.9.207.53) by IRVEXCHCAS07.corp.ad.broadcom.com (10.9.208.55) with Microsoft SMTP Server (TLS) id 14.3.174.1; Sat, 23 Aug 2014 12:54:02 -0700 Received: from mail-irva-13.broadcom.com (10.10.10.20) by IRVEXCHSMTP3.corp.ad.broadcom.com (10.9.207.53) with Microsoft SMTP Server id 14.3.174.1; Sat, 23 Aug 2014 12:54:03 -0700 Received: from mail.broadcom.com (lbrmn-vmlnx03.ric.broadcom.com [10.136.4.105]) by mail-irva-13.broadcom.com (Postfix) with ESMTP id 533EA9F9FB; Sat, 23 Aug 2014 12:54:02 -0700 (PDT) From: Steve Rae To: , Tom Rini , Marek Vasut Date: Sat, 23 Aug 2014 12:53:04 -0700 Message-ID: <1408823626-12744-4-git-send-email-srae@broadcom.com> X-Mailer: git-send-email 1.8.5 In-Reply-To: <1408823626-12744-1-git-send-email-srae@broadcom.com> References: <1408823626-12744-1-git-send-email-srae@broadcom.com> MIME-Version: 1.0 Cc: Steve Rae , Rob Herring , Pantelis Antoniou , Jeroen Hofstee Subject: [U-Boot] [PATCH v5 3/4] usb/gadget: fastboot: minor cleanup X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: srae@broadcom.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.176 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 - update static function - additional debugging statements - update "fastboot command" information - add missing include file - update spelling Signed-off-by: Steve Rae --- Changes in v5: None Changes in v4: - update debug string as per feedback Changes in v3: None Changes in v2: - new in v2 common/cmd_fastboot.c | 7 ++++--- drivers/usb/gadget/f_fastboot.c | 13 +++++++++---- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/common/cmd_fastboot.c b/common/cmd_fastboot.c index 83fa7bd..909616d 100644 --- a/common/cmd_fastboot.c +++ b/common/cmd_fastboot.c @@ -30,7 +30,8 @@ static int do_fastboot(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]) } U_BOOT_CMD( - fastboot, 1, 1, do_fastboot, - "fastboot - enter USB Fastboot protocol", - "" + fastboot, 1, 0, do_fastboot, + "use USB Fastboot protocol", + "\n" + " - run as a fastboot usb device" ); diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c index e2659fa..3b588a9 100644 --- a/drivers/usb/gadget/f_fastboot.c +++ b/drivers/usb/gadget/f_fastboot.c @@ -10,6 +10,7 @@ * * SPDX-License-Identifier: GPL-2.0+ */ +#include #include #include #include @@ -41,7 +42,7 @@ struct f_fastboot { struct usb_function usb_function; - /* IN/OUT EP's and correspoinding requests */ + /* IN/OUT EP's and corresponding requests */ struct usb_ep *in_ep, *out_ep; struct usb_request *in_req, *out_req; }; @@ -293,7 +294,7 @@ static int fastboot_add(struct usb_configuration *c) } DECLARE_GADGET_BIND_CALLBACK(usb_dnl_fastboot, fastboot_add); -int fastboot_tx_write(const char *buffer, unsigned int buffer_size) +static int fastboot_tx_write(const char *buffer, unsigned int buffer_size) { struct usb_request *in_req = fastboot_func->in_req; int ret; @@ -341,6 +342,7 @@ static void cb_getvar(struct usb_ep *ep, struct usb_request *req) strsep(&cmd, ":"); if (!cmd) { + printf("%s: missing variable\n", __func__); fastboot_tx_write_str("FAILmissing var"); return; } @@ -361,6 +363,7 @@ static void cb_getvar(struct usb_ep *ep, struct usb_request *req) else strcpy(response, "FAILValue not set"); } else { + printf("%s: unknown variable: %s\n", __func__, cmd); strcpy(response, "FAILVariable not implemented"); } fastboot_tx_write_str(response); @@ -534,10 +537,12 @@ static void rx_handler_command(struct usb_ep *ep, struct usb_request *req) } } - if (!func_cb) + if (!func_cb) { + printf("%s: unknown command: %s\n", __func__, cmdbuf); fastboot_tx_write_str("FAILunknown command"); - else + } else { func_cb(ep, req); + } if (req->status == 0) { *cmdbuf = '\0';