title: USB linux gadget zero driver communicate with Windows host
body: <p>I need to set up USB communication between a Windows 7 host and a Linux device for data transfer.  I was able to compile the Linux kernel on the device to include the Gadget Zero driver in the kernel (not as a loadable module - Linux version 3.0.15).  My project has some requirements, which also explains why I chose Gadget Zero:</p>
  
  <p>1) On the Windows 7 host, a kernel mode driver must be used to communicate over the USB connection for sending and receiving bulk data. (speed is not important, not a lot of data at once).</p>
  
  <p>2) On the linux device, no requirements on USB side except send and receive data easily over USB link.  The data received will eventually be "unmarshalled" to call functions in another kernel module (and those responses packaged and sent back to the host).</p>
  
  <p>3) Multiple linux devices will be connected to the host, so need easy way to enumerate connected devices and communicate with them.</p>
  
  <p>So due to the requirements, I decided against the Gadget Serial.  I'm having serious issues sending and receiving data over the virtual COM port in kernel mode (KMDF) in Win 7 host. WinUSB does not seem to want to open my attached device (I'm using KMDF windows USB driver from template in VS2012)  Also, the gadget serial driver on the linux side, I cannot find the functions where the data is received and sent.  Plus, any received data on the linux device seems to be echoed back to the host for some reason. (and to test this, I wrote a simple user-mode app in Windows, which is a no-no for my project).</p>
  
  <p>Gadget Zero, it appears much simpler on the linux side.  I can plug the USB cable to the Win7 host, and I can get the device to appear in the device manager.  However, again I am having problems with getting communication going over the link.  Gadget Zero has 2 bulk endpoints, so this shouldn't be an issue.  Surely, someone has made data communication possible between a Windows host and a linux device using Gadget Zero?  With Gadget Zero, it should be easy to enumerate the connected linux devices and communicate with them.</p>
  
  <p>The trick is to keep the Windows side communication in kernel mode.  Can someone point me in the right direction perhaps with Gadget Zero, Windows 7 KMDF, and some sample source code? I have a hard time believing no one has done this before because my internet searches don't turn up much. (and mostly user-mode solutions with Gadget Serial).</p>
  
  <p>Thanks!</p>