EOVERFLOW problem with usb_control_msg

Frank Kingswood <[email protected]>
Newsgroups gmane.linux.usb.devel
Message-ID <[email protected]>
Hallo!

I am trying to develop a kernel module for the CH341 USB-to-serial 
adaptor. I have working libusb code which sets up the device, but am 
having problems repeating this in the kernel.

The first control message that reads data from the device returns with 
-EOVERFLOW, which the documentation describes as the USB device 
babbling. There is no data on the bus, however.

I have tried tracing through the code in usb_control_msg (down to 
wait_for_completion_timeout) but don't see this error value being
generated.

My kernel code goes something like this (heavily snipped):

static struct usb_driver ch341_driver = {
	.name		= "ch341",
	.probe		= usb_serial_probe,
	.disconnect	= usb_serial_disconnect,
	.id_table	= id_table,
	.no_dynamic_id	= 1,
};

static struct usb_serial_driver ch341_device = {
   ...snip...
	.open             = ch341_open,
	.attach           = ch341_attach,
};

static int ch341_attach(struct usb_serial *serial)
{	...snip...

	r = ch341_configure(serial->dev, priv);
	if (r)
		return r;

	usb_set_serial_port_data(serial->port[0], priv);
	return 0;
}

int ch341_configure(struct usb_device *dev, struct ch341_private *priv)
{	...snip buffer allocation (1KB for testing)...
	/* expect two bytes 0x27 0x00 */
	r=ch341_control_in(dev, 0x5f, 0, 0, buffer, size);
	...snip...
}

static int ch341_control_in(struct usb_device *dev,
			    u8 request, u16 value, u16 index,
			    char *buf, unsigned bufsize)
{
	int r;
	r = usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
			request,
			USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN,
			value, index, buf, bufsize, 10000);
	return r;
}

If anyone can give me pointers where to look that would be much appreciated.

Regards,

Frank Kingswood


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.