win XP USB gadget drivers and general USB gadget driver Q

87 views
Skip to first unread message

d1m_bu1b

unread,
Jul 14, 2009, 9:13:29 PM7/14/09
to Beagle Board
In my effort to get anything talking to an winXP box (very
frustrating)
I was wondering if it is possible to run two or more gadget drivers in
parallel.

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

Michael Evans

unread,
Jul 15, 2009, 8:00:46 AM7/15/09
to beagl...@googlegroups.com
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.

> Date: Tue, 14 Jul 2009 18:13:29 -0700
> Subject: [beagleboard] win XP USB gadget drivers and general USB gadget driver Q
> From: d1m_...@yahoo.com
> To: beagl...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages