Well for starters, this is where you should use the
usb_bulk_msg() call ... don't do async submits and
then expect that anything except the competion
callback will give you the data. When your I/O model
is synchronous, use the standard synchronous calls.
I'd be rather surprised if the problem is anywhere
except in your driver, and that idiom (as well as
any CPU-specific notion of "WORD" size :) looks
rather suspicious.
- Dave
----- Original Message -----
From: "Angderson, Charyll" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: "Angderson, Charyll" <[EMAIL PROTECTED]>
Sent: Friday, December 21, 2001 9:43 AM
Subject: [linux-usb-devel] bulk read xfers returns wrong data
> i expect that the bulk data read on the wire would be the same data in
> "buf". i see different data on the wire than that returned by "buf" 50% of
> the time.
>
> isoc reads seem to be consistent. and both isoc/bulk writes are correct. i
> only have one "buf". i've tried making "buf" a static pointer: static WORD
> * buf; and when ever user wants to do transfers i have to read the "size"
> they pass in and do a "kmalloc" for "buf". after each transaction "buf" is
> freed. but definitely not until transaction is done.
>
> i even have a print statement right after transaction completes (see below)
> and it proves that "buf" is bad.
>
> anyone have any ideas? snippet of my code is below.
>
> did i put unlinking in the right place..it only unlinks if there was a
> status error. is there a problem with unlinking w/o a status error? or is
> this something i should always do?
>
> in the future, i will not do this callback. i will just keep doing
> submit_trans, but i didn't know how to make sure everything was completed?
> can someone tell me?
>
> thanks,
> -charyll angderson
>
> #define WORD unsigned short int //2 bytes
> int usbx_submit_trans(struct usbxDevice *usbxPtr, struct usb_device *dev,
> struct _Transaction *trans, WORD *buf)
> {
> int i,j,k;
> usbx_show_trans(trans);
>
> switch(trans->type) {
> case USBX_R_BULK:
> FILL_BULK_URB(usbxPtr->usbx_urb, dev, usb_rcvbulkpipe(dev,
> trans->endpoint),
> buf, trans->size, usbx_urb_complete, usbxPtr);
> break;
> default:
> dbg("invaid trans type!");
> break;
> }
>
> usbx_submit_urb(usbxPtr->usbx_urb);
> interruptible_sleep_on_timeout(&(usbxPtr->wait), trans->timeout);
>
> if (usbxPtr->usbx_urb->status!=0) {
> err("TIMEOUT awoken %i (%s)
> status=0x%x",current->pid,current->comm,usbxPtr->usbx_urb->status); //ca
> debug
> usbx_unlink_urb(usbxPtr->usbx_urb); // remove urb safely
> }
>
> switch (trans->type) {
> case USBX_R_BULK:
> dbg("usbx_submit_trans: print buffer read ..
> address=0x%lx", (DWORD)&buf);
> for (i=0; i<(trans->size/2); i++) {
> dbg(" %x ",(WORD)buf[i]);
> }
> break;
> default:
> break;
> }
>
> return usbxPtr->usbx_urb->status;
> }
>
>
> _______________________________________________
> [EMAIL PROTECTED]
> To unsubscribe, use the last form field at:
> https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel