调整升级流程
This commit is contained in:
parent
c1d2196656
commit
54bc87c119
|
@ -242,17 +242,17 @@ void hg_scanner_306::thread_handle_usb_read(void)
|
||||||
}
|
}
|
||||||
if (ret == SCANNER_ERR_OK && usb.u32_Count > 0)
|
if (ret == SCANNER_ERR_OK && usb.u32_Count > 0)
|
||||||
{
|
{
|
||||||
|
if (!savestatus_.empty())
|
||||||
if (firmware_sup_device_7010)
|
|
||||||
{
|
{
|
||||||
ret = get_img_data_7010();
|
break;
|
||||||
sw.reset();
|
}
|
||||||
if (ret != SCANNER_ERR_OK)
|
|
||||||
{
|
ret = get_img_data_7010();
|
||||||
status_ = ret;
|
sw.reset();
|
||||||
break;
|
if (ret != SCANNER_ERR_OK)
|
||||||
}
|
{
|
||||||
continue;
|
status_ = ret;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this_thread::sleep_for(chrono::milliseconds(10));
|
this_thread::sleep_for(chrono::milliseconds(10));
|
||||||
|
@ -1259,7 +1259,9 @@ int hg_scanner_306::set_firmware_upgrade(std::string str)
|
||||||
}
|
}
|
||||||
USBCB update = { setting3288dsp::START_UPGRADE,0,total };
|
USBCB update = { setting3288dsp::START_UPGRADE,0,total };
|
||||||
len = sizeof(update);
|
len = sizeof(update);
|
||||||
|
io_->write_bulk(&update, &len);
|
||||||
|
|
||||||
|
int indx = 0;
|
||||||
while (total > 0)
|
while (total > 0)
|
||||||
{
|
{
|
||||||
memset(sendbuf, 0, block);
|
memset(sendbuf, 0, block);
|
||||||
|
@ -1268,22 +1270,26 @@ int hg_scanner_306::set_firmware_upgrade(std::string str)
|
||||||
{
|
{
|
||||||
block = total;
|
block = total;
|
||||||
}
|
}
|
||||||
io_->write_bulk(&update, &len);//数据分段写,每次都要先告诉下面?
|
|
||||||
|
|
||||||
filename.read(sendbuf, block);
|
filename.read(sendbuf + indx, block);
|
||||||
|
|
||||||
//size_t pos = filename.tellg();
|
io_->write_bulk(sendbuf + indx,&block);
|
||||||
|
|
||||||
io_->write_bulk(sendbuf,&block);
|
//ret = io_->read_bulk(&update, &len);
|
||||||
|
|
||||||
ret = io_->read_bulk(&update, &len);
|
|
||||||
if (ret != SCANNER_ERR_OK)
|
if (ret != SCANNER_ERR_OK)
|
||||||
{
|
{
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
total -= block;
|
total -= block;
|
||||||
|
indx += block;
|
||||||
this_thread::sleep_for(std::chrono::milliseconds(10));
|
this_thread::sleep_for(std::chrono::milliseconds(10));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ret = io_->read_bulk(&update, &len);
|
||||||
|
if (update.u32_Count == 10)
|
||||||
|
{
|
||||||
|
return SCANNER_ERR_DEVICE_UPGRADE_FAIL;
|
||||||
|
}
|
||||||
if (sendbuf)
|
if (sendbuf)
|
||||||
{
|
{
|
||||||
delete[]sendbuf;
|
delete[]sendbuf;
|
||||||
|
|
Loading…
Reference in New Issue