Skip to content

Commit

Permalink
usb buffer increased
Browse files Browse the repository at this point in the history
  • Loading branch information
buldo committed Jan 7, 2024
1 parent b37bfea commit 6128d33
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/Rtl8812auNet.ConsoleDemo/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ static void Main(string[] args)
{
ChannelWidth = ChannelWidth.CHANNEL_WIDTH_20,
ChannelOffset = 0,
Channel = 140,
Channel = 149,
//Channel = 36
});

Expand Down
2 changes: 1 addition & 1 deletion src/Rtl8812auNet/LibUsbDotNet/LibUsbRtlUsbDevice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public void SetBulkDataHandler(BulkDataHandler handler)

public void InfinityRead()
{
var readBuffer = new byte[8192 + 1024];
var readBuffer = new byte[32768];
while (true)
{
try
Expand Down
9 changes: 3 additions & 6 deletions src/Rtl8812auNet/Rtl8812au/FrameParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ public List<ParsedRadioPacket> ParsedRadioPacket(ReadOnlySpan<byte> usbTransfer)

private List<(rx_pkt_attrib RxAtrib, byte[] Data)> recvbuf2recvframe(ReadOnlySpan<byte> ptr)
{
var transfer_len = ptr.Length;
var pbuf = ptr;
var pkt_cnt = GET_RX_STATUS_DESC_USB_AGG_PKTNUM_8812(pbuf);
_logger.LogInformation($"pkt_cnt == {pkt_cnt}");
Expand All @@ -46,11 +45,11 @@ public List<ParsedRadioPacket> ParsedRadioPacket(ReadOnlySpan<byte> usbTransfer)

var pkt_offset = RXDESC_SIZE + pattrib.drvinfo_sz + pattrib.shift_sz + pattrib.pkt_len; // this is offset for next package

if ((pattrib.pkt_len <= 0) || (pkt_offset > transfer_len))
if ((pattrib.pkt_len <= 0) || (pkt_offset > pbuf.Length))
{
_logger.LogWarning(
"RX Warning!,pkt_len <= 0 or pkt_offset > transfer_len; pkt_len: {pkt_len}, pkt_offset: {pkt_offset}, transfer_len: {transfer_len}",
pattrib.pkt_len, pkt_offset, transfer_len);
pattrib.pkt_len, pkt_offset, pbuf.Length);
break;
}

Expand Down Expand Up @@ -98,9 +97,7 @@ public List<ParsedRadioPacket> ParsedRadioPacket(ReadOnlySpan<byte> usbTransfer)
break;
}
pbuf = pbuf.Slice(pkt_offset);

transfer_len -= pkt_offset;
} while (transfer_len > 0);
} while (pbuf.Length > 0);

//if (pkt_cnt != 0)
//{
Expand Down

0 comments on commit 6128d33

Please sign in to comment.