From 34d854cc564787ba47516e177bb8dcaff1243a63 Mon Sep 17 00:00:00 2001 From: yangjiaxuan <171295266@qq.com> Date: Mon, 9 Oct 2023 11:11:10 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4G300=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=E5=AF=BC=E5=87=BA=E8=AE=BE=E5=A4=87=E6=97=A5=E5=BF=97=E8=B6=85?= =?UTF-8?q?=E6=97=B6=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hgdriver/hgdev/hg_scanner_300.cpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/hgdriver/hgdev/hg_scanner_300.cpp b/hgdriver/hgdev/hg_scanner_300.cpp index d56d73d..1b89d0b 100644 --- a/hgdriver/hgdev/hg_scanner_300.cpp +++ b/hgdriver/hgdev/hg_scanner_300.cpp @@ -1263,21 +1263,21 @@ int hg_scanner_300::get_device_log(string &log) } str.resize(total); str2.resize(total); - ret = io_->read_bulk(&str[index], &block); - //while (ret == SCANNER_ERR_TIMEOUT) ///设备代码是进行了第二?write 条件是len > 0 如果出现问题这个地方需要打开 - //{ - // block = 1024 * 1024; - // if (total < block) - // { - // block = total; - // } - // ret = io_->read_bulk(&str2[index], &block); - // //if (ret != SCANNER_ERR_OK) - // //return ret; + //ret = io_->read_bulk(&str[index], &block);//Reading too much data at once can cause error(TIME_OUT), it requires segmented reading. 2023-10-9 + while (total) + { + block = 1024 * 1024; + if (total < block) + { + block = total; + } + ret = io_->read_bulk(&str[index], &block); + if (ret != SCANNER_ERR_OK) + return ret; - // index += block; - // total -= block; - //} + index += block; + total -= block; + } } if (ret != SCANNER_ERR_OK)