On Fri, 19 Feb 2010, FEI YANG wrote: > Now if I do terminate the pending IN URB before calling > usb_autopm_put_interface, the same situation would still occur as the > driver doesn't really know if it's in the middle of an IN transfer or > not. However, comparing to the implementation mentioned above, I did > notice some difference. usb_kill_urb sometimes gives back the URB with > urb->actual_length equals to a number that is not integer multiple of > 512, this has never happened if the URB is terminated only by > usb_hcd_flush_endpoint. So I'm confused if we really need to > 1. call usb_kill_urb before calling usb_autopm_put_interface? > 2. if yes to 1, why sometimes the actual_length is not multiple of > 512, and how should we handle it. Question 2 is the important one. actual_length should always be a multiple of 512. The value is computed in the first few lines of qtd_copy_status() in drivers/usb/host/ehci-q.c. You could print out the values of urb->actual_length, length, and QTD_LENGTH(token) at that point to see what's going wrong. Alan Stern -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html