This commit is contained in:
13038267101 2022-12-28 10:34:58 +08:00
commit 866d51f8f5
3 changed files with 31 additions and 13 deletions

View File

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

View File

@ -7,7 +7,7 @@
#include "DlgArea.h" #include "DlgArea.h"
#include "DlgGamma.h" #include "DlgGamma.h"
#include "gb_json.h" #include "gb_json.h"
#include "../../code_device/hgsane/sane_hg_mdw.h" // for
// #pragma comment(linker,"\"/manifestdependency:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"") // #pragma comment(linker,"\"/manifestdependency:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
@ -1080,6 +1080,7 @@ void dlg_page::control_action(HWND wnd)
if (val) if (val)
{ {
SANE_Int after = 0; SANE_Int after = 0;
std::string to_v(hg_sane_middleware::option_value_2_string(type, val));
SANE_Status statu = sane_.sane_control_option_api(dev_, id - dlg_page::dyn_id_base, SANE_ACTION_SET_VALUE, val, &after); SANE_Status statu = sane_.sane_control_option_api(dev_, id - dlg_page::dyn_id_base, SANE_ACTION_SET_VALUE, val, &after);
gb::sane_config_schm* cfg = get_config(); gb::sane_config_schm* cfg = get_config();
done_ = false; done_ = false;
@ -1106,7 +1107,24 @@ void dlg_page::control_action(HWND wnd)
if (len) if (len)
cfg->config_changed(id - dlg_page::dyn_id_base, (char*)val, len); cfg->config_changed(id - dlg_page::dyn_id_base, (char*)val, len);
} }
set_ctrl_value(wnd, type, val, false, !(after || statu)); if (statu == SANE_STATUS_INVAL)
{
std::wstring attr(L"\u6B64\u8BBE\u5907\u4E0D\u652F\u6301\u5C06 \u201C" + local_trans::a2u(sane_.sane_get_option_descriptor_api(dev_, id - dlg_page::dyn_id_base)->title, CP_UTF8) + L"\u201D \u8BBE\u7F6E\u4E3A\uFF1A"),
attr_v(local_trans::a2u(to_v.c_str(), CP_UTF8));
MessageBoxW(hwnd(), (attr + attr_v).c_str(), L"\u53C2\u6570\u9519\u8BEF", MB_OK);
set_ctrl_value(wnd, type, val, true);
}
else
{
std::string tov(hg_sane_middleware::option_value_2_string(type, val));
if (tov != to_v)
{
std::wstring attr(L"\u539F\u53C2\u6570 \u201C" + local_trans::a2u(to_v.c_str(), CP_UTF8) + L"\u201D \u4E0D\u7CBE\u786E\u6216\u8BBE\u5907\u4E0D\u652F\u6301\uFF0C\u5DF2\u8C03\u6574\u4E3A\uFF1A"),
attr_v(local_trans::a2u(tov.c_str(), CP_UTF8));
MessageBoxW(hwnd(), (attr + attr_v).c_str(), L"\u53C2\u6570\u8C03\u6574", MB_OK);
}
set_ctrl_value(wnd, type, val, false, !(after || statu));
}
done_ = true; done_ = true;
if (id == dlg_page::dyn_id_base + id_dpi_) if (id == dlg_page::dyn_id_base + id_dpi_)
{ {
@ -1118,7 +1136,7 @@ void dlg_page::control_action(HWND wnd)
else if (id == dlg_page::dyn_id_base + id_paper_) else if (id == dlg_page::dyn_id_base + id_paper_)
paper_ = local_trans::a2u((char*)val, CP_UTF8); paper_ = local_trans::a2u((char*)val, CP_UTF8);
if (after || statu) if (after || (statu && statu != SANE_STATUS_INVAL))
PostMessage(parent_, WM_REFRESH_OPTION, id - dlg_page::dyn_id_base, 0); PostMessage(parent_, WM_REFRESH_OPTION, id - dlg_page::dyn_id_base, 0);
free_ctrl_value(val); free_ctrl_value(val);
} }

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()); int mem_limit = GetPrivateProfileIntW(L"mem", L"max_img", 0, (cfg_path_ + L"debug.cfg").c_str());
if (mem_limit > 0) if (mem_limit > 0)
{ {
// this value is used for driver usb image queue, here should multiple 5 // this value is same as driver memory limit ...
max_img_mem_ = 5 * mem_limit; max_img_mem_ = mem_limit;
} }
err_ = open(); err_ = open();
} }