Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp2560846iog; Sun, 26 Jun 2022 20:11:02 -0700 (PDT) X-Google-Smtp-Source: AGRyM1v6iQ5Hloh5fZ8zBKiWsQEwlz1W1jNqvfIfGOvAdcTw1Z87IjxGpcc3RNwcue3sObK5OBWB X-Received: by 2002:a17:906:4482:b0:70a:19e3:d18a with SMTP id y2-20020a170906448200b0070a19e3d18amr10774852ejo.510.1656299462338; Sun, 26 Jun 2022 20:11:02 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1656299462; cv=pass; d=google.com; s=arc-20160816; b=wI5qZ9Ghz/VVkBSiqT3cPOo9jvppqe5QF2+8MJtlF24AgqTiJp8A3E7MJb8v1nF1de Eh1kE9jJiLYjLjrBFdztYnC09MsR4/LLnWAS7N9nMBrawku74cmnpK0uJt3GgxJBSfUn e9J04N80yk6S3t2o+xsCErTyG1+ZtEYSWXyiLZkEGyFipcbceSqDVPOAvfN/MjQQoWor Zd/AFados0rWF06demnWTbHePqGSlBpr9Fev1/Y1EAYX0pDZUNeNzu8rXIQ713YUWkOo ZCF68sirzuJS4eUd7MFrfjpabrzdGyCtRXky/UscF/oYZeopuJ07/tgt17QbMHqStLaW 7uVA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from:dkim-signature; bh=WQ49xSlZIJPTccrfMzZGzPdatXmrn9asRWER3HG+LzQ=; b=h6YN4NHMjyJHSZOJIMYE/0fyGOnsO98OggUQkonnL3X/lu+vPk527fURmiOqrT1Url fbEIhzw9fZ4Tyu19jE2pyHgQ+6hf9tNYS/1Pr1PUhnty+Iap7qdqMuVMdVdEBTO/pIm+ R3rGKlpWTzGaazt+3E95rQ4mEW2hiYeMx7FzCy6aCvtvY2VhG2xD5dkxUawInZSE8dJc +sqNdOVow6+mC2I1QTnzGUKBETR/OAdyUD40gAI57KrkGdLX3+qgZ8ROImmJgSF5vLqf Oj2xQjAp+b3G8WKGi8KQSJUO7RAuga33ETL3krp6uzAbjbqBMa+SIm5zDMrF0xI/l5GZ xIgQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@aspeedtech.com header.s=selector1 header.b=Ju9Cb1pV; arc=pass (i=1 spf=pass spfdomain=aspeedtech.com dkim=pass dkdomain=aspeedtech.com dmarc=pass fromdomain=aspeedtech.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hu8-20020a170907a08800b007235c2843b2si11811900ejc.122.2022.06.26.20.10.30; Sun, 26 Jun 2022 20:11:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@aspeedtech.com header.s=selector1 header.b=Ju9Cb1pV; arc=pass (i=1 spf=pass spfdomain=aspeedtech.com dkim=pass dkdomain=aspeedtech.com dmarc=pass fromdomain=aspeedtech.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232387AbiF0C5L (ORCPT + 99 others); Sun, 26 Jun 2022 22:57:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33330 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232342AbiF0C4w (ORCPT ); Sun, 26 Jun 2022 22:56:52 -0400 Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2129.outbound.protection.outlook.com [40.107.255.129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F4D73897; Sun, 26 Jun 2022 19:56:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=b4ytobRh4J6suXwFoWR1SaMCElYQY3QLflafBErBI/Ek7LdyFo8HKNUoeAnHb1pnYLNvhpCtakzJDUT/QkGbN5nj8auvFsY3BndSKKGdfk8F3/zzdcUf12xQse63uLzBHesY44Al5k02QutLgI8xNZvwYqTO+WeplFvlywcmr5BiVB5mNheIhYhu4SagTrrLym/Ug0BNEHW1ChBnMQ6cD6x2l+ZhiLKKXGgPjB5XnXP2W+a+ddMlXVsv/+FF2Hpef/zWchGfzjegpX8XwNRMzKPSp/YJ1Hc4FMOTn09BYjlSGIzvuL24qbaSM/fnBajeUFj4xZ91ocQD2zIesHI4OQ== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=WQ49xSlZIJPTccrfMzZGzPdatXmrn9asRWER3HG+LzQ=; b=D/qwyUF8aWZX9i8z9JOc6BooljaBe+qkSsvNoogEvP1tC4DqQFn92EdnT6jhcTCOSB2bDjdsgCX789HTdYHIXN8u6vxVlzGhggoCkgqR6YyG7lXu0u0L9GCOMyT9Z1+Pb3gP5tVXI6cyu4jDI+s99FCwvkLQBhhqMJPfogzmkPfIi/ekt1fE5lWXWmn1t5HvnotGO+SeTkSZFLhLUkO08pXaBbYDYtnwYErgmDaezze7bkFyXkQlBZosu5dYSmFKH1mZSYtdobI4yK9QAxRUipv59QMWWBb+R7DxOkHv4RdDTs7aK+3pkgk4abKjTfpWlmmTo+zQ/S2Ol3x37WdeBQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=aspeedtech.com; dmarc=pass action=none header.from=aspeedtech.com; dkim=pass header.d=aspeedtech.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aspeedtech.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WQ49xSlZIJPTccrfMzZGzPdatXmrn9asRWER3HG+LzQ=; b=Ju9Cb1pVrNCRAimn+c+L3r6QEDH+eBWwGzcft44WuhGFvp4O5m6CZX4FSweyRbdak5qobcXp4ECREp+GWXYo9tM/BtXj66bNYd/5V2Q9lN9BN3Y97/GZcV4hnHXssWF+gF7X+fpAa4vPbiWjL0RlHZ75IaiMNO9euCsjIBFLr3sC40dsR0l8Rtl7RCciZ8ttJYlEXL5ektah1/HBE3IQ5STJrgOIy/3E3aZQ/hjrTcQykeE4hf78NZeI5ao8NdK72g02mPfKE+y6myj6scG674+JvmjnjhmYjAhMNU0by+6FnNICUomCzopmrv1CkASgxQDH/OoOrb854Y/tTNw4NA== Received: from HK0PR06MB3202.apcprd06.prod.outlook.com (2603:1096:203:87::17) by SI2PR06MB4460.apcprd06.prod.outlook.com (2603:1096:4:158::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5373.18; Mon, 27 Jun 2022 02:56:41 +0000 Received: from HK0PR06MB3202.apcprd06.prod.outlook.com ([fe80::46d:a7a:f047:e9bf]) by HK0PR06MB3202.apcprd06.prod.outlook.com ([fe80::46d:a7a:f047:e9bf%5]) with mapi id 15.20.5373.018; Mon, 27 Jun 2022 02:56:41 +0000 From: Neal Liu To: Alan Stern CC: Felipe Balbi , Greg Kroah-Hartman , Roger Quadros , Miaohe Lin , Wesley Cheng , "Eric W . Biederman" , Matthew Wilcox , Nikita Yushchenko , Cai Huoqing , "linux-usb@vger.kernel.org" , "linux-kernel@vger.kernel.org" , BMC-SW Subject: RE: [PATCH v2] usb: gadget: f_mass_storage: Make CD-ROM emulation works with Windows OS Thread-Topic: [PATCH v2] usb: gadget: f_mass_storage: Make CD-ROM emulation works with Windows OS Thread-Index: AQHYh3DSTidIVUKmfU2+k/4XOqVQ6a1engoAgAPzy4A= Date: Mon, 27 Jun 2022 02:56:40 +0000 Message-ID: References: <20220624021916.318067-1-neal_liu@aspeedtech.com> In-Reply-To: Accept-Language: en-US Content-Language: zh-TW X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=aspeedtech.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: df87cdd0-d391-467a-8889-08da57e8a947 x-ms-traffictypediagnostic: SI2PR06MB4460:EE_ x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: h6Yp/w1NQjuUGj+70oQejAtFIWrkmka3UtdLehdTr4B35hKNtMHwJKrRmbrOoteEav+AxWAbjAJmWEwd5l8g8yWNo4Sxc3/dezS3A2MzxGW42uVfLLILUlK3Nh1bO1XGKv1McEXl+IlfKKZUBQ7uJzgjy3pq0qYtjsIXD0F/XRjP+7k9UcuwzcpidfIp7QgAG1GS4D2D03nUY/pOvf5/y5+/f3TgM18yegu1+dmLOfVY+/HXK4WUjhrUhMoFm7mDyajjzHdJY/aWdCygMECAWCoPxqIoJXgpSIJGmvMptYoeuDJJDoy9KRSgU3m2YbEW6wUYHmHSj3nJPLYWdWR3c2EyLDCalS1xMNESzGkJWC7XLJVK7o02trmSYpqImlSs37VgoXkx5QZvPEkCLfxVcEIXidrO3tkWFTA9rlPxuxkyp3hGqJPJHS++QaLNVN9LERMrDlgH5/u+lBXygKe+yxcMIm95xOtOASVYFA+nY11vrm3/cPHOO+vBS1/hAfcHCAyTWm3CUmlTp3vtD8e2hwS+gAqG/OUaC7J3I+mk1hPaca9b9YyzNe96pBgv5yZUjY5cTrxpDQTfbkiGSugfehCkLk+JYbYxkhmxdHrYnjSNGWl/wb4g+XeDJjTlcPlwIuHk7acq2XqahBL+0ee0oTw8kOAFRBS9npO+4zEwPrrsuOL/l7CiRXwUSUIL7tQGT8ZUvHmyn37ws91jkfvpbYZYCsotNdYC8MrjGylRE/43YI52uAmSwRp4zh+eVMaI/hjOFF16hynV2LbYuKWtqYdO7y8rlgZ9fTQn0AHE+SU= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:HK0PR06MB3202.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(39840400004)(376002)(396003)(136003)(346002)(366004)(41300700001)(186003)(26005)(7696005)(83380400001)(8676002)(6506007)(107886003)(9686003)(6916009)(38070700005)(38100700002)(55016003)(52536014)(33656002)(4326008)(66476007)(2906002)(5660300002)(7416002)(86362001)(478600001)(71200400001)(54906003)(66946007)(66556008)(122000001)(316002)(76116006)(64756008)(66446008)(8936002);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?JPuCAIT8+/l4Y7UawCr7lWzsf0WHNkQBCEoUvsLJXEQWUa4twXSTpFlRLXzF?= =?us-ascii?Q?FVoyMRA9p1OGnNCX1LruOXUm/SjhZ+JQi8VDSu0RB/dYPSctpWvkpgmWphkG?= =?us-ascii?Q?pqQ6Qrz4KsWXFwX+NNDgvtYBPRBREora5FUTuJCXA0VnhJRqZ/m86t3FnCWO?= =?us-ascii?Q?ZwAKJVBInayOfdzPyjjXaL+dMESrR9TN+QluKxnjw9sKfttHSm0e5mKY76C9?= =?us-ascii?Q?jbgMJ8ERyI3xPtQwW/rMNf7ubBxq1vk/BL0sYx7ZXE85M1pZHbR4+mUeCboN?= =?us-ascii?Q?kv9HlbexxzAptivrZPRL3OMUwkr3t6u3edkIMOsVUB2QgR41c1OFxqhuxiVS?= =?us-ascii?Q?d4a3D67kONzwfgaZvXQf3gLGxZqfoG2aeLS02KmmdGF3rWgC1Rlr+nPxLH4V?= =?us-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0VlT8eFKRQTfuNx4qOYTsXQ?= =?us-ascii?Q?TUJifWcp0TE87mDcZI5m7ElmqzB8sOfb7EuSvNOp0jht4Ae1ss0kIk158RhY?= =?us-ascii?Q?YdbD57nYc7v1GdkW4IfDRkABGH3+dRx8ND+aSzIHJDllOOrHwfvSnTnfRPTl?= =?us-ascii?Q?Rl0421Qj7nmkji8QYkCYZLuWE47vg3PbIU2QjacOUH7ySNv6RHDHQMQ1EcoH?= =?us-ascii?Q?SAGbP7+fMrg04tsCrEArI4iceqYXoYc9BUTzwN9gI09DkQ+HWLRzz2TBml/1?= =?us-ascii?Q?FKiYaWb2q6XHqOvPfTI4AhDzNQP/1fBeA/a6p8or?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: aspeedtech.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: HK0PR06MB3202.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: df87cdd0-d391-467a-8889-08da57e8a947 X-MS-Exchange-CrossTenant-originalarrivaltime: 27 Jun 2022 02:56:41.0256 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 43d4aa98-e35b-4575-8939-080e90d5a249 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: PVznq7sSWnfwqeqaHv/erq2FO0KndLiZUgcSxq5Txmg057pqrf0eo/T7EePfk1bHMeripGuKXJpeKgoxPOU0pw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SI2PR06MB4460 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On Fri, Jun 24, 2022 at 10:19:16AM +0800, Neal Liu wrote: > > Add read TOC with format 1 to support CD-ROM emulation with Windows > > OS. > > This patch is tested on Windows OS Server 2019. > > > > Signed-off-by: Neal Liu > > --- > > drivers/usb/gadget/function/f_mass_storage.c | 5 +++-- > > 1 file changed, 3 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/usb/gadget/function/f_mass_storage.c > > b/drivers/usb/gadget/function/f_mass_storage.c > > index 3a77bca0ebe1..9edf76c22605 100644 > > --- a/drivers/usb/gadget/function/f_mass_storage.c > > +++ b/drivers/usb/gadget/function/f_mass_storage.c > > @@ -1209,7 +1209,8 @@ static int do_read_toc(struct fsg_common > > *common, struct fsg_buffhd *bh) > > > > switch (format) { > > case 0: > > - /* Formatted TOC */ > > + case 1: > > + /* Formatted TOC, Session info */ >=20 > This comment is a little misleading. 0 is formatted TOC, and 1 is > multi-session info. The way you wrote it, it looks like the comment appl= ies to > both formats. Do it like this: >=20 > case 0: /* Formatted TOC */ > case 1: /* Multi-session info */ >=20 Okay, looks more clear. I'll fix it in next patch. > > len =3D 4 + 2*8; /* 4 byte header + 2 descriptors */ > > memset(buf, 0, len); > > buf[1] =3D len - 2; /* TOC Length excludes length field */ >=20 > It looks like you ignored one of the problems I pointed out in my earlier= email: >=20 > > When format is 1, the driver is supposed to ignore the start_track > > value. Your patch does not do this. >=20 > Please fix this. >=20 Do you mean ignore the "start_track > 1" above? Do this check only for format 0? Or format 0 & 2? >=20 > > @@ -1250,7 +1251,7 @@ static int do_read_toc(struct fsg_common > *common, struct fsg_buffhd *bh) > > return len; > > > > default: > > - /* Multi-session, PMA, ATIP, CD-TEXT not supported/required */ > > + /* PMA, ATIP, CD-TEXT not supported/required */ > > curlun->sense_data =3D SS_INVALID_FIELD_IN_CDB; > > return -EINVAL; > > } > > -- > > 2.25.1 > >