Skip to content

Commit

Permalink
Populate initial packet length in ISOCH OUT URB
Browse files Browse the repository at this point in the history
daynix#66
According to interface definition, the UsbDk shall return
actual length on transfer completion. For isoch OUT transfers
the controller does not return it on respective URB field on
Win10 and the updated WDK documentation states this field is
not used for ISOCH OUT transfers. Current commit populates
the initial packet length in the URB, making the result
consistent on both Win7 and Win10.

Signed-off-by: Yuri Benditovich <[email protected]>
  • Loading branch information
ybendito authored and YanVugenfirer committed Jan 29, 2019
1 parent 9ebf772 commit 46c80ba
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions UsbDk/Urb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,16 @@ NTSTATUS CIsochronousUrb::Create(Direction TransferDirection, PVOID TransferBuff

m_Urb->UrbIsochronousTransfer.TransferBuffer = TransferBuffer;
m_Urb->UrbIsochronousTransfer.NumberOfPackets = static_cast<ULONG>(NumberOfPackets);

if (TransferDirection == URB_DIRECTION_OUT)
{
// initialize Length with initial packet length
// USB controller driver may override it (Win7)
for (size_t i = 0; i < NumberOfPackets; i++)
{
m_Urb->UrbIsochronousTransfer.IsoPacket[i].Length = static_cast<ULONG>(PacketSizes[i]);
}
}

return FillOffsetsArray(NumberOfPackets, PacketSizes, TransferBufferSize);
}

0 comments on commit 46c80ba

Please sign in to comment.