From 733dc58a94ac06d124adcd6cbf11a3c97caf10da Mon Sep 17 00:00:00 2001 From: Christian Starkjohann Date: Tue, 1 Jul 2008 15:43:21 +0000 Subject: - Fixed bug in long transfer configuration --- usbdrv/Changelog.txt | 2 ++ 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. */ -- cgit v1.2.3