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 phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E0376C04A95 for ; Sun, 25 Sep 2022 15:40:56 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id CBEAD84B79; Sun, 25 Sep 2022 17:40:44 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=kohlschutter.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=kohlschutter-com.20210112.gappssmtp.com header.i=@kohlschutter-com.20210112.gappssmtp.com header.b="SSy3t/H9"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4FF1584A37; Sun, 25 Sep 2022 16:46:37 +0200 (CEST) Received: from mail-ed1-x531.google.com (mail-ed1-x531.google.com [IPv6:2a00:1450:4864:20::531]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id CA42184B0C for ; Sun, 25 Sep 2022 16:46:33 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=kohlschutter.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=christian@kohlschuetter.com Received: by mail-ed1-x531.google.com with SMTP id z13so5884267edb.13 for ; Sun, 25 Sep 2022 07:46:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kohlschutter-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date; bh=vGbUh40VlzvzfOAPgY9fHRFQwr1meGEHF/Jjox9mS84=; b=SSy3t/H9Op3vsYWWBhXgqdX/MX5ZNekx1GuUwbdQP0wgKQe5CBU/XyrvdhbHGqsRGs asyoOAK8g32IEGu/3f/lvkZ04/EIQMaf26f7IUkjR0/TjKEoE5Ul+Vmx+IqhhZm8XtdZ Q6CgggB8fNFEJONGU+LDGP83bHovClGawSeGbcZ6eHN3iDAbgfufza+V//L010/f5NRL CRnDDKoEMWR8AseGEPH+RXhXlFiryvGhINWPkRUKV/Wz23MlqYE/jmsh0tUCDgwRHy0K NjFl0X/mtpksz5boNxj5FewV36CRkfegHDqp/KF6Rz32BrDUd/w/SPiZRU5orn0VMDIa Pzqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date; bh=vGbUh40VlzvzfOAPgY9fHRFQwr1meGEHF/Jjox9mS84=; b=pxsBdFVHSdRwZWYyPkbZFHGRdvl075A6gnNfEhnTYM4qYcIsrp2fAxkEe+lsvWprHH TSp3dC+a4uAz/Hh64+DxRF+ULiF3V+RP3dUAtfj1yy+LJxODui/BZ1Fty+Kg6IULL92p pNc4spfR2WFjkXDPGMJg6eVO95mvOSY/uB968cdlbVdElIGyAG+G0xNHIhNtJ6UViTzl /E97vU7oub38uiZvvltJ4FXbCNqFds+E7rWe/1TMkWPcOoxIVylKOj4Ahx7tebutZQHi Yyw438QHGEQAzx+4hdtbwlzimmawJQbxPNa/FFuF/KWIjwv6KkLDEcsppDaSh6o0bTFR V2VQ== X-Gm-Message-State: ACrzQf3WOiLj2RE90E1c4VNcQy3nfZ52mLirqqC/Y5vdZz3KE6bm5UwT xymqS2m7KPrMJPaW3FdTq5R++R6Oklkvic+T X-Google-Smtp-Source: AMsMyM4nJF+0ghJlFKjYXM30oDGjLFOkqpu/YdAQy1QTK9QhVjkV9zcKR4GQnmKDh+z2u12TqjabTw== X-Received: by 2002:aa7:df8b:0:b0:44e:882f:7c5c with SMTP id b11-20020aa7df8b000000b0044e882f7c5cmr18035185edy.418.1664117193065; Sun, 25 Sep 2022 07:46:33 -0700 (PDT) Received: from plus1.kohl.home (ip5b434222.dynamic.kabel-deutschland.de. [91.67.66.34]) by smtp.gmail.com with ESMTPSA id e2-20020a056402104200b00445f9faf13csm9555392edu.72.2022.09.25.07.46.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Sep 2022 07:46:32 -0700 (PDT) From: =?UTF-8?q?Christian=20Kohlschu=CC=88tter?= To: u-boot@lists.denx.de, Marek Vasut , Lukasz Majewski Cc: =?UTF-8?q?Christian=20Kohlschu=CC=88tter?= Subject: [PATCH] usb: common: Detect USB storage media with "miscellaneous" USB devices Date: Sun, 25 Sep 2022 14:46:10 +0000 Message-Id: <20220925144609.11727-1-christian@kohlschutter.com> X-Mailer: git-send-email 2.36.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Mailman-Approved-At: Sun, 25 Sep 2022 17:40:40 +0200 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean When detecting USB storage devices, we currently skip everything that is not marked as "undefined device class". Composite devices such as tinyusb's CDC+MSC identify as "miscellaneous" (class 0xEF). Introduce a new constant, USB_CLASS_MISC (0xEF), and allow the detection process to proceed for USB devices with this device class. Signed-off-by: Christian Kohlschütter --- common/usb_storage.c | 3 ++- include/usb_defs.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/common/usb_storage.c b/common/usb_storage.c index eaa31374ef..727b364b3d 100644 --- a/common/usb_storage.c +++ b/common/usb_storage.c @@ -1322,7 +1322,8 @@ int usb_storage_probe(struct usb_device *dev, unsigned int ifnum, /* let's examine the device now */ iface = &dev->config.if_desc[ifnum]; - if (dev->descriptor.bDeviceClass != 0 || + if ((dev->descriptor.bDeviceClass != 0 && dev->descriptor.bDeviceClass + != USB_CLASS_MISC) || iface->desc.bInterfaceClass != USB_CLASS_MASS_STORAGE || iface->desc.bInterfaceSubClass < US_SC_MIN || iface->desc.bInterfaceSubClass > US_SC_MAX) { diff --git a/include/usb_defs.h b/include/usb_defs.h index 6dd2c997f9..f8f87d6a8a 100644 --- a/include/usb_defs.h +++ b/include/usb_defs.h @@ -19,6 +19,7 @@ #define USB_CLASS_MASS_STORAGE 8 #define USB_CLASS_HUB 9 #define USB_CLASS_DATA 10 +#define USB_CLASS_MISC 0xef #define USB_CLASS_VENDOR_SPEC 0xff /* some HID sub classes */ -- 2.36.2