Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp506479iog; Fri, 24 Jun 2022 08:13:40 -0700 (PDT) X-Google-Smtp-Source: AGRyM1t4paqRubCww5LWKjIN/CydwgCXImih66xa+8X5pUDIn/Fn7rPDu0lNUwufAQc8FBxPaPRf X-Received: by 2002:a05:6402:2687:b0:437:652e:26a1 with SMTP id w7-20020a056402268700b00437652e26a1mr635510edd.36.1656083620438; Fri, 24 Jun 2022 08:13:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656083620; cv=none; d=google.com; s=arc-20160816; b=Diy5dQ4bYE78EEVU9su4r66JwXoN934ctWV4JRSzn4Vgq4UkBbQH7e8cBudwni2vBE MO+yRKH1nW1VPFhgshttIgXdQ+bmAduSmrw6wbyGr1uf7AD8nj1yBvYvKrtIfGIeNBnh 8PHw1BnONRZpWWsCgVPcob7aRDownodBUCUIM1CCN+8J6vOOaYGksZ8M6pXdLymzaDWA Ml7pSz9bE84JcJavntZRRwU36436SmsQcIi09avYA1wpd63McnP+N3HOXYMqvLh589H8 JT60JgQDs1R/MSgUY4FEG52ke5y6wLdUubm3ym5COTSjV8n5nuau0Zo4qUTy1NozpFEC gJWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=sOJzs2LvTWMmOo6hct9DuIQDdtgIGp71ZNAdy4JiHDY=; b=rN+NVY02PuPeA3CVeixZX+lEdfaAmwJQVO1E7Fyr28qBqJfnm92oRZNWp8+JcLOn/f OHILrtd9osZE4umjzWrGH33vRvWF9ysilAeDlxwbc976MYQ7Kra6T3K0tgXlZmbE/45W 5ItKeXcZNav0xh4Wt/U02r1u64D0esQxCzzniLbuRc+MzP125JpjEwFxCMI+oms58NKQ H+Qz4QxldiuDUZdLeSPxbmXrXdYMw/jhiH2MVCXyPthpWnmIXeGFuI2KRKrFVIeL+K/I xjK5ZSka7VhcJfyZNSBUlEl2lbQApEAEFDktii+q2xf0SEVL/pHjYYHdcyVuW+0XpM/j 1wmg== ARC-Authentication-Results: i=1; mx.google.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 x20-20020a50d614000000b004358c45856fsi3057995edi.412.2022.06.24.08.13.14; Fri, 24 Jun 2022 08:13:40 -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; 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 S232027AbiFXO1B (ORCPT + 99 others); Fri, 24 Jun 2022 10:27:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55712 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231772AbiFXO1A (ORCPT ); Fri, 24 Jun 2022 10:27:00 -0400 Received: from netrider.rowland.org (netrider.rowland.org [192.131.102.5]) by lindbergh.monkeyblade.net (Postfix) with SMTP id 62FED4ECE7 for ; Fri, 24 Jun 2022 07:26:59 -0700 (PDT) Received: (qmail 33925 invoked by uid 1000); 24 Jun 2022 10:26:58 -0400 Date: Fri, 24 Jun 2022 10:26:58 -0400 From: Alan Stern To: Neal Liu 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@aspeedtech.com Subject: Re: [PATCH v2] usb: gadget: f_mass_storage: Make CD-ROM emulation works with Windows OS Message-ID: References: <20220624021916.318067-1-neal_liu@aspeedtech.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220624021916.318067-1-neal_liu@aspeedtech.com> X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no 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 */ 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 applies to both formats. Do it like this: case 0: /* Formatted TOC */ case 1: /* Multi-session info */ > len = 4 + 2*8; /* 4 byte header + 2 descriptors */ > memset(buf, 0, len); > buf[1] = len - 2; /* TOC Length excludes length field */ It looks like you ignored one of the problems I pointed out in my earlier email: > When format is 1, the driver is supposed to ignore the start_track > value. Your patch does not do this. Please fix this. Alan Stern > @@ -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 = SS_INVALID_FIELD_IN_CDB; > return -EINVAL; > } > -- > 2.25.1 >