From patchwork Mon Jan 25 13:43:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Fan X-Patchwork-Id: 370229 Delivered-To: patch@linaro.org Received: by 2002:a02:a60d:0:0:0:0:0 with SMTP id c13csp3993419jam; Mon, 25 Jan 2021 05:28:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJwDMUpSiiZLzIN51wwgoqCJd9wKKm6cbPl88MqpVChdhGbmOrqai0Jd9P8D36zSCNs+9BQO X-Received: by 2002:a17:906:7d4f:: with SMTP id l15mr352219ejp.95.1611581299288; Mon, 25 Jan 2021 05:28:19 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1611581299; cv=pass; d=google.com; s=arc-20160816; b=lLuqdZYCk7nbnZDXM8g/gjQ5HVekOeW1faPqwQgHO2orYanBplvuCcgh5b/XYWD3Xc IVX9tYN2o7W1RKz2OLaUX8LiO2ChaYnqQvB4cL0sX3MFhnow8vnLfsci9Ur/+WwIaf81 PJrNLAZyuO5H9yEi7s7qE2flN016TsNLzdNjmQh4eP1mRP3PPgeSiUZ4+3OqFdqoSNuO 7oVcZn1fs07L+/xy78KXMAab3l9pO2zIxoDxt9c5i0U8BM10U7DYBJAPgA1JmJD+fQ7E HjIaxnGTEPwc2cXo+52L89pyz3bJx7QtoH7Rdmr1VSSJ8Ly2LYNsSihPtZWnKKU0Qzmq 0Oaw== 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=+d8I6b9Kghhf3W4GEzwMoOCrGrrnmBa/R8W3GkgHLbA=; b=z9Va99HxMYs3BAPRc1AewWOaMvfEC/1qJsVU+QM+Xy997jMEeFRTpDrvO7/87twMLI B5I7NVmD25nBwPUiqydFpRVcz5Zyg+V9JXsMP6aaSFoUWEF791B7Rf4uUgsEJORHCXq/ ZqCCYQtYGJwz8WXRUFgkaxqyLT9ZieJ7GM2UTpUjOn4Ax3w6QuYZrAaIbVr4oqXT+NwH ECosVfdtQOpaK2q37wPmIqeDLckX6l8ssf+dB3TNTME0rdm1WAzbCGoWw7tEpPYlo0Xr 3eMB/NrLq20NNaw7hJRdiiXxeIPHg/GryvS1GBBTygRpHXWSfOYwDFKqYPFpIBHiuPyd dj5g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=ocb7ApTk; 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 85.214.62.61 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. [85.214.62.61]) by mx.google.com with ESMTPS id d92si7512602edd.33.2021.01.25.05.28.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Jan 2021 05:28:19 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=ocb7ApTk; 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 85.214.62.61 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 E4FDB82721; Mon, 25 Jan 2021 14:26:48 +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="ocb7ApTk"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B54FD8267A; Mon, 25 Jan 2021 14:15:00 +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.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FORGED_SPF_HELO,MSGID_FROM_MTA_HEADER, RCVD_IN_DNSWL_LOW,SPF_HELO_PASS autolearn=no autolearn_force=no version=3.4.2 Received: from EUR03-DB5-obe.outbound.protection.outlook.com (mail-db5eur03on0623.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe0a::623]) (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 D0420826B1 for ; Mon, 25 Jan 2021 14:14:57 +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=Jo+7tFc51lTDLcUKyGzgYiB7xQzYjrNEHrQFlvhUdWjNBBdu6EOdxmPtiDzbitx0Wneaq0YSP4KvHRB/N5rczhgjIYZNAvOKfG5JAa+SJ8/dOc4riyFKg511akcPDNVJVJ+mhS3FFkPPVHy4cia8lfvlE5WnHHO25HUeG2GS5VaKVkH2YoO8jWtOoAe+yN+Jux7QFIGd3XTNxWomlkx8O5/CWjev+mg+iCTC5LfF1l0ELoWNkfhAiFgvPPn7xNsVLEwgB829NN8nVb3k+YvQ1GZLosxH1lA1witIa56zU/Kb8EB7qfHqwvnwHuLs9XC+WsLAhctzmXlpl0sgfY3jag== 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=+d8I6b9Kghhf3W4GEzwMoOCrGrrnmBa/R8W3GkgHLbA=; b=B0JvmS+7uQxGl/mLuxnGIlAv1JFuWULOM7yMlzT0MvaLZuqYUJjd0nZSQSY3o0sztcFIZMSlf5YpEMubKzv20ugVBovBrj/8/wAB8LoXmwfLsR30mrClmF/ew/UhZwquZS5xWOly9iYtl05sxEzF8mipPkBtQx87OfpJPa0rWc3+zGtEZ6n7wPz1G7QKwpuRdQEjyboSpG53PvT0Nce5HBv/xDSIITMRz+JgbqhMNNUqqMvPF/i0IgFJ0M5e76CPx2jKruQEk390AkpVVtCHOQ8zu5aGJBNLP31RyMu2drGIKNI4Dj1ixa/hGpDZbwpDbOc4rieD2PIWiba2J635Yg== 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=+d8I6b9Kghhf3W4GEzwMoOCrGrrnmBa/R8W3GkgHLbA=; b=ocb7ApTkPyYCA1COfI9eViD4U1bS6cxAZSYmKWmyXZI+xr0wyU06PWBHGTXFdOOa5p1M4vLHS5dEX4pXEt87JezfONo42SGHVnNHcig9piFBVMZC+dEcKwKS+byAWGlFYPdZR9iUvOHFvNFex1sEjAcUUSVQFSi0aBpb9Ews7co= 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:54 +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:54 +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 08/17] usb: gadget: fastboot: add ext properties for WCID Date: Mon, 25 Jan 2021 21:43:51 +0800 Message-Id: <20210125134400.780-9-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:51 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: b6e92547-f728-4891-3a42-08d8c1333476 X-MS-TrafficTypeDiagnostic: DB6PR04MB3128: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:330; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2OHGPgzO4qOQjYDf8lt54zA9jGwzIvkFguFRR9y/yeeslFJEMWZTIDcmbXfFKNUK3osirJANVqf6WNDN8UkDw1HVdwj6Rze5v57GferIKelsC/7JSogJ8aAaiMELLA8V7H9qDJYRU4/LpzQBPIePt2nJLOMbhtvyUFQUGsyBgng6Rt0J7kvv2yvavSdOzfMYi4SahClZTiS2H66M6rBorTU1+u5xWvTdgpM71N+NkLrIqPfxE4Gbn5sOPYJeUmUcbP1WDpsDIWHbPp+CZBYP3cjRwntGSVOTX5Xgk1hArbVf2Xw6sqT2hZjtUUC3c96b/AUAM7H9HfXtE9CRTRmhOWfCKoG53l+m6kRFrIVAyGoIEnSC5MbLzXN0jkvgxbb4mKYuDKpYCrxCHwy/lj0KKQ== 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)(83380400001)(478600001)(8936002)(8676002)(86362001)(6486002)(2906002)(36756003)(5660300002)(9686003)(66556008)(2616005)(66476007)(16526019)(956004)(66946007)(52116002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: UDDBVUP3e7IouW2n2+XAaJ2w6O86zzlFQUjeALUXSHFF8IaTioP3mBuM8etBV3GTMCh5g5L1S0IAJnB9pzE8ROBec7QEUdvV8bKbRAopp96VFCuuGUjkhN43GWmdyxS6iypECn1aQ21N6/DafVpkufvRk8U6I9SCIyAJDi7i8ftP0OJg5W710/L7Y9tfO56u0Nyd3jgrc7GgVoQL3gdy143VZFL2Of1UHbHV9ZGAgkPZX8iGmNAvj45uaMjYsW7eWTr3qbGDwpkwxwl2e9H5DG0uNy3p0I0jPqPZETZNF20ZYcKpNsW/x4mcw0QaO6Wn1d9tgHSe8Z42g+nRO1/5IPL281z7ppSw1Hkx+Stamd2bI3Byu/exqp9wlhxZslZERGsFisqH3GGwbGb5OE5GMh9QJl+LwlIWo88CD9mBuJnUczY8iTZS/xPxCtzNGeeiB98MbKniIkLScPVQ4FlVx6olZPsmwQkrt3cFAvhuzJLTbN8IKpgrCA8RVV3Cui2dAMH/uorb3eqcecyz2bGwZi8aL0mYFDVfqy/ZGKAJ4X89l7MhS1+WO1LmwraxGdEFBM4SKwevLojVKmiu1NH6ZiH3Ilba27gC4UIschzI/H1BsOkcRaim+ECNa8aUeSZQZEffXKz7/rC/ElbDz2RLYvMk+jHfPW08EgIj1WCCnuk0zqDsS6u887tQsO4KHwHx+s//wYDhQH7zbsJxFH53dK8mPNRxdvWJiFUeIDKYjRdf0SrdhnmBXNKye1XhcSb7Z4FyOZcRS8LUsBSfiznDxTy87FADPRpD8ky6U2+PgL8qgbXe4sYyCRdMjRBPwVPJkVKBcGmg3XG6NCnPaJNfSgJzDuWmCqhwrwLxR0Nu+br3/y0VXAweLap35NMh08QMjw7gD2uhUySghH7tsZBIDbU1oL/zq8jZGqC003/yS8j8RKC2sqsUUPkK8dO7xjxu4gupo9SFQpiOnCMwwHaajhIciqh0DUA2ttqYEbVxPieZbdz5ctzTaONvQDvgr/3Z X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b6e92547-f728-4891-3a42-08d8c1333476 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:54.6608 (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: n+8Y0kMFvzMMPwJytF9Bng/w2Vg2VvDtDm2/3lYcb1RMraZwPQd4rml0minM+7pW8mmMYbfgTf1kE25avQWkBQ== 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 Add device interface GUID for Microsoft Extended Properties Feature Descriptor. Signed-off-by: Li Jun Signed-off-by: Peng Fan --- drivers/usb/gadget/f_fastboot.c | 34 +++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) -- 2.28.0 diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c index d1d087e12b..e330456390 100644 --- a/drivers/usb/gadget/f_fastboot.c +++ b/drivers/usb/gadget/f_fastboot.c @@ -46,6 +46,25 @@ struct f_fastboot { struct usb_request *in_req, *out_req; }; +static char fb_ext_prop_name[] = "DeviceInterfaceGUID"; +static char fb_ext_prop_data[] = "{4866319A-F4D6-4374-93B9-DC2DEB361BA9}"; + +static struct usb_os_desc_ext_prop fb_ext_prop = { + .type = 1, /* NUL-terminated Unicode String (REG_SZ) */ + .name = fb_ext_prop_name, + .data = fb_ext_prop_data, +}; + +/* 16 bytes of "Compatible ID" and "Subcompatible ID" */ +static char fb_cid[16] = {'W', 'I', 'N', 'U', 'S', 'B'}; +static struct usb_os_desc fb_os_desc = { + .ext_compat_id = fb_cid, +}; + +static struct usb_os_desc_table fb_os_desc_table = { + .os_desc = &fb_os_desc, +}; + static inline struct f_fastboot *func_to_fastboot(struct usb_function *f) { return container_of(f, struct f_fastboot, usb_function); @@ -161,6 +180,19 @@ static int fastboot_bind(struct usb_configuration *c, struct usb_function *f) return id; interface_desc.bInterfaceNumber = id; + /* Enable OS and Extended Properties Feature Descriptor */ + c->cdev->use_os_string = 1; + f->os_desc_table = &fb_os_desc_table; + f->os_desc_n = 1; + f->os_desc_table->if_id = id; + INIT_LIST_HEAD(&fb_os_desc.ext_prop); + fb_ext_prop.name_len = strlen(fb_ext_prop.name) * 2 + 2; + fb_os_desc.ext_prop_len = 10 + fb_ext_prop.name_len; + fb_os_desc.ext_prop_count = 1; + fb_ext_prop.data_len = strlen(fb_ext_prop.data) * 2 + 2; + fb_os_desc.ext_prop_len += fb_ext_prop.data_len + 4; + list_add_tail(&fb_ext_prop.entry, &fb_os_desc.ext_prop); + id = usb_string_id(c->cdev); if (id < 0) return id; @@ -196,6 +228,8 @@ static int fastboot_bind(struct usb_configuration *c, struct usb_function *f) static void fastboot_unbind(struct usb_configuration *c, struct usb_function *f) { + f->os_desc_table = NULL; + list_del(&fb_os_desc.ext_prop); memset(fastboot_func, 0, sizeof(*fastboot_func)); }