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.
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:
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
};
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).
The errors I get is as follows:
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
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.
My Question:
What is error 18 and what causes it?
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.
Error -18 (note the negative) is EXDEV (Cross-link device) which makes no sense to me because I don't know what it means.
Note 1
I know that there isn't a hardware issue with the USB module since the microcontroller is part of a Teensy 3.1 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.
Note 2
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.