win XP USB gadget drivers and general USB gadget driver Q

In my effort to get anything talking to an winXP box (very
I was wondering if it is possible to run two or more gadget drivers in

-* g_ether to XP, connects and locks up(kernel panic) 2.6.29r37 with
linux.inf (RNIDS via usb8023.sys)
+* g_serial to XP, WORKS! with gserial.inf (usbser.sys)
-* g_cdc to XP, no inf available, tried to hack one but did not have
the time or knowledge. theoretically should work with usbser.sys and a
good inf file
+* g_file_storage to XP, WORKS! with stock XP drivers (USB mass
storage) with a little influence, namely forcing XP to load drivers
through device manager
?* gadgetfs, what is this for?

So, the question is: can I run the g_serial and g_file_storage at the
same time?

insmod g_serial.ko
insmod g_file_storage.ko file=/dev/mmcblkp1 removable=y

results in a resource error. (dont know exact error, not at my desk
right now)
I am obviously not understanding the USB gadget protocol.
Can someone provide a link to a good reference or theory of operation.

No, you can only run a single gadget at a time… You can of course rmmod one gadget and modprobe another gadget to change personalities on the fly. One of the things on my long-term “to do list” is to write a usb hub gadget to which you can then plug in usb gadgets (and multiples of the them) at run time.

There are a couple of things you could do to flick from one mode to the other (triggered by the Windows XP side). First of all if Windows XP ejects the drive linux simply remounts it - but you can see that the eject was performed by "tail"ing dmesg.

My first hack simply checked for an eject and once it saw it removed the g_file_storage and replaced it with the serial driver. My second hack used the USER button on the BeagleBoard (there is an event file somewhere you can use to detect key presses).

My third hack was a little more involved (because I didn’t want untrusted users getting access). While the documentation says you shouldn’t… (he he)… you can mount the g_file_storage backing device as a file system on the BeagleBoard (strongly recommend as read only though). You can then check a “flag file” to see if it exists. In my case I checked for a GPG signed script which (if the signature was valid) was run as root. If you want to update the backing storage you should remove the g_file_storage module, make updates and then reload it. XP simply sees the pendrive as ejected and then re-inserted. In my case the script output was put back onto the drive. In your case you could remove the g_file_storage and insert the g_serial.

Gadgetfs simply takes the kernel provided API and exposes it through /dev/gadget to allow people to write user space drivers without having to hack kernel drivers. I’m pretty sure (although not 100% certain) that gadgetfs only supports a single gadget.