diff options
author | Christian Starkjohann <cs+github@obdev.at> | 2008-07-01 15:43:21 +0000 |
---|---|---|
committer | Christian Starkjohann <cs+github@obdev.at> | 2008-07-01 15:43:21 +0000 |
commit | 733dc58a94ac06d124adcd6cbf11a3c97caf10da (patch) | |
tree | 5bebb00a301a334e83b364f49acface6a1380f48 | |
parent | 5280c7cda766ba100065de82407e8414d13e8e9f (diff) | |
download | v-usb-733dc58a94ac06d124adcd6cbf11a3c97caf10da.tar.gz v-usb-733dc58a94ac06d124adcd6cbf11a3c97caf10da.tar.bz2 v-usb-733dc58a94ac06d124adcd6cbf11a3c97caf10da.zip |
- Fixed bug in long transfer configuration
-rw-r--r-- | usbdrv/Changelog.txt | 2 | ||||
-rw-r--r-- | usbdrv/usbdrv.c | 8 |
2 files changed, 8 insertions, 2 deletions
diff --git a/usbdrv/Changelog.txt b/usbdrv/Changelog.txt index 6a1348a..6040739 100644 --- a/usbdrv/Changelog.txt +++ b/usbdrv/Changelog.txt @@ -239,3 +239,5 @@ Scroll down to the bottom to see the most recent changes. - Added usbconfig.h option "USB_CFG_CHECK_DATA_TOGGLING". - New header "usbportability.h" prepares ports to other development environments. + - Long transfers (above 254 bytes) did not work when usbFunctionRead() was + used to supply the data. Fixed this bug. [Thanks to Alexander Neumann!] diff --git a/usbdrv/usbdrv.c b/usbdrv/usbdrv.c index 4917078..e6c8c19 100644 --- a/usbdrv/usbdrv.c +++ b/usbdrv/usbdrv.c @@ -449,9 +449,13 @@ usbRequest_t *rq = (void *)data; } #if USB_CFG_IMPLEMENT_FN_READ || USB_CFG_IMPLEMENT_FN_WRITE if(replyLen == USB_NO_MSG){ /* use user-supplied read/write function */ - /* do some conditioning on replyLen */ + /* do some conditioning on replyLen, but on IN transfers only */ if((rq->bmRequestType & USBRQ_DIR_MASK) != USBRQ_DIR_HOST_TO_DEVICE){ - replyLen = rq->wLength.bytes[0]; /* IN transfers only */ + if(sizeof(replyLen) < sizeof(rq->wLength.word)){ /* help compiler with optimizing */ + replyLen = rq->wLength.bytes[0]; + }else{ + replyLen = rq->wLength.word; + } } usbMsgFlags = USB_FLG_USE_USER_RW; }else /* The 'else' prevents that we limit a replyLen of USB_NO_MSG to the maximum transfer len. */ |