title: USB Setup requests differ coming from linux host or windows host
body: <p>I am running this (<a href="http://www.linux-usb.org/gadget/usb.c" rel="nofollow">http://www.linux-usb.org/gadget/usb.c</a>) Gadget FS user mode driver on an embedded device.</p>
  
  <p>When I connect it to Windows, these are the <code>GET_DESCRIPTOR</code> setup requests I receive:
  80 06 03 03 09 04 ff 00 
  80 06 00 03 00 00 ff 00 
  80 06 02 03 09 04 ff 00 
  80 06 03 03 09 04 ff 00 
  80 06 00 03 00 00 ff 00 
  80 06 02 03 09 04 ff 00 </p>
  
  <pre><code>`bmRequestType`: 0x80 Device-to-host transfer direction
  `bRequest`: 0x06 GET_DESCRIPTOR
  `wValueH` : 0x03 Descriptor Type 'String'
  `wValueL` : Descriptor Index
  `wIndex` : 0x04 0x09 Language ID "US-English" for Descriptor Types "String", 0x00 for others
  `wLength` : Length of the requested descriptor
  </code></pre>
  
  <p>These are the setup requests coming from the Linux host when i connect the device.
  80 06 00 03 00 00 ff 00 
  80 06 02 03 09 04 ff 00 
  80 06 01 03 09 04 ff 00 
  80 06 03 03 09 04 ff 00 
  80 06 ee 03 00 00 00 04 </p>
  
  <p>The last one makes my GadgetFS implementation STALL. The Descriptor Type is 3, meaning a Descriptor of type "String" is requested but in <code>wIndex</code> no Language ID is provided (0x00 0x00). Also, the Descriptor Index is 0xEE, but why would you have 238 String Descriptors for a device?
  Notice also the length of the requested descriptor: 0x0400 (1024).</p>
  
  <p>This is a code excerpt from the driver implementation I use (linux-usb.org) that handles the setup requests:</p>
  
  <pre><code>case USB_REQ_GET_DESCRIPTOR:     //0x06         
          if (setup-&gt;bRequestType != USB_DIR_IN) //USB_DIR_IN = 0x80
              goto stall;
          switch (value &gt;&gt; 8) // wValueH: Descriptor Type
          {
          case USB_DT_STRING: // 0x03 Type = "String"
              {           
                  tmp = value &amp; 0x0ff; // wValueL : Descriptor Index
  
                  struct usb_gadget_strings strings = {
                      0x0409,     /* "en-us" */
                      m_aUsbStringtab
                  };
  
                  index = 0x0409
                  if (tmp != 0 &amp;&amp; index != strings.language) //This makes it STALL when connected to a linux 
                      goto stall;
  </code></pre>
  
  <p>I'd really appreciate it, if someone could help me!</p>