Hi,
I am just writing a Linux driver for one of
our products (based on a 8051 controller with
integrated USB core).
I am using Linux 2.6.11.
The driver is not used only to talk to the
controller, but even the firmware for the controller
gets uploaded from the driver during start-up.
Normally the device get found on the USB bus with
PID_1. Then the driver uploads the firmware into the
device and the device reenumerates on the USB bus.
Afterwards the driver finds the device with PID_2.
This works without any problems.
An problem occurs, when I unload the kernel module
(after booting the device) and reload it afterwards
(without disconnecting the device).
In this case the driver will find the device with
PID_2, because it is already booted (this should not
be problem).
When the driver sends a bulk transfer (1 byte) to
the device and tries to read back the result of the
command as a second bulk transfer (1 byte), this
second transfer hangs in 99% of all cases (till
the timeout expires).
===================================================
/* allocate buffer */
buf = kmalloc (1001, GFP_KERNEL);
if (buf == NULL)
{
printk ("%s: Failed to allocate memory.\n",
TELOSI2C_MODULE_NAME);
return (-ENOMEM);
}
/* send reset command to reset endpoint */
buf[0] = 1;
ret = usb_bulk_msg (dev->udev,
usb_sndbulkpipe (dev->udev, dev->ep_reset_out),
buf, 1, &tmp, msecs_to_jiffies (3 * 1000));
if (ret < 0)
{
kfree (buf);
return (ret);
}
do
{
/* read result of reset command from reset endpoint */
ret = usb_bulk_msg (dev->udev,
usb_rcvbulkpipe (dev->udev, dev->ep_reset_in),
buf, 1, &tmp, msecs_to_jiffies (3 * 1000));
--- this call blocks ---
===================================================
What can cause this problem? The same device works under Windows
without these problems.
cu, Marco
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_idt77&alloc_id492&op=click
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel