On Thursday 17 August 2006 1:35 am, Your Name wrote:
> Hello,
> 
> Please bear with me as I am very new to this. I have several questions
> regarding the GadgetFS driver that provides a user-mode API for
> developing user-mode drivers.
> 
> I want to use GadgetFS on an embedded system with an Au1200 chip running
> a precompiled kernel - 2.6.11. Here's what I did before running the
> example code (usb.c , usbstring.c from the linux-usb.org/gadget
> website). I loaded the gadgetfs.ko which is included in the precompiled
> kernel with `modprobe gadgetfs`, then `mount -t gadgetfs path
> /dev/gadgetfs`. At this point, there is a file `amd5536udc` in the
> /dev/gadgetfs folder.

So far so good ... 2.6.11 isn't current, so upgrade when you get a chance;
but it's only a couple years old, so upgrading may not be a big priority.


> (amd5536udc.h)
> http://210.217.20.216/websvn/filedetails.php?repname=kernel&path=%2Fdrivers%2Fusb%2Fgadget%2Famd5536udc.h&rev=0&sc=0
> (amd5536udc.c)
> http://210.217.20.216/websvn/filedetails.php?repname=kernel&path=%2Fdrivers%2Fusb%2Fgadget%2Famd5536udc.c&rev=0&sc=0
> 
> I realize that there's no autoconfiguration in the usb.c example code
> for amd5536udc, so I changed it a little for it to use the 'AMD au1x00
> processor, full speed only' configuration.

But that chip can implement high speed too; why did you restrict it?
I didn't look in detail, but as a rule if the hardware supports dual
speed operation, the gadget driver _must_ do so as well.


> However, this is not working 
> out, as the device stops responding when the sample code is executed
> (this happens only when the usb cables are plugged in.). I don't know
> why this happens. 

It could easily be a bug in that UDC driver.  Do you know for a fact
that it works?  Gadgetfs does things that the other gadget drivers
don't do, so it's possible that there would be bugs showing up only
with gadgetfs.  If g_file_storage doesn't work, gadgetfs won't...


> So this brings me to my first question : how do you 
> figure out which endpoints to use?

The sample "usb.c" needs only bulk endpoints (except in its ISO mode).
So based on that driver source, use "ep1in-bulk" and "ep1out-bulk".


> 2nd Question : How complicated is it to get the host computer to
> communicate with the device via USB? Is there no simple solution, like
> opening a communication pipe for the host computer to send and receive
> commands to the USB device? (I guess the answer is no).

The sample "usb.c" program talks to a Linux host using a the kernel
"usbtest" driver and a driver.  Unfortunately "usbfs" isn't quite as
simple as you describe, although recent changes have started to work
towards making it become that way ... see how "libusb" works.  It's
not as simple as gadgetfs (yet).


> 3rd Question : What reference book would you recommend for developing a
> simple USB Gadget Driver? (assuming this is the only way a usb device
> can be configured to talk to the host computer). O'reilly's Linux Device
> Drivers says "USB gadget drivers are outside the realm of this book at
> this point in time".

No such book written at this time, but "make pdfdocs" in your kernel source
tree and you'll get a "gadget.pdf" that's a fair start.  Also look at 
the sample code.  (There'll also be a host side "usb.pdf", with some overview
material that may also help.)

The upside of USB is that pretty much any computer nowadays either supports
it already, or can easily do so.  The downside is that the USB 2.0 spec is
not written to be easily understood ... though the first few chapters give
a good overview, and you can get much of the rest of what you need by
skimming the chapter on protoco (ch5?) and looking in more detail at the
device model (ch9).

- Dave


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to