Respect the transfer direction. Control transfers with buffers work in both directions now.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17643 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
7f20062d97
commit
d30ac125dd
@ -349,13 +349,14 @@ Queue::AddRequest(Transfer *transfer, bigtime_t timeout)
|
|||||||
int32 packetSize = pipe->MaxPacketSize();
|
int32 packetSize = pipe->MaxPacketSize();
|
||||||
int32 bufferLength = transfer->BufferLength();
|
int32 bufferLength = transfer->BufferLength();
|
||||||
int32 descriptorCount = (bufferLength + packetSize - 1) / packetSize;
|
int32 descriptorCount = (bufferLength + packetSize - 1) / packetSize;
|
||||||
|
uint8 *buffer = (uint8 *)transfer->Buffer();
|
||||||
|
|
||||||
bool dataToggle = true;
|
bool dataToggle = true;
|
||||||
uhci_td *lastDescriptor = NULL;
|
uhci_td *lastDescriptor = NULL;
|
||||||
for (int32 i = 0; i < descriptorCount; i++) {
|
for (int32 i = 0; i < descriptorCount; i++) {
|
||||||
uhci_td *descriptor = new_descriptor(fStack, pipe,
|
uhci_td *descriptor = new_descriptor(fStack, pipe,
|
||||||
directionIn ? TD_TOKEN_IN : TD_TOKEN_OUT,
|
directionIn ? TD_TOKEN_IN : TD_TOKEN_OUT,
|
||||||
min_c(packetSize, bufferLength), NULL);
|
min_c(packetSize, bufferLength), directionIn ? NULL : buffer);
|
||||||
|
|
||||||
if (!descriptor) {
|
if (!descriptor) {
|
||||||
free_descriptor_chain(setupDescriptor, fStack);
|
free_descriptor_chain(setupDescriptor, fStack);
|
||||||
@ -375,6 +376,9 @@ Queue::AddRequest(Transfer *transfer, bigtime_t timeout)
|
|||||||
lastDescriptor = descriptor;
|
lastDescriptor = descriptor;
|
||||||
bufferLength -= packetSize;
|
bufferLength -= packetSize;
|
||||||
dataToggle = !dataToggle;
|
dataToggle = !dataToggle;
|
||||||
|
|
||||||
|
if (!directionIn)
|
||||||
|
buffer += packetSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
link_descriptors(lastDescriptor, statusDescriptor);
|
link_descriptors(lastDescriptor, statusDescriptor);
|
||||||
@ -415,14 +419,24 @@ Queue::AddRequest(Transfer *transfer, bigtime_t timeout)
|
|||||||
// without any error so we finished successfully
|
// without any error so we finished successfully
|
||||||
TRACE(("usb_uhci: transfer successful\n"));
|
TRACE(("usb_uhci: transfer successful\n"));
|
||||||
|
|
||||||
uint8 *buffer = (uint8 *)transfer->Buffer();
|
if (!directionIn)
|
||||||
|
return B_OK;
|
||||||
|
|
||||||
int32 bufferSize = transfer->BufferLength();
|
int32 bufferSize = transfer->BufferLength();
|
||||||
size_t *actualLength = transfer->ActualLength();
|
if (bufferSize == 0)
|
||||||
if (buffer && bufferSize > 0) {
|
return B_OK;
|
||||||
*actualLength = read_descriptor_chain(
|
|
||||||
|
uint8 *buffer = (uint8 *)transfer->Buffer();
|
||||||
|
if (!buffer)
|
||||||
|
return B_ERROR;
|
||||||
|
|
||||||
|
size_t length = read_descriptor_chain(
|
||||||
(uhci_td *)setupDescriptor->link_log,
|
(uhci_td *)setupDescriptor->link_log,
|
||||||
buffer, bufferSize);
|
buffer, bufferSize);
|
||||||
}
|
|
||||||
|
size_t *actualLength = transfer->ActualLength();
|
||||||
|
if (actualLength)
|
||||||
|
*actualLength = length;
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user