Am Dienstag, 24. April 2007 12:06 schrieb Wael Adel: > On 4/24/07, Oliver Neukum <[EMAIL PROTECTED]> wrote: > > Am Dienstag, 24. April 2007 11:46 schrieb Wael Adel: > > > retval = usb_submit_urb(urb, GFP_KERNEL); > > > if (retval) { > > > err("%s - failed submitting write urb, error %d", > > __FUNCTION__, retval); > > > goto error; > > > } > > > > > > if (buf != NULL) > > > { > > > if (copy_to_user(user_buffer, buf , readsize)) > > > { > > > retval = -EFAULT; > > > goto error; > > > } > > > } > > > > You are copying the the buffer to user space without waiting for the > > URB to be executed. That cannot work. > > so how can i wait for the urb to be executed then copying the data to > the user space? > is there a flag that i should loop on it or what?
- init an instance of "struct completion" - submit the URB, passing a pointer to the struct completion - use wait_for_completion() - in the completion handler call complete() HTH Oliver -- SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg) This signature is a legal requirement ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ linux-usb-devel@lists.sourceforge.net To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel