调整control_transfer失败返回错误码,内存控制与驱动相同

This commit is contained in:
gb 2022-11-26 16:07:52 +08:00
parent fa0eaad4f9
commit d5a5396fb1
2 changed files with 10 additions and 10 deletions

View File

@ -719,14 +719,14 @@ int usb_device::transfer_control(uint8_t type, uint8_t req, uint16_t val, uint16
}
else
{
//io = GetLastError();
//if (io == ERROR_ACCESS_DENIED)
// ret = LIBUSB_ERROR_ACCESS;
//else if (io == ERROR_SEM_TIMEOUT)
// ret = LIBUSB_ERROR_TIMEOUT;
//else
// ret = LIBUSB_ERROR_PIPE;
ret = 0;
io = GetLastError();
if (io == ERROR_ACCESS_DENIED)
ret = LIBUSB_ERROR_ACCESS;
else if (io == ERROR_SEM_TIMEOUT)
ret = LIBUSB_ERROR_TIMEOUT;
else
ret = LIBUSB_ERROR_PIPE;
// ret = 0;
}
oc->release();
}

View File

@ -348,8 +348,8 @@ scanner::scanner(SCANNERID id) : handle_(NULL), id_(id), ex_id_(EXTENSION_ID_BAS
int mem_limit = GetPrivateProfileIntW(L"mem", L"max_img", 0, (cfg_path_ + L"debug.cfg").c_str());
if (mem_limit > 0)
{
// this value is used for driver usb image queue, here should multiple 5
max_img_mem_ = 5 * mem_limit;
// this value is same as driver memory limit ...
max_img_mem_ = mem_limit;
}
err_ = open();
}