Previously, we had to wait to receive another byte to finish the first IRP.
}
/* while buffer is not fully filled */
- while (Length > 0)
+ while (TRUE)
{
/* read already received bytes from buffer */
KeAcquireSpinLock(&DeviceExtension->InputBufferLock, &Irql);
KeClearEvent(&DeviceExtension->InputBufferNotEmpty);
KeReleaseSpinLock(&DeviceExtension->InputBufferLock, Irql);
+ if (Length == 0)
+ {
+ INFO_(SERIAL, "All bytes read\n");
+ break;
+ }
+
if (WorkItemData->DontWait
&& !(WorkItemData->ReadAtLeastOneByte && Information == 0))
{