From patchwork Thu Jun 23 02:38:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neal Liu X-Patchwork-Id: 12891731 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 CDEC0C43334 for ; Thu, 23 Jun 2022 02:41:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234311AbiFWCli (ORCPT ); Wed, 22 Jun 2022 22:41:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44678 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232509AbiFWClh (ORCPT ); Wed, 22 Jun 2022 22:41:37 -0400 Received: from twspam01.aspeedtech.com (twspam01.aspeedtech.com [211.20.114.71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C03CE42A0D for ; Wed, 22 Jun 2022 19:41:33 -0700 (PDT) Received: from mail.aspeedtech.com ([192.168.0.24]) by twspam01.aspeedtech.com with ESMTP id 25N2N2Zq099539; Thu, 23 Jun 2022 10:23:02 +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 10:38:42 +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 , , <--cc=linux-kernel@vger.kernel.org>, Subject: [PATCH] usb: gadget: f_mass_storage: Make CD-ROM emulation works with Windows OS Date: Thu, 23 Jun 2022 10:38:39 +0800 Message-ID: <20220623023839.1893954-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 25N2N2Zq099539 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);