testusb with gadgetfs fails since usb.c not uptodate for atmel_usba_udc

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

 



Hi all,

I'm trying to use usbtest to test my i.MX21 host controller.
I have a atngw100 on the device side.

First of all I used gadgetzero compiled in the kernel (2.6.29) on the
device side and usbtest on the host side and that worked.

However that doesn't support isoc endpoints for which I understand I
need to use gadgetfs on the device side with the userspace  "usb.c, 
usbstring.c , usbstring.h".

Using that and mounting gadgetfs on /dev/gadget I get :

/sbin # ./usb-gadget    (generated from usb.c)
/dev/gadget/atmel_usba_udc ep0 configured
serial="to5l0acprxhreyyyrbxur5mnf871e985oblgnjp0la2wrtfirzr9t9p6muimnz4"
simple_source_thread open ep1in-bulk error 2 (No such file or directory)
simple_sink_thread open ep2out-bulk error 2 (No such file or directory)

And indeed:
 # ls -l /dev/gadget/
-rw-------    1 root     root            0 Apr  2 20:24 atmel_usba_udc
-rw-------    1 root     root            0 Apr  2 20:56 ep1
-rw-------    1 root     root            0 Apr  2 20:56 ep2
-rw-------    1 root     root            0 Apr  2 20:56 ep3-int
-rw-------    1 root     root            0 Apr  2 20:56 ep4-int
-rw-------    1 root     root            0 Apr  2 20:56 ep5
-rw-------    1 root     root            0 Apr  2 20:56 ep6

on the host side I have in /proc/usb/devices:
T:  Bus=01 Lev=02 Prnt=02 Port=01 Cnt=02 Dev#=  5 Spd=12  MxCh= 0
D:  Ver= 2.00 Cls=ff(vend.) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=0525 ProdID=a4a4 Rev= 1.08
S:  Manufacturer=Licensed to Code, LLC
S:  Product=My Source/Sink Product
S: 
SerialNumber=to5l0acprxhreyyyrbxur5mnf871e985oblgnjp0la2wrtfirzr9t9p6muimnz4
C:* #Ifs= 1 Cfg#= 3 Atr=c0 MxPwr=  2mA
I:* If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=usbtest
E:  Ad=81(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=02(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=83(I) Atr=03(Int.) MxPS=   8 Ivl=8ms


And (not unexpectedly) testusb from the host fails:
# testusb -a -t 1
unknown speed   /proc/bus/usb/001/005
/proc/bus/usb/001/005 test 1 --> 110 (Connection timed out)

So it looks like the endpoint files created by gadgetfs aren't the ones
the userspace "usb" program is expecting.

It looks like this is caused by
commit 5d4c2707cf605fbf205b6d0a3c63d07204295f22 (atmel_usba_udc: Fix
endpoint names)

containing
--- a/drivers/usb/gadget/atmel_usba_udc.c
+++ b/drivers/usb/gadget/atmel_usba_udc.c
@@ -999,13 +999,13 @@ static const struct usb_gadget_ops usba_udc_ops = {
 }
 
 static struct usba_ep usba_ep[] = {
-       EP("ep0", 0, 64, 1, 0, 0),
-       EP("ep1in-bulk", 1, 512, 2, 1, 1),
-       EP("ep2out-bulk", 2, 512, 2, 1, 1),
-       EP("ep3in-int", 3, 64, 3, 1, 0),
-       EP("ep4out-int", 4, 64, 3, 1, 0),
-       EP("ep5in-iso", 5, 1024, 3, 1, 1),
-       EP("ep6out-iso", 6, 1024, 3, 1, 1),
+       EP("ep0",     0,   64, 1, 0, 0),
+       EP("ep1",     1,  512, 2, 1, 1),
+       EP("ep2",     2,  512, 2, 1, 1),
+       EP("ep3-int", 3,   64, 3, 1, 0),
+       EP("ep4-int", 4,   64, 3, 1, 0),
+       EP("ep5",     5, 1024, 3, 1, 1),
+       EP("ep6",     6, 1024, 3, 1, 1),


And the userspace test code hasn't followed.

This patch to usb.c fixes it:
--- usb.c.orig    2009-04-02 23:17:37.000000000 +0200
+++ usb.c    2009-04-02 23:20:42.000000000 +0200
@@ -410,17 +410,17 @@
         fs_source_desc.bEndpointAddress
             = hs_source_desc.bEndpointAddress
             = USB_DIR_IN | 1;
-        EP_IN_NAME = "ep1in-bulk";
+        EP_IN_NAME = "ep1";
         fs_sink_desc.bEndpointAddress
             = hs_sink_desc.bEndpointAddress
             = USB_DIR_OUT | 2;
-        EP_OUT_NAME = "ep2out-bulk";
+        EP_OUT_NAME = "ep2";
 
         source_sink_intf.bNumEndpoints = 3;
         fs_status_desc.bEndpointAddress
             = hs_status_desc.bEndpointAddress
             = USB_DIR_IN | 3;
-        EP_STATUS_NAME = "ep3in-int";
+        EP_STATUS_NAME = "ep3-int";
 
     } else {
         DEVNAME = 0;
@@ -635,7 +635,7 @@
         fs_source_desc.bInterval
             = hs_source_desc.bInterval
             = interval;
-        EP_IN_NAME = "ep5in-iso";
+        EP_IN_NAME = "ep5";
 
         fs_sink_desc.bEndpointAddress
             = hs_sink_desc.bEndpointAddress
@@ -649,13 +649,13 @@
         fs_sink_desc.bInterval
             = hs_sink_desc.bInterval
             = interval;
-        EP_OUT_NAME = "ep6out-iso";
+        EP_OUT_NAME = "ep6";
 
         source_sink_intf.bNumEndpoints = 3;
         fs_status_desc.bEndpointAddress
             = hs_status_desc.bEndpointAddress
             = USB_DIR_IN | 3;
-        EP_STATUS_NAME = "ep3in-int";
+        EP_STATUS_NAME = "ep3-int";
 
     } else {
         DEVNAME = 0;


I see I still don't have isoc endpoints but looking at the code thats
because I haven't compiled it with libaio.

Regards,

Martin



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