USB Gadget Framework?!

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

 



Hello Alan,

As I already outlined, I am new to this area, USB goodies, never had to deal with
these before.

As I am diving more to the code, it is NOT only the gadget driver one supposed to
write, he also need to deal with the whole framework in order to make his own
driver to work!

So, there are mandatory changes in other files, rather than just adding new
gadget driver files and modifying Kconfig and Makefile!

It is not only to add to the gadget_chips.h, but to modify also epautoconf.c!

[tbrymer@localhost projects]$ diff -abBu linux-2.6.34.10/drivers/usb/gadget/epautoconf.c MoonCreek/shadow-linux-2.6.34.10/drivers/usb/gadget/epautoconf.c
--- linux-2.6.34.10/drivers/usb/gadget/epautoconf.c	2011-06-26 09:47:42.000000000 -0700
+++ MoonCreek/shadow-linux-2.6.34.10/drivers/usb/gadget/epautoconf.c	2012-01-27 00:00:06.480025575 -0800
@@ -283,6 +283,19 @@
 		if (ep && ep_matches (gadget, ep, desc))
 			return ep;
 #endif
+
+	} else if (gadget_is_max3420 (gadget)) {
+		if ((USB_ENDPOINT_XFER_BULK == type) ||
+		    (USB_ENDPOINT_XFER_INT == type)) {
+			if (USB_DIR_IN & desc->bEndpointAddress)
+				ep = find_ep (gadget, "ep2in-bulk");
+			else
+				ep = find_ep (gadget, "ep1out-bulk");
+		} else
+			ep = NULL;
+
+		if (ep && ep_matches (gadget, ep, desc))
+			return ep;
 	}
 
 	/* Second, look at endpoints until an unclaimed one looks usable */

After adding this, I started seeing much better results than before:

 T:  Bus=02 Lev=02 Prnt=03 Port=00 Cnt=01 Dev#= 21 Spd=12  MxCh= 0
D:  Ver= 2.00 Cls=ff(vend.) Sub=00 Prot=00 MxPS=64 #Cfgs=  2
P:  Vendor=0525 ProdID=a4a0 Rev= 2.27
S:  Manufacturer=Linux 2.6.34.10-WR4.3.0.0_standard with max_udc
S:  Product=Gadget Zero
S:  SerialNumber=0123456789.0123456789.0123456789
C:* #Ifs= 1 Cfg#= 3 Atr=e0 MxPwr=  2mA
I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=usbtest
E:  Ad=01(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=82(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
C:  #Ifs= 1 Cfg#= 2 Atr=c0 MxPwr=  2mA
I:  If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=
E:  Ad=01(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=82(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms

The question here: Am I missing something else here? Do you have some guidelines
how to write gadget drivers, and how to properly modify USB framework to adjust to
new added gadget driver?

Thank you,
Zoran Stojsavljevic

--------------------------------------------------------------------------------------
Intel GmbH
Dornacher Strasse 1
85622 Feldkirchen/Muenchen, Deutschland 
Sitz der Gesellschaft: Feldkirchen bei Muenchen
Geschaeftsfuehrer: Douglas Lusk, Peter Gleissner, Hannes Schwaderer
Registergericht: Muenchen HRB 47456 
Ust.-IdNr./VAT Registration No.: DE129385895
Citibank Frankfurt a.M. (BLZ 502 109 00) 600119052

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