Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp6428842iog; Thu, 23 Jun 2022 19:54:01 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tl5p1O2ZcgD39U+MQmjHoFRxx81kD/u1PMxloztoPzY1qTW/dMxkQydiESVF6SNSrRhX+l X-Received: by 2002:a17:902:d411:b0:169:2eb:1b79 with SMTP id b17-20020a170902d41100b0016902eb1b79mr40858691ple.61.1656039241026; Thu, 23 Jun 2022 19:54:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656039241; cv=none; d=google.com; s=arc-20160816; b=S8ODJbhEZUKpBl6zE9+cmCYZYni9uGucKan7wFuOd3nC2QK6ZS7iQld2YwXL+Yu+2h 9PvKqZB5tj5h8eB+ANqoQ/+Ze2TMpq8s1VmIz+9cF60Uu+S7Je/1mwve9v50qFp7rQF5 y62mosTueliVRsM9ZmD7prZftf53kasQLlqPgp5iN+IqfmtNzhEGyrzWgoFopkq312tE OkUnt7sqNdroMsguDapaAVIfGKElhCn7T8CpW0hca2QWj/ZL8uKndPo+t0HsHoVm2iT9 TcNgI875qtk5Y9n3EY3HJu76ECi0xIDRPGB8N3q0yGsLawby5We0UEYxCpxH1d+ZywfO HolQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=CPbTW+vVdGaUCZ7W2QtUAwW+E+PVyy7uMPKXOQaUVOY=; b=S42nsK4o8P+ZQrwkFK/KFK9tCJICZnYUcLOT5g5BzDbFqQz2062rrUFykfO5RoFwdS a59ES4TFvC51kYp+qnoGLt3xeNNGQF08Q9xzU6PFHg3UUMh9m6Ct3Ngopl1CdgY05kBy 9gKpC52e07H8Kba9+5afZ3JH2cDe+s/6VLhdMmCoOHsz8jmyVZFxmdkPEJMLwqf3xs1m FWJHkxnvjuDDcGidV5+2LFvT5PlI/POLhCq5Qe9On9/XMx+rU4fBTfDRdtjfmLd4b6ou 3Se5sIbAzPtH2yt8U/iYGpfJG8lfFtQoZTyTdJszUqWz5EyW8IogsU/Y2Hzsgk+h2MOM hqWQ== 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 a15-20020a056a000c8f00b005183434ec7csi1196740pfv.363.2022.06.23.19.53.49; Thu, 23 Jun 2022 19:54:01 -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 S230109AbiFXCVm (ORCPT + 99 others); Thu, 23 Jun 2022 22:21:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229523AbiFXCVl (ORCPT ); Thu, 23 Jun 2022 22:21:41 -0400 Received: from twspam01.aspeedtech.com (twspam01.aspeedtech.com [211.20.114.71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 43CCB51E73; Thu, 23 Jun 2022 19:21:33 -0700 (PDT) Received: from mail.aspeedtech.com ([192.168.0.24]) by twspam01.aspeedtech.com with ESMTP id 25O23ZTY048384; Fri, 24 Jun 2022 10:03:35 +0800 (GMT-8) (envelope-from neal_liu@aspeedtech.com) Received: from localhost.localdomain (192.168.10.10) by TWMBX02.aspeed.com (192.168.0.24) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 24 Jun 2022 10:19:19 +0800 From: Neal Liu To: Felipe Balbi , Greg Kroah-Hartman , Alan Stern CC: Roger Quadros , Miaohe Lin , Wesley Cheng , "Eric W . Biederman" , Matthew Wilcox , Nikita Yushchenko , Cai Huoqing , , , Subject: [PATCH v2] usb: gadget: f_mass_storage: Make CD-ROM emulation works with Windows OS Date: Fri, 24 Jun 2022 10:19:16 +0800 Message-ID: <20220624021916.318067-1-neal_liu@aspeedtech.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [192.168.10.10] X-ClientProxiedBy: TWMBX02.aspeed.com (192.168.0.24) To TWMBX02.aspeed.com (192.168.0.24) X-DNSRBL: X-MAIL: twspam01.aspeedtech.com 25O23ZTY048384 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_PASS, T_SCC_BODY_TEXT_LINE,T_SPF_HELO_TEMPERROR 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 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 */ len = 4 + 2*8; /* 4 byte header + 2 descriptors */ memset(buf, 0, len); buf[1] = len - 2; /* TOC Length excludes length field */ @@ -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