title: Linux device descriptor read/64, error 18
body: <p>I'm writing a device-side USB driver that uses the USB module on a Freescale Kinetis K20 ARM Cortex-M4 processor. On the host side I am running Arch on an x64 processor.</p>
  
  <p>The issue I am having is that I cannot seem to get linux to read the descriptor of my device. My device has one configuration with one interface and no endpoints (just the control). My device descriptor looks like so:</p>
  
  <pre><code>typedef struct {
      uint8_t bLength;
      uint8_t bDescriptorType;
      uint16_t bcdUSB;
      uint8_t bDeviceClass;
      uint8_t bDeviceSubClass;
      uint8_t bDeviceProtocol;
      uint8_t bMaxPacketSize0;
      uint16_t idVendor;
      uint16_t idProduct;
      uint16_t bcdDevice;
      uint8_t iManufacturer;
      uint8_t iProduct;
      uint8_t iSerialNumber;
      uint8_t bNumConfigurations;
  } dev_descriptor_t;
  
  static const dev_descriptor_t dev_descriptor = {
      .bLength = 18,
      .bDescriptorType = 1,
      .bcdUSB = 0x0100,
      .bDeviceClass = 0xff,
      .bDeviceSubClass = 0x0,
      .bDeviceProtocol = 0x0,
      .bMaxPacketSize0 = ENDP0_SIZE,
      .idVendor = 0x16c0,
      .idProduct = 0x05dc,
      .bcdDevice = 0x0001,
      .iManufacturer = 0,
      .iProduct = 0,
      .iSerialNumber = 0,
      .bNumConfigurations = 1
  };
  </code></pre>
  
  <p>Assuming the processor reads the bytes starting at bLength I would think this descriptor would work (I have corresponding configuration and interface descriptors, but it isn't even getting that far).</p>
  
  <p>The errors I get is as follows:</p>
  
  <pre><code>usb 4-1.4: device descriptor read/64, error 18
  ...repeated 4 times
  usb 4-1.4: device descriptor read/8, error -75
  ..repeated 4 times
  usb 4-1-port4: unable to enumerate USB device
  </code></pre>
  
  <p>I've managed to find a list of error codes and -75 is EOVERFLOW which makes sense since my descriptor wouldn't fit inside an 8 byte read. The one that really confuses me is error 18.</p>
  
  <p><strong>My Question</strong>:</p>
  
  <p>What is error 18 and what causes it?</p>
  
  <p>Just to be clear: My question isn't about getting the USB module to work on a Kinetis microcontroller (although any hints and experience would be appreciated)...its about finding out what this error code means and diagnosing the problem that causes it.</p>
  
  <p>Error -18 (note the negative) is EXDEV (Cross-link device) which makes no sense to me because I don't know what it means.</p>
  
  <hr>
  
  <p><strong>Note 1</strong></p>
  
  <p>I know that there isn't a hardware issue with the USB module since the microcontroller is part of a <a href="https://www.pjrc.com/teensy/teensy31.html" rel="nofollow">Teensy 3.1</a> board and I have used its USB module in past projects, but using the provided driver that comes with the accompanying Teensyduino library. I'm writing my own to understand the module better.</p>
  
  <p><strong>Note 2</strong></p>
  
  <p>If its helpful to know, the microcontroller is receiving the command to be assigned an address and seems to respond correctly (i.e. no "not accepting address" errors in my log...I already worked through those). Other than that and the get descriptor command, it doesn't seem to be receiving any additional commands.</p>