Re: selection of usb configuration on the fly on usb host

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

 



On Mon, 14 Jun 2010, Amit Nagal wrote:

> Hi Alan ,
> 
> Thanx for the reply .
> 
> Following enclosed are  logs  :
> 
> cat /proc/bus/usb/devices  :
> 
> 
> T:  Bus=02 Lev=01 Prnt=01 Port=05 Cnt=01 Dev#=  2 Spd=480 MxCh= 0
> D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  2
> P:  Vendor=05ac ProdID=1261 Rev= 0.01
> S:  Manufacturer=Apple Inc.
> S:  Product=iPod
> S:  SerialNumber=000A270013A06238
> C:* #Ifs= 1 Cfg#= 1 Atr=c0 MxPwr=500mA
> I:* If#= 0 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage
> E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> C:  #Ifs= 3 Cfg#= 2 Atr=c0 MxPwr=500mA
> I:  If#= 0 Alt= 0 #EPs= 0 Cls=01(audio) Sub=01 Prot=00 Driver=
> I:  If#= 1 Alt= 0 #EPs= 0 Cls=01(audio) Sub=02 Prot=00 Driver=
> I:  If#= 1 Alt= 1 #EPs= 1 Cls=01(audio) Sub=02 Prot=00 Driver=
> E:  Ad=81(I) Atr=01(Isoc) MxPS= 192 Ivl=1ms
> I:  If#= 2 Alt= 0 #EPs= 1 Cls=03(HID  ) Sub=00 Prot=00 Driver=
> E:  Ad=83(I) Atr=03(Int.) MxPS=  64 Ivl=125us

> Looking forward to suggested patch  .

Here it is.  However I must warn you: It is highly unlikely this patch
will ever be accepted into the offical Linux kernel.  Most people who
have iPods and plug them into their computers do expect the iPod to be
placed in the mass-storage config.

About the closest we might come is a change allowing you to specify
quirk entries while the system is running.

Alan Stern



Index: 2.6.34/drivers/usb/core/generic.c
===================================================================
--- 2.6.34.orig/drivers/usb/core/generic.c
+++ 2.6.34/drivers/usb/core/generic.c
@@ -18,6 +18,7 @@
  */
 
 #include <linux/usb.h>
+#include <linux/usb/quirks.h>
 #include "usb.h"
 #include "hcd.h"
 
@@ -47,6 +48,9 @@ int usb_choose_configuration(struct usb_
 	int insufficient_power = 0;
 	struct usb_host_config *c, *best;
 
+	if (udev->quirks & USB_QUIRK_DONT_CONFIGURE)
+		return -1;
+
 	best = NULL;
 	c = udev->config;
 	num_configs = udev->descriptor.bNumConfigurations;
Index: 2.6.34/drivers/usb/core/quirks.c
===================================================================
--- 2.6.34.orig/drivers/usb/core/quirks.c
+++ 2.6.34/drivers/usb/core/quirks.c
@@ -50,6 +50,9 @@ static const struct usb_device_id usb_qu
 	/* appletouch */
 	{ USB_DEVICE(0x05ac, 0x021a), .driver_info = USB_QUIRK_RESET_RESUME },
 
+	/* Apple iPod */
+	{ USB_DEVICE(0x05ac, 0x1261), .driver_info = USB_QUIRK_DONT_CONFIGURE },
+
 	/* Avision AV600U */
 	{ USB_DEVICE(0x0638, 0x0a13), .driver_info =
 	  USB_QUIRK_STRING_FETCH_255 },
Index: 2.6.34/include/linux/usb/quirks.h
===================================================================
--- 2.6.34.orig/include/linux/usb/quirks.h
+++ 2.6.34/include/linux/usb/quirks.h
@@ -22,4 +22,7 @@
 /*device will morph if reset, don't use reset for handling errors */
 #define USB_QUIRK_RESET_MORPHS		0x00000010
 
+/* device should not be configured by default */
+#define USB_QUIRK_DONT_CONFIGURE	0x00000020
+
 #endif /* __LINUX_USB_QUIRKS_H */

--
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