From 6128d334d9c91eb224e3b745c43f7a8da3d60f07 Mon Sep 17 00:00:00 2001 From: Roman Buldygin Date: Sun, 7 Jan 2024 22:52:39 +0300 Subject: [PATCH] usb buffer increased --- src/Rtl8812auNet.ConsoleDemo/Program.cs | 2 +- src/Rtl8812auNet/LibUsbDotNet/LibUsbRtlUsbDevice.cs | 2 +- src/Rtl8812auNet/Rtl8812au/FrameParser.cs | 9 +++------ 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/Rtl8812auNet.ConsoleDemo/Program.cs b/src/Rtl8812auNet.ConsoleDemo/Program.cs index 6f680e6..690bf52 100644 --- a/src/Rtl8812auNet.ConsoleDemo/Program.cs +++ b/src/Rtl8812auNet.ConsoleDemo/Program.cs @@ -26,7 +26,7 @@ static void Main(string[] args) { ChannelWidth = ChannelWidth.CHANNEL_WIDTH_20, ChannelOffset = 0, - Channel = 140, + Channel = 149, //Channel = 36 }); diff --git a/src/Rtl8812auNet/LibUsbDotNet/LibUsbRtlUsbDevice.cs b/src/Rtl8812auNet/LibUsbDotNet/LibUsbRtlUsbDevice.cs index 17c5441..909c1b9 100644 --- a/src/Rtl8812auNet/LibUsbDotNet/LibUsbRtlUsbDevice.cs +++ b/src/Rtl8812auNet/LibUsbDotNet/LibUsbRtlUsbDevice.cs @@ -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 diff --git a/src/Rtl8812auNet/Rtl8812au/FrameParser.cs b/src/Rtl8812auNet/Rtl8812au/FrameParser.cs index 077570e..94d0284 100644 --- a/src/Rtl8812auNet/Rtl8812au/FrameParser.cs +++ b/src/Rtl8812auNet/Rtl8812au/FrameParser.cs @@ -27,7 +27,6 @@ public List ParsedRadioPacket(ReadOnlySpan usbTransfer) private List<(rx_pkt_attrib RxAtrib, byte[] Data)> recvbuf2recvframe(ReadOnlySpan 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}"); @@ -46,11 +45,11 @@ public List ParsedRadioPacket(ReadOnlySpan 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; } @@ -98,9 +97,7 @@ public List ParsedRadioPacket(ReadOnlySpan usbTransfer) break; } pbuf = pbuf.Slice(pkt_offset); - - transfer_len -= pkt_offset; - } while (transfer_len > 0); + } while (pbuf.Length > 0); //if (pkt_cnt != 0) //{