From patchwork Mon Jan 25 13:43:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Fan X-Patchwork-Id: 370228 Delivered-To: patch@linaro.org Received: by 2002:a02:a60d:0:0:0:0:0 with SMTP id c13csp3993232jam; Mon, 25 Jan 2021 05:28:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJzFvX+J8ptsnBiBs3yhXGTSNbCGBPZEt1h3vnxOU0MDi43kTgd+lhOFs/jk8NcH/3mfDZqp X-Received: by 2002:a50:b765:: with SMTP id g92mr431758ede.317.1611581288929; Mon, 25 Jan 2021 05:28:08 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1611581288; cv=pass; d=google.com; s=arc-20160816; b=imjOv7gEL0IAIF+xNobHAuHWGuWAh7NXCnTa3qoT6oCWpkZ5s56BjO38iv4yAGpWi3 JwES17/uLBdjwzRGXiKTiH4v5/FjUrdmH0zCVcyV52Dk009j73sgk4ph6ZgHOGjleett a8GQaSSD0ImoBqFp/eCBITL5Kj1WKoMuY1skvGR8KzXJ5AZ1o3Wd98kLh7wL8GUuiUJ3 x4GqXTamTNHkUnF6buatumBEFLWpSGOCh6BPOXpCvNC3ofnJMZiVP3DrF2L7kU7Zrb3J MCzYhwkCVuUCfD4btUGq+2lPoVK3/gUGavU/vRAtumFkZWUN9PV1B+vUPHK3J/Uo+jVM 87sA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:mime-version :content-transfer-encoding:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=nIduXjeQCcprljosLooxvU//WbvK6ngWB/5mjd9lnWY=; b=GXofP+En4GFxKdzguK/GorLhOWH5HEwagAoRKgHnJNQ9YuH7s2KTddr9FsNNoEY2wn uPFQOec2bLiasSbTZdBMsQMJSJYbEY0nDEnlRdcgm072lK1ZKmbaV4gYh54cFqfAyJDx 72QX9U3/vfCxJKoFI1/dw2f9mIQXpZfyFG2uvojidg167e5pZsFBPQaD+AUY7kB9KJrE jU+hJMhVKqoopI6DkqSFH6tn/3tk5i074an903mfxY4YarnlNMi7gZ0OB8VcOwwdEq6n XPbUGs8cBphSp1fIS9YQ+BYqBYgxaXfqcp7jVUzxOZUv3XBWcErCI1pGuaK0b/5izyXG MPow== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=siDbWyjN; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id lz7si3702606ejb.725.2021.01.25.05.28.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Jan 2021 05:28:08 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=siDbWyjN; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 0A1DE8275B; Mon, 25 Jan 2021 14:26:46 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=nxp.com header.i=@nxp.com header.b="siDbWyjN"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 365D882679; Mon, 25 Jan 2021 14:14:55 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=0.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FORGED_SPF_HELO,MSGID_FROM_MTA_HEADER, SPF_HELO_PASS autolearn=no autolearn_force=no version=3.4.2 Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on0629.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe1f::629]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 55A6682686 for ; Mon, 25 Jan 2021 14:14:52 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=peng.fan@nxp.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=G+XwR1U0TBNI+zDyxUGH/6hHEOLI9K1HVXFgFnEVNSifGzRSgw4JLgbpAqJfw4ALLMvvnLcERTta786jdLiFE/6RqWHY0WxciCKCjTZ/5cT8pthmeWShH1kg0AIsQK332Mtj1IQ4FMkdXF0IisDEtKD5SBWTOlyDySfI4WiXSsuPo8xBFk3VbMNqz9/aFlgtzJV8pus4Clg12xDtFYuaFcmCguHzQeWK4Gv3f5/nc6OqqqK4I1TjjTVFSwa2OLa4IC5fDT4L9e/yQWljSrQGYXk3oLmqK1dUQ4FrtFZ0x4WD3V/8J85Ev9bpAIOBzDEa/6/E5/Z2VW029ieO3XodrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nIduXjeQCcprljosLooxvU//WbvK6ngWB/5mjd9lnWY=; b=Ge4XZRqfu5MhYdyEjciTOlP2Bhy4FMluDtrZ9f9qgiOZul2tvKpFg5gWx/4Nwfwqy8qptm5FIG2hE4a9WLvzZ04VsKubzYtPt9mdBROmIvO1eKzLGOXIVudB4ZA9UVkru6OIp9f8H4t0r4cG8bhS0b40e06+KpS9sJvxV5WnY+JoTAyOxWCjTdBitV4a4TIg3IsckSH3FQTe6mLlKvp+tn6awGYV/L3W6HE2Tm0cun5DqYsrOUsSGZXjfhPgOTbmUrHOZ+Ma7Oq3DU654OpZaY2nVtOuzLx9bScqxSFcDS9GQ50Al6s0ANga2xeGznJkYkiUNHZrJh43UK183PrQhw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nIduXjeQCcprljosLooxvU//WbvK6ngWB/5mjd9lnWY=; b=siDbWyjNB5Hwgmv4PDOZ5lyKyUztSrCxu/WUrDTrEdQLMaMQ3qsJGtfShBa1fu5w7p/Vy5g+Cld+dAK5/sVLJM73qX85BP99Rgx4sQIDN1vIb9qqLI4Km9vF2NeRFHebYKpooROjzc3gnEiFIhXvY+DsL1dV6Be5tMsRK/0zJho= Authentication-Results: denx.de; dkim=none (message not signed) header.d=none;denx.de; dmarc=none action=none header.from=nxp.com; Received: from DB6PR0402MB2760.eurprd04.prod.outlook.com (2603:10a6:4:a1::14) by DB6PR04MB3128.eurprd04.prod.outlook.com (2603:10a6:6:10::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.13; Mon, 25 Jan 2021 13:14:51 +0000 Received: from DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::d58c:d479:d094:43d0]) by DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::d58c:d479:d094:43d0%9]) with mapi id 15.20.3784.019; Mon, 25 Jan 2021 13:14:51 +0000 From: peng.fan@nxp.com To: sbabic@denx.de, lukma@denx.de, marex@denx.de Cc: uboot-imx@nxp.com, u-boot@lists.denx.de, Li Jun , Peng Fan Subject: [PATCH V2 07/17] usb: gadget: add WCID support for mfgtool Date: Mon, 25 Jan 2021 21:43:50 +0800 Message-Id: <20210125134400.780-8-peng.fan@nxp.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20210125134400.780-1-peng.fan@nxp.com> References: <20210125134400.780-1-peng.fan@nxp.com> X-Originating-IP: [119.31.174.71] X-ClientProxiedBy: SG2PR03CA0117.apcprd03.prod.outlook.com (2603:1096:4:91::21) To DB6PR0402MB2760.eurprd04.prod.outlook.com (2603:10a6:4:a1::14) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from linux-1xn6.ap.freescale.net (119.31.174.71) by SG2PR03CA0117.apcprd03.prod.outlook.com (2603:1096:4:91::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3805.6 via Frontend Transport; Mon, 25 Jan 2021 13:14:48 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 50f169e1-2f85-428c-3719-08d8c13332a3 X-MS-TrafficTypeDiagnostic: DB6PR04MB3128: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3173; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PYodykMqF5pPoHtFP/P63DuCyZiz8hLKUVWuBQV2ZYwspty9dc3cHwCBkbxzy0EDtVr9zpdoodhsdRC1JB1d5oTTYeXsObWEJ+LblFhtHAaN+LlLHIymaxw3ewZluDxUAMqFv4XgWirRjw4jgthotN4QqeiSi7pdkBTExEeRQuDRYKAtvLRpnLLhEA7JL83LBJBHQUrTJpLbUnAOMzcR4iiipr+cK9biY6Iby25VNZmQK/kTzGy9D5pibxDC2VRBcLDPWXwiaqyMsu8d1fxiXGsYJXisEj9feF7hrgBK7yeaxcEXPCdQij2JNu7RWQWtuh/1u9c9Zllo7EjaXn8X6pgKhVmF6JKMFd8zmTvDeT/qDHasTzRTHA6Gz7iwAYbf/ITIda68EhkOAobVg+0wCg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB6PR0402MB2760.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(346002)(136003)(39860400002)(376002)(366004)(396003)(6506007)(1076003)(26005)(316002)(6512007)(45080400002)(186003)(4326008)(54906003)(478600001)(8936002)(8676002)(86362001)(6486002)(2906002)(36756003)(6666004)(5660300002)(9686003)(66556008)(2616005)(66476007)(16526019)(956004)(66946007)(52116002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: O2dVWpivPAuxBRZrh8FgI3lFQJLYGg3P/3zP+d9451eRKwMyEx+XMnCF5RpdmSgHDvkFEtJIFlssckK/fr9JBYIbs7ufAGIii54JvzCCbESM7YV8mePfuC9a6HY3uf3RPExTZYywUfmtU4HU0gCSd4JmHK4h7vPXoe54ZA42dMEe1m89ah1kQnXyupkGOyA24Pz2joreaeUDsHnHLFDQXoJmraS7xFSeHa4kmpGGizxKIoEx4FA6QY9EH0Bhljtu19md1y4uGpPmAeuHQDH+EK5gmkoctcVV6ENB/B5F3oWrEQXCTXgFAewY6zPoDMetrwAJfhcnRw7eOo/efIGDCVoOV6CnAApi3LT2+Ql+Yrudi85y6Z0EVrSAUNQQccybCPoIxt4vJlKRwVIXa440tavqb//tVKSebtoLOUgVwcVIUqh9M8vO/lie5w1xgNWmfpJyzQNMd4MNn8s++cCfG3HSyuhT0mXIguHDW7eRr+Z4r14RxdLSCvyi8B8a+dA2ekBTHrbIvlOUzpCL0brcu20LLpxpuJuH0W8ioAG+pMiHNJ7uBmyys8OvpZ8LtRPRIFDHIp8XbMkVSVcwgPxM7ZNtubWbjk0pJxhi7ttWkdcJuJwlbeHu/Dp6v/GhPzQGeaJaFcHpQMIZ/OtGY/8Q/WaT9EuFwzmJ0CYjEbIUQ9Vs8MPKA62PvmktxOHD0O3AZZ2VAHR4z4hRbdkSIxKTSjdIaHVa60wtPUYmxsmYtiFrar3biyXLforEQnmJ0/t2bCpzpGMrziRcc3rGcI8nfl0YUtT8Aijw8bfooIy0m6Obuo7nVTEa49oj6lt1rmEL4Id9Jz1L28rMGrG4A3epfm/UEzVl6lrLoObtOU2xUj5n3OpRNS0+HJ7Wt0t9PjUt57gVGz0z3f6jwZ8i69qTW2HQKXkQL8/08W5VpPcpmavja029x0mhyBc+dZBAB/N5aWYeI7ezVmklGnZnibDnA66Ld2TiOOXz5rSQcY4/WXRmoc3ONmebkyslayCsxyV3 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 50f169e1-2f85-428c-3719-08d8c13332a3 X-MS-Exchange-CrossTenant-AuthSource: DB6PR0402MB2760.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jan 2021 13:14:51.2364 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: OwT1T43QsUTYikkiHNx4BYQ5FU9AjTaXuHmCCu5kNvQTQarff1SbY5n4Hv8Heb4OhBGKyPXEVdMMJKq/bpGE7g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR04MB3128 X-Mailman-Approved-At: Mon, 25 Jan 2021 14:26:22 +0100 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean From: Li Jun Enable WCID(Microsoft Compatible ID Feature Descriptor) for mfgtool. Signed-off-by: Li Jun Signed-off-by: Peng Fan --- drivers/usb/gadget/composite.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) -- 2.28.0 diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c index a0c28dbe59..cd61bfec38 100644 --- a/drivers/usb/gadget/composite.c +++ b/drivers/usb/gadget/composite.c @@ -20,6 +20,10 @@ typedef struct { __le16 val; } __packed __le16_packed; static struct usb_composite_driver *composite; +static struct usb_configuration *os_desc_config; + +/* Microsoft OS String Descriptor */ +static char qw_sign_buf[OS_STRING_QW_SIGN_LEN / 2] = {'M', 'S', 'F', 'T', '1', '0', '0'}; static inline void le16_add_cpu_packed(__le16_packed *var, u16 val) { @@ -395,6 +399,10 @@ static int set_config(struct usb_composite_dev *cdev, goto done; cdev->config = c; + if (cdev->use_os_string) { + cdev->os_desc_config = c; + os_desc_config = c; + } /* Initialize all interfaces by setting them to altsetting zero. */ for (tmp = 0; tmp < MAX_CONFIG_INTERFACES; tmp++) { @@ -1358,6 +1366,18 @@ static int composite_bind(struct usb_gadget *gadget) sizeof(struct usb_device_descriptor)); cdev->desc.bMaxPacketSize0 = gadget->ep0->maxpacket; + if (cdev->use_os_string) { + /* TODO: Do we want to pass this via platform? */ + cdev->b_vendor_code = 0x40; + + /* Microsoft OS String Descriptor */ + utf8_to_utf16le(qw_sign_buf, (__le16 *)cdev->qw_sign, + OS_STRING_QW_SIGN_LEN / 2); + + if (os_desc_config) + cdev->os_desc_config = os_desc_config; + } + debug("%s: ready\n", composite->name); return 0;