[PATCH] USB: g_multi: KConfig options changed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Configuration options of Multifunction Composite Gadget has
been changed as to makke it possible for each configuration
available in the MCG to be selected individually.

Signed-off-by: Michal Nazarewicz <m.nazarewicz@xxxxxxxxxxx>
---
This patch makes it possible to choose only a single configuration
to be compiled in MCG.  This way, one can build version of the
driver which will be automatically detected by Windows as a
composite gadget.  Still, an INF file for RNDIS (or ECM) and CDC
Serial is needed (use Documentation/usb/linux.inf for RNDIS) but
at least Mass Storage should work out of the box. :)

 drivers/usb/gadget/Kconfig |   41 ++++++++++++++++++++++++++++-------------
 drivers/usb/gadget/multi.c |   12 +++++++++---
 2 files changed, 37 insertions(+), 16 deletions(-)

diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig
index afd53ea..eda1105 100644
--- a/drivers/usb/gadget/Kconfig
+++ b/drivers/usb/gadget/Kconfig
@@ -751,29 +751,44 @@ config USB_CDC_COMPOSITE
 config USB_G_MULTI
 	tristate "Multifunction Composite Gadget (EXPERIMENTAL)"
 	help
-	  The Multifunction Composite Gadget provides RNDIS, mass storage
-	  and ACM serial link interfaces.
+	  The Multifunction Composite Gadget provides Ethernet (RNDIS
+	  and/or CDC Ethernet), mass storage and ACM serial link
+	  interfaces.
+
+	  You will be asked too choose which of the two configurations are
+	  to be available in the gadget.  At least one configuration must
+	  be choosen to make gadget usable.  Selecting more then one
+	  configuration will prevent Windows from automatically detecting
+	  the gadget as a composite gadget an INF file will be needed to
+	  use the gadget.

 	  Say "y" to link the driver statically, or "m" to build a
 	  dynamically linked module called "g_multi".

 config USB_G_MULTI_RNDIS
-	bool "RNDIS support"
+	bool "RNDIS + CDC Serial + Storage configuration"
 	depends on USB_G_MULTI
 	default y
 	help
-	   Microsoft Windows XP bundles the "Remote NDIS" (RNDIS) protocol,
-	   and Microsoft provides redistributable binary RNDIS drivers for
-	   older versions of Windows.
+	  This option enables a configuration with RNDIS, CDC Serial and
+	  Mass Storage functions available in the Multifunction Composite
+	  Gadget.  This is configuration dedicated for Windows since RNDIS
+	  is Microsfot's protocol.

-	   If you say "y" here, the Ethernet gadget driver will try to provide
-	   a second device configuration, supporting RNDIS to talk to such
-	   Microsoft USB hosts.
+	  If unsure, say "y".
+
+config USB_G_MULTI_CDC
+	bool "CDC Ethernet + CDC Serial + Storage configuration"
+	depends on USB_G_MULTI
+	default n
+	help
+	  This option enables a configuration with CDC Ethernet (ECM), CDC
+	  Serial and Mass Storage functions available in the Multifunction
+	  Composite Gadget.  This is configuration dedicated for Windows
+	  since RNDIS is Microsfot's protocol.
+
+	  If unsure, say "y".

-	   To make MS-Windows work with this, use Documentation/usb/linux.inf
-	   as the "driver info file".  For versions of MS-Windows older than
-	   XP, you'll need to download drivers from Microsoft's website; a URL
-	   is given in comments found in that info file.

 # put drivers that need isochronous transfer support (for audio
 # or video class gadget drivers), or specific hardware, here.
diff --git a/drivers/usb/gadget/multi.c b/drivers/usb/gadget/multi.c
index 59b3db9..64711fe 100644
--- a/drivers/usb/gadget/multi.c
+++ b/drivers/usb/gadget/multi.c
@@ -26,7 +26,7 @@
 #include <linux/utsname.h>


-#ifdef CONFIG_USB_G_MULTI_RNDIS
+#if defined CONFIG_USB_G_MULTI_RNDIS
 #  define CONFIG_USB_ETH_RNDIS y
 #endif

@@ -186,6 +186,8 @@ static struct usb_configuration rndis_config_driver = {

 #endif

+#ifdef CONFIG_USB_G_MULTI_CDC
+
 static int __init cdc_do_config(struct usb_configuration *c)
 {
 	int ret;
@@ -220,6 +222,8 @@ static struct usb_configuration cdc_config_driver = {
 	.bmAttributes		= USB_CONFIG_ATT_SELFPOWER,
 };

+#endif
+


 /****************************** Gadget Bind ******************************/
@@ -262,8 +266,8 @@ static int __init multi_bind(struct usb_composite_dev *cdev)
 		 * but if the controller isn't recognized at all then
 		 * that assumption is a bit more likely to be wrong.
 		 */
-		WARNING(cdev, "controller '%s' not recognized; trying %s\n",
-		        gadget->name, cdc_config_driver.label);
+		WARNING(cdev, "controller '%s' not recognized\n",
+		        gadget->name);
 		device_desc.bcdDevice = cpu_to_le16(0x0300 | 0x0099);
 	}

@@ -295,10 +299,12 @@ static int __init multi_bind(struct usb_composite_dev *cdev)
 		goto fail2;
 #endif

+#ifdef CONFIG_USB_G_MULTI_CDC
 	/* register our second configuration */
 	status = usb_add_config(cdev, &cdc_config_driver);
 	if (status < 0)
 		goto fail2;
+#endif

 	dev_info(&gadget->dev, DRIVER_DESC ", version: " DRIVER_VERSION "\n");
 	fsg_common_put(fsg_common);
--
1.6.3.3

--
Best regards,                                           _     _
 .o. | Liege of Serenely Enlightened Majesty of       o' \,=./ `o
 ..o | Computer Science,  Michał "mina86" Nazarewicz     (o o)
 ooo +---<mina86@xxxxxxxxxx>---<mina86@xxxxxxxxxx>---ooO--(_)--Ooo--

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux