Merge branch 'dev' of http://192.168.10.5:8099/sane/code_device into dev
This commit is contained in:
commit
543a6307fb
|
@ -152,13 +152,13 @@ hg_scanner::hg_scanner(ScannerSerial serial, const char* dev_name, usb_io* io, i
|
|||
, double_paper_handle_(0), keep_watermark_(false), save_feedmode_type_(false), feedmode_(1), sleeptime_(-1), split3399_(0)
|
||||
, async_io_(false), is_white_0_(true), isremove_left_hole(false), isremove_right_hole(false), isremove_top_hole(false), isremove_low_hole(false)
|
||||
, isremove_left_hole_threshold(0), isremove_right_hole_threshold(0), isremove_top_hole_threshold(0), isremove_low_hole_threshold(0)
|
||||
, dump_usb_path_(""), is_kernelsnap_211209_(false), dump_img_(&hg_scanner::dump_image_empty), is_kernelsnap_220830_(false), is_kernelsnap3288_221106_(false)
|
||||
, is_kernelsnap_221027_(false), memory_size_(4000/*USB+JPEG压缩及图像处理图队列,总共1GB*/), isx86_Advan_(true), stop_fatal_(SCANNER_ERR_OK), is_auto_paper_scan(false)
|
||||
, dump_usb_path_(""), is_kernelsnap_239_211209_(false), dump_img_(&hg_scanner::dump_image_empty), is_kernelsnap_239_220830_(false), is_kernelsnap3288_221106_(false)
|
||||
, is_kernelsnap_239_221027_(false), memory_size_(4000/*USB+JPEG压缩及图像处理图队列,总共1GB*/), isx86_Advan_(true), stop_fatal_(SCANNER_ERR_OK), is_auto_paper_scan(false)
|
||||
, size_check(false), save_sleeptime_type_(false), is_kernelsnap_devsislock(false), is_checksum_strat_scan(false), is_cis_image(false)
|
||||
, is_dpi_color_check(false), save_dpi_color_check_val(0.0f), is_auto_falt(false), HGVersion_mgr_(NULL), HGVersion_Init_(NULL)
|
||||
, HGVersion_Islock_(NULL), HGVersion_Postlog_(NULL), HGVersion_Free_(NULL), Dynamicopen_HGVersion_pHandle_(NULL), pid_(pid), fetching_id_(-1)
|
||||
, is_kernelsnap3288_230210_(false), color_correction_(false), is_kernelsnap_3C_cccc(false), is_kernelsnap_220500_(false), is_kernelsnap3288_230303_(false)
|
||||
, is_kernelsnap_211227_(false),is_auto_paper_scan_exit_time(60), is_read_int(true)
|
||||
, is_kernelsnap3288_230210_(false), color_correction_(false), is_kernelsnap_239_3C_(false), is_kernelsnap_239_220500_(false), is_kernelsnap3288_230303_(false)
|
||||
, is_kernelsnap_211227_(false),is_auto_paper_scan_exit_time(60), is_read_int(true), is_kernelsnap_439_3C0606(false)
|
||||
{
|
||||
#if !defined(_WIN32) && !defined(_WIN64) &&defined(x86_64)
|
||||
isx86_Advan_ = false;
|
||||
|
@ -1971,7 +1971,7 @@ int hg_scanner::setting_go_on_when_double_checked(void* data, long* len)
|
|||
|
||||
bool ok = true;
|
||||
std::string val((char*)data);
|
||||
if (!is_kernelsnap_220500_ && val.compare(hg_log::lang_load(ID_OPTION_VALUE_SZTPCL_DQTXBTZSM)))
|
||||
if (!is_kernelsnap_239_220500_ && val.compare(hg_log::lang_load(ID_OPTION_VALUE_SZTPCL_DQTXBTZSM)))
|
||||
{
|
||||
strcpy((char*)data, hg_log::lang_load(ID_OPTION_VALUE_SZTPCL_SCTXBTZSM));
|
||||
notify_ui_working_status(hg_log::lang_load(ID_STATU_DESC_SCANNER_ERR_DEVICE_NOT_SUPPORT), SANE_EVENT_ERROR, SCANNER_ERR_DEVICE_NOT_SUPPORT);
|
||||
|
@ -2287,7 +2287,7 @@ int hg_scanner::setting_auto_pick_paper_threshold(void* data, long* len)
|
|||
int hg_scanner::setting_auto_paper_scan(void* data, long* len)
|
||||
{
|
||||
is_auto_paper_scan = *((bool *)data);
|
||||
if (!is_kernelsnap_220430_ && is_auto_paper_scan)
|
||||
if (!is_kernelsnap_439_220430_ && is_auto_paper_scan)
|
||||
{
|
||||
is_auto_paper_scan = *(bool*)data = false;
|
||||
notify_ui_working_status(hg_log::lang_load(ID_STATU_DESC_SCANNER_ERR_DEVICE_NOT_SUPPORTED), SANE_EVENT_ERROR, SCANNER_ERR_DEVICE_NOT_SUPPORT);
|
||||
|
@ -2351,16 +2351,16 @@ int hg_scanner::setting_fold_type(void* data, long* len)
|
|||
int hg_scanner::setting_color_correction(void* data, long* len)
|
||||
{
|
||||
color_correction_ = *((bool*)data);
|
||||
if (pid_ == 0x239)
|
||||
if (pid_ == 0x239 || pid_ == 0x439)
|
||||
{
|
||||
if (!is_kernelsnap_3C_cccc && color_correction_)
|
||||
if ((!is_kernelsnap_239_3C_ || !is_kernelsnap_439_3C0606) && color_correction_)
|
||||
{
|
||||
notify_ui_working_status(hg_log::lang_load(ID_STATU_DESC_SCANNER_ERR_DEVICE_NOT_SUPPORT), SANE_EVENT_ERROR, SCANNER_ERR_DEVICE_NOT_SUPPORT);
|
||||
*((bool*)data) = color_correction_ = false;
|
||||
return SCANNER_ERR_DEVICE_NOT_SUPPORT;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
return SCANNER_ERR_OK;
|
||||
}
|
||||
int hg_scanner::setting_auto_paper_scan_exit_time(void* data, long* len)
|
||||
{
|
||||
|
@ -4367,12 +4367,18 @@ void hg_scanner::image_process(std::shared_ptr<tiny_buffer>& buffer, uint32_t id
|
|||
(this->*dump_img_)(ImagePrc_pHandle_, "orentation");
|
||||
}
|
||||
|
||||
if ((img_conf_.removeMorr) && (pid_ != 0x239 && pid_ != 0x439))
|
||||
if ((img_conf_.textureRemove) && (pid_ != 0x239 && pid_ != 0x439))
|
||||
{
|
||||
hg_imgproc::textureRemove(ImagePrc_pHandle_);
|
||||
(this->*dump_img_)(ImagePrc_pHandle_, "textureRemove");
|
||||
}
|
||||
|
||||
if (img_conf_.removeMorr && (pid_ != 0x239 && pid_ != 0x439))
|
||||
{
|
||||
hg_imgproc::remove_morr(ImagePrc_pHandle_);
|
||||
(this->*dump_img_)(ImagePrc_pHandle_, "remove_morr");
|
||||
}
|
||||
|
||||
if ((img_conf_.detachnoise.is_detachnoise) && (pid_ != 0x239 && pid_ != 0x439))
|
||||
{
|
||||
hg_imgproc::nosieDetach(ImagePrc_pHandle_);
|
||||
|
|
|
@ -386,16 +386,17 @@ protected:
|
|||
int pid_;
|
||||
|
||||
/////////不同的固件号版本支持
|
||||
bool is_kernelsnap_220830_; //此版本支持待纸扫描,手动睡眠唤醒,分纸强度
|
||||
bool is_kernelsnap_211209_; //获取固件版本号是否是新旧版本
|
||||
bool is_kernelsnap_221027_; //此版本一下不支持拆分模式 pc实现
|
||||
bool is_kernelsnap_239_220830_; //此版本支持待纸扫描,手动睡眠唤醒,分纸强度
|
||||
bool is_kernelsnap_239_211209_; //获取固件版本号是否是新旧版本
|
||||
bool is_kernelsnap_239_221027_; //此版本一下不支持拆分模式 pc实现
|
||||
bool is_kernelsnap3288_221106_; //G300 3288 在221106版本支持真实300dpi
|
||||
bool is_kernelsnap3288_230210_; //G300 3288 在230210版本支持真实600dpi
|
||||
bool is_kernelsnap3288_230303_; //G300 3288 支持清除历史扫描张数
|
||||
bool is_kernelsnap_220430_; //待纸扫描
|
||||
bool is_kernelsnap_439_220430_; //待纸扫描
|
||||
bool is_kernelsnap_devsislock; //支持设备锁的版本
|
||||
bool is_kernelsnap_3C_cccc; //支持偏色校正的版本,自适应配置
|
||||
bool is_kernelsnap_220500_; //支持双张保留的版本
|
||||
bool is_kernelsnap_239_3C_; //支持偏色校正的版本,自适应配置
|
||||
bool is_kernelsnap_439_3C0606; //支持偏色校正的版本
|
||||
bool is_kernelsnap_239_220500_; //支持双张保留的版本
|
||||
|
||||
bool is_kernelsnap_211227_; //此版本以下,不支持真实dpi ,只设置1下去
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -599,7 +599,7 @@ namespace hg_imgproc
|
|||
hole.resize(2);
|
||||
hole[0] = back;
|
||||
hole[1] = front;
|
||||
fillhole1(hole, top, low, left, right);
|
||||
fillhole1(hole, top, low, right, left);
|
||||
//cv::imwrite(std::to_string(i) + "back.jpg", hole[0]);
|
||||
//cv::imwrite(std::to_string(i) + "front.jpg", hole[1]);
|
||||
|
||||
|
@ -1049,6 +1049,26 @@ namespace hg_imgproc
|
|||
}
|
||||
return SCANNER_ERR_OK;
|
||||
}
|
||||
int remove_morr()
|
||||
{
|
||||
int ret = SCANNER_ERR_OK;
|
||||
std::vector<cv::Mat> mats(mats_);
|
||||
mats_.clear();
|
||||
|
||||
CImageApplyFilter::FilterMode sharpenType = CImageApplyFilter::FilterMode::BilateralFilter;
|
||||
CImageApplyFilter Filte(sharpenType);
|
||||
for (size_t i = 0; i < mats.size(); ++i)
|
||||
{
|
||||
Filte.apply(mats[i], img_conf_.is_duplex);
|
||||
mats_.push_back(mats[i]);
|
||||
}
|
||||
if (mats_.empty())
|
||||
{
|
||||
return SCANNER_ERR_NO_DATA;
|
||||
}
|
||||
return SCANNER_ERR_OK;
|
||||
}
|
||||
|
||||
int sharpenType()
|
||||
{
|
||||
int ret = SCANNER_ERR_OK;
|
||||
|
@ -1667,6 +1687,10 @@ namespace hg_imgproc
|
|||
{
|
||||
return ((imgproc*)himg)->textureRemove();
|
||||
}
|
||||
int remove_morr(HIMGPRC himg)
|
||||
{
|
||||
return ((imgproc*)himg)->remove_morr();
|
||||
}
|
||||
int sharpenType(HIMGPRC himg)
|
||||
{
|
||||
return ((imgproc*)himg)->sharpenType();
|
||||
|
|
|
@ -189,6 +189,7 @@ namespace hg_imgproc
|
|||
int colorCorrection(HIMGPRC himg);
|
||||
int orentation(HIMGPRC himg);
|
||||
int textureRemove(HIMGPRC himg);
|
||||
int remove_morr(HIMGPRC himg);
|
||||
int sharpenType(HIMGPRC himg);
|
||||
int nosieDetach(HIMGPRC himg);
|
||||
int errorextention(HIMGPRC himg);
|
||||
|
|
|
@ -110,7 +110,10 @@ g_supporting_devices[] = {
|
|||
, {0x3072, PID_AND_NAME(400, SCANNER_NAME_HG_G400), "G400", "", &hg_scanner_mgr::create_scanner_g400}
|
||||
, {0x3072, PID_AND_NAME(402, SCANNER_NAME_HG_G400), "G400", "", &hg_scanner_mgr::create_scanner_g402}
|
||||
, {0x3072, PID_AND_NAME(439, SCANNER_NAME_HG_G400), "G400", "", &hg_scanner_mgr::create_scanner_g439}
|
||||
|
||||
, {0x064B, PID_AND_NAME(7823,SCANNER_NAME_HG_G300), "G300", "", &hg_scanner_mgr::create_scanner_g300}
|
||||
, {0x064B, PID_AND_NAME(7823,SCANNER_NAME_HG_G200), "G200", "", &hg_scanner_mgr::create_scanner_g100}
|
||||
, {0x064B, PID_AND_NAME(7823,SCANNER_NAME_HG_G400), "G400", "", &hg_scanner_mgr::create_scanner_g400}
|
||||
#endif
|
||||
};
|
||||
bool islang = false;
|
||||
|
@ -136,8 +139,9 @@ bool hg_scanner_mgr::read_over_with_eof_ = true;
|
|||
uint32_t hg_scanner_mgr::unique_img_id_ = 0;;
|
||||
std::mutex hg_scanner_mgr::mutex_img_id;
|
||||
|
||||
hg_scanner_mgr::hg_scanner_mgr() : same_ind_(1), user_(""), pwd_("")
|
||||
hg_scanner_mgr::hg_scanner_mgr() : same_ind_(1), user_(""), pwd_(""), cf_name("")
|
||||
{
|
||||
cf_name = hg_log::ini_get("devs_name", "name");
|
||||
usb_manager::instance()->register_hotplug(&hg_scanner_mgr::usb_event_handle, this);
|
||||
}
|
||||
hg_scanner_mgr::~hg_scanner_mgr()
|
||||
|
@ -348,13 +352,25 @@ void hg_scanner_mgr::on_hgscanner_pnp(usb_event ev, libusb_device* device, int v
|
|||
int index = -1;
|
||||
for (int i = 0; i < _countof(g_supporting_devices); ++i)
|
||||
{
|
||||
// 064B 多台设备使用这个vid,所以加载时不会清楚要打开哪一台设备,只有通过外部进行加载改变实例
|
||||
if (g_supporting_devices[i].vid == vid && g_supporting_devices[i].pid == pid)
|
||||
{
|
||||
index = i;
|
||||
ev_ui = SANE_EVENT_DEVICE_ARRIVED;
|
||||
name = g_supporting_devices[i].name.c_str();
|
||||
type = g_supporting_devices[i].type.c_str();
|
||||
break;
|
||||
|
||||
if (vid == 0x064B && !cf_name.empty())
|
||||
{
|
||||
if (cf_name == g_supporting_devices[i].type)
|
||||
{
|
||||
name = g_supporting_devices[i].name.c_str();
|
||||
type = g_supporting_devices[i].type.c_str();
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -91,6 +91,7 @@ class hg_scanner_mgr
|
|||
void set_appendix_info_for_about(SANE_About* about, char*& ptr, int& count, const char* key, const char* info, const char* url);
|
||||
scanner_err get_about_info(scanner_handle h, void* data, unsigned* len);
|
||||
|
||||
string cf_name;
|
||||
protected:
|
||||
hg_scanner_mgr();
|
||||
~hg_scanner_mgr();
|
||||
|
|
Loading…
Reference in New Issue