On Fri, 23 Dec 2005, Guennadi Liakhovetski wrote:
[Full quote since the discussion is a bit old]
This is odd though. The device reset in zdusb.c probably isn't working
properly on your machine. Perhaps 2.6 doesn't like
usb_lock_device_for_reset/usb_unlock_device missing. Could anyone create a
patch? (I don't run 2.6 here)
No. I think, reset in disconnect doesn't make any sense at all. I just
removed it and tested - of course, nothing bad heppens, as it anyway
didn't have any effect due to wrong state.
The reset was introduced because of
. At least at that time this made sense. However, it may be possible
that for example changes in the stick's firmware made the reset
Ok, I see. Interesting. On one my PC - where I normally use zd1211 I got
the same message in the log "reset not allowed in state 0" and rmmod +
modprobe indeed don't work without replugging the device. Whereas on the
other PC rmmod produces "resetting device..." and everything is fine.
Moving the reset early in probe seems to work on both machines. Patch
below. Would be good if people seeing "reset not allowed in state 0" on
rmmod could test it (re-adding Fernando to CC:).
I just found out this change seems to cause kernel panics here.
Kernel 2.4.32, driver loaded by hotplug. The panic is due to a null
pointer dereference in the hotplug process. If I revert the change
everything seems to be fine. It seems moving the reset to initialization
confuses hotplug's data structures.
I'll move the reset code to zd1211_disconnect again if there are no
--- a/src/zdusb.c (revision 48)
+++ b/src/zdusb.c (working copy)
@@ -102,6 +102,7 @@
struct usb_device *dev = interface_to_usbdev(interface);
+ int locked;
struct net_device *net = NULL;
@@ -152,8 +153,24 @@
//usb_string(dev, dev->descriptor.iSerialNumber, serial_number, 29);
//printk("Device serial number is %s\n", serial_number);
+ // The running firmware seems to "block" ep0.
+ // To avoid timeouts during insmod on ep0 and
+ // the inability to subsequently reload the driver properly,
+ // put the device in its initial state.
+ // Since resetting the device is probably a bit crude,
+ // we do it before the device gets to do any useful work.
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
+ locked = usb_lock_device_for_reset(interface_to_usbdev(interface),
+ if (locked >= 0)
+ if (locked > 0)
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
if (usb_set_configuration(dev, dev->config.bConfigurationValue))
printk(KERN_ERR "usb_set_configuration() failed\n");
@@ -371,21 +388,6 @@
- // The running firmware seems to "block" ep0.
- // To avoid timeouts during insmod on ep0 and
- // the inability to subsequently reload the driver properly,
- // put the device in its initial state.
- // Since resetting the device is probably a bit crude,
- // it should only be done after the device has been stopped and
- // all its data structures have been freeed,
- // so the possibility for data corruption is minimal.(hopefully zero)
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
g_dev = NULL;
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
Zd1211-devs mailing list - http://zd1211.ath.cx/