From patchwork Thu Jun 23 03:04:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neal Liu X-Patchwork-Id: 585107 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 79084CCA48F for ; Thu, 23 Jun 2022 04:41:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230346AbiFWElm (ORCPT ); Thu, 23 Jun 2022 00:41:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232800AbiFWDJa (ORCPT ); Wed, 22 Jun 2022 23:09:30 -0400 Received: from twspam01.aspeedtech.com (twspam01.aspeedtech.com [211.20.114.71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 116C823177; Wed, 22 Jun 2022 20:09:28 -0700 (PDT) Received: from mail.aspeedtech.com ([192.168.0.24]) by twspam01.aspeedtech.com with ESMTP id 25N2mScA001829; Thu, 23 Jun 2022 10:48:28 +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; Thu, 23 Jun 2022 11:04:08 +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 RESEND] usb: gadget: f_mass_storage: Make CD-ROM emulation works with Windows OS Date: Thu, 23 Jun 2022 11:04:05 +0800 Message-ID: <20220623030405.1922980-1-neal_liu@aspeedtech.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 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 25N2mScA001829 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Add read TOC with format 2 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 | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/gadget/function/f_mass_storage.c b/drivers/usb/gadget/function/f_mass_storage.c index 3a77bca0ebe1..3c2a5f1e8b66 100644 --- a/drivers/usb/gadget/function/f_mass_storage.c +++ b/drivers/usb/gadget/function/f_mass_storage.c @@ -1209,6 +1209,7 @@ static int do_read_toc(struct fsg_common *common, struct fsg_buffhd *bh) switch (format) { case 0: + case 1: /* Formatted TOC */ len = 4 + 2*8; /* 4 byte header + 2 descriptors */ memset(buf, 0, len);