USB: Properly set and reset fFragmented for both SetVector and SetData.
Now that we are not setting fFragmented in VectorLength(), we can
reset it in SetVector based purely on the length of the newly set vectors.
We also need to set it in SetData, as SetVector does not call this.
This fixes an oversight in bc7fd43358.
This commit is contained in:
@@ -70,6 +70,8 @@ Transfer::SetData(uint8 *data, size_t dataLength)
|
||||
if (data && dataLength > 0)
|
||||
fVectorCount = 1;
|
||||
|
||||
fFragmented = dataLength > USB_MAX_FRAGMENT_SIZE;
|
||||
|
||||
// Calculate the bandwidth (only if it is not a bulk transfer)
|
||||
if (!(fPipe->Type() & USB_OBJECT_BULK_PIPE)) {
|
||||
if (_CalculateBandwidth() < B_OK)
|
||||
@@ -97,10 +99,7 @@ Transfer::SetVector(iovec *vector, size_t vectorCount)
|
||||
for (size_t i = 0; i < fVectorCount && length < USB_MAX_FRAGMENT_SIZE; i++)
|
||||
length += fVector[i].iov_len;
|
||||
|
||||
if (length > USB_MAX_FRAGMENT_SIZE) {
|
||||
// the data is too large and would overflow the allocator
|
||||
fFragmented = true;
|
||||
}
|
||||
fFragmented = length > USB_MAX_FRAGMENT_SIZE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user