Merge branch 'dev' of http://192.168.10.5:8099/sane/code_device into dev
This commit is contained in:
commit
8ee68aa7e9
|
@ -180,6 +180,9 @@ hg_scanner::hg_scanner(ScannerSerial serial, const char* dev_name, usb_io* io, i
|
||||||
dump_img_ = &hg_scanner::dump_image_real;
|
dump_img_ = &hg_scanner::dump_image_real;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (hg_log::ini_get("func", "no-paper-chk") == "1")
|
||||||
|
no_paper_check_ = true;
|
||||||
|
|
||||||
std::string mem = hg_log::ini_get("mem", "max_img");
|
std::string mem = hg_log::ini_get("mem", "max_img");
|
||||||
if (!mem.empty())
|
if (!mem.empty())
|
||||||
{
|
{
|
||||||
|
@ -4780,6 +4783,10 @@ int hg_scanner::device_io_control(unsigned long code, void* data, unsigned* len)
|
||||||
{
|
{
|
||||||
return set_devreboot(*((int*)data));
|
return set_devreboot(*((int*)data));
|
||||||
}
|
}
|
||||||
|
else if (code == IO_CTRL_CODE_SET_DEVS_SHUTDOWN)
|
||||||
|
{
|
||||||
|
return set_devshtudown();
|
||||||
|
}
|
||||||
else if (code == IO_CTRL_CODE_SET_AUTO_FALT)
|
else if (code == IO_CTRL_CODE_SET_AUTO_FALT)
|
||||||
{
|
{
|
||||||
is_auto_falt = true;
|
is_auto_falt = true;
|
||||||
|
@ -4843,35 +4850,17 @@ int hg_scanner::device_io_control(unsigned long code, void* data, unsigned* len)
|
||||||
}
|
}
|
||||||
else if (code == IO_CTRL_CODE_GET_DEVS_CPU)
|
else if (code == IO_CTRL_CODE_GET_DEVS_CPU)
|
||||||
{
|
{
|
||||||
string str;
|
int cpu = 0;
|
||||||
int ret = get_devs_cpu(str);
|
int ret = get_devs_cpu(cpu);
|
||||||
if (str.empty())
|
(*(int*)data) = cpu;
|
||||||
{
|
|
||||||
ret = SCANNER_ERR_NO_DATA;
|
|
||||||
}
|
|
||||||
if (*len < str.size())
|
|
||||||
{
|
|
||||||
*len = str.size();
|
|
||||||
ret = SCANNER_ERR_INSUFFICIENT_MEMORY;
|
|
||||||
}
|
|
||||||
strcpy((char*)data, str.c_str());
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
else if (code == IO_CTRL_CODE_GET_DEVS_DISK)
|
else if (code == IO_CTRL_CODE_GET_DEVS_DISK)
|
||||||
{
|
{
|
||||||
string str;
|
int disk = 0;
|
||||||
int ret = get_devs_disk(str);
|
int ret = get_devs_disk(disk);
|
||||||
if (str.empty())
|
(*(int*)data) = disk;
|
||||||
{
|
|
||||||
ret = SCANNER_ERR_NO_DATA;
|
|
||||||
}
|
|
||||||
if (*len < str.size())
|
|
||||||
{
|
|
||||||
*len = str.size();
|
|
||||||
ret = SCANNER_ERR_INSUFFICIENT_MEMORY;
|
|
||||||
}
|
|
||||||
strcpy((char*)data, str.c_str());
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -5063,11 +5052,11 @@ int hg_scanner::get_devs_time(string& times)
|
||||||
{
|
{
|
||||||
return SCANNER_ERR_DEVICE_NOT_SUPPORT;
|
return SCANNER_ERR_DEVICE_NOT_SUPPORT;
|
||||||
}
|
}
|
||||||
int hg_scanner::get_devs_cpu(string& cpu)
|
int hg_scanner::get_devs_cpu(int& cpu)
|
||||||
{
|
{
|
||||||
return SCANNER_ERR_DEVICE_NOT_SUPPORT;
|
return SCANNER_ERR_DEVICE_NOT_SUPPORT;
|
||||||
}
|
}
|
||||||
int hg_scanner::get_devs_disk(string& disk)
|
int hg_scanner::get_devs_disk(int& disk)
|
||||||
{
|
{
|
||||||
return SCANNER_ERR_DEVICE_NOT_SUPPORT;
|
return SCANNER_ERR_DEVICE_NOT_SUPPORT;
|
||||||
}
|
}
|
||||||
|
|
|
@ -392,6 +392,7 @@ protected:
|
||||||
unsigned long memory_size_; // MB
|
unsigned long memory_size_; // MB
|
||||||
unsigned long wait_mem_seconds_; // wait up to wait_mem_seconds_ if memory usage is great than memory_size_
|
unsigned long wait_mem_seconds_; // wait up to wait_mem_seconds_ if memory usage is great than memory_size_
|
||||||
bool isx86_Advan_;
|
bool isx86_Advan_;
|
||||||
|
bool no_paper_check_ = false; // 扫描前是否检测无纸状态;可以通过配置[func]no-paper-chk=1开启
|
||||||
int stop_fatal_;
|
int stop_fatal_;
|
||||||
BlockingQueue<std::shared_ptr<tiny_buffer>> imgs_;
|
BlockingQueue<std::shared_ptr<tiny_buffer>> imgs_;
|
||||||
|
|
||||||
|
@ -544,8 +545,8 @@ public:
|
||||||
virtual int get_motor_board_ver(string &ver); //获取G239电机板的固件号 //3399设备支持
|
virtual int get_motor_board_ver(string &ver); //获取G239电机板的固件号 //3399设备支持
|
||||||
virtual int set_devs_time(string times); //设置设备时间 //3399设备支持
|
virtual int set_devs_time(string times); //设置设备时间 //3399设备支持
|
||||||
virtual int get_devs_time(string ×); //获取设备时间 //3399设备支持
|
virtual int get_devs_time(string ×); //获取设备时间 //3399设备支持
|
||||||
virtual int get_devs_cpu(string& cpu); //获取设备内存大小
|
virtual int get_devs_cpu(int& cpu); //获取设备内存大小(kb)
|
||||||
virtual int get_devs_disk(string& disk); //获取设备硬盘容量大小
|
virtual int get_devs_disk(int& disk); //获取设备硬盘容量大小(kb)
|
||||||
virtual int set_restore(); //还原文件
|
virtual int set_restore(); //还原文件
|
||||||
virtual int set_backup(); //备份文件
|
virtual int set_backup(); //备份文件
|
||||||
};
|
};
|
||||||
|
|
|
@ -305,13 +305,17 @@ int hg_scanner_200::do_start(void)
|
||||||
}
|
}
|
||||||
printf_devconfig();
|
printf_devconfig();
|
||||||
SANE_Bool type = false;
|
SANE_Bool type = false;
|
||||||
ret = get_scanner_paperon(type);
|
|
||||||
if (!type)
|
if (!no_paper_check_)
|
||||||
{
|
{
|
||||||
status_ = ret = SCANNER_ERR_DEVICE_NO_PAPER;
|
ret = get_scanner_paperon(type);
|
||||||
//notify_ui_working_status(STATU_DESC_SCANNER_ERR_DEVICE_NO_PAPER, SANE_EVENT_ERROR, status_);
|
if (!type)
|
||||||
VLOG_MINI_1(LOG_LEVEL_WARNING, "device start status is(%s)\n", hg_log::lang_load(ID_STATU_DESC_SCANNER_ERR_DEVICE_NO_PAPER));
|
{
|
||||||
return ret;
|
status_ = ret = SCANNER_ERR_DEVICE_NO_PAPER;
|
||||||
|
//notify_ui_working_status(STATU_DESC_SCANNER_ERR_DEVICE_NO_PAPER, SANE_EVENT_ERROR, status_);
|
||||||
|
VLOG_MINI_1(LOG_LEVEL_WARNING, "device start status is(%s)\n", hg_log::lang_load(ID_STATU_DESC_SCANNER_ERR_DEVICE_NO_PAPER));
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
USBCB usb = { setting3288dsp::START_COMMAND, img_conf_.scannum, 0 };
|
USBCB usb = { setting3288dsp::START_COMMAND, img_conf_.scannum, 0 };
|
||||||
|
|
|
@ -389,7 +389,7 @@ int hg_scanner_239::get_devs_time(string& times)
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
int hg_scanner_239::get_devs_cpu(string& cpu)
|
int hg_scanner_239::get_devs_cpu(int& cpu)
|
||||||
{
|
{
|
||||||
string path = "/usr/local/huago/sysinfo.json";
|
string path = "/usr/local/huago/sysinfo.json";
|
||||||
long long cpu_size = 0;
|
long long cpu_size = 0;
|
||||||
|
@ -402,15 +402,11 @@ int hg_scanner_239::get_devs_cpu(string& cpu)
|
||||||
cpu_size = js["MemTotal"];
|
cpu_size = js["MemTotal"];
|
||||||
}
|
}
|
||||||
|
|
||||||
float num = (float)cpu_size / 1024 / 1024 / 1024;
|
cpu = cpu_size / 1024;
|
||||||
char buf[10] = { 0 };
|
|
||||||
sprintf(buf, "%.2f", num);
|
|
||||||
strcat(buf, "GB");
|
|
||||||
cpu = buf;
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
int hg_scanner_239::get_devs_disk(string& disk)
|
int hg_scanner_239::get_devs_disk(int& disk)
|
||||||
{
|
{
|
||||||
string path = "/usr/local/huago/sysinfo.json";
|
string path = "/usr/local/huago/sysinfo.json";
|
||||||
long disk_size = 0;
|
long disk_size = 0;
|
||||||
|
@ -423,11 +419,7 @@ int hg_scanner_239::get_devs_disk(string& disk)
|
||||||
disk_size = js["DiskTotal"];
|
disk_size = js["DiskTotal"];
|
||||||
}
|
}
|
||||||
|
|
||||||
float num = (float)disk_size / 1024 / 1024;
|
disk = disk_size;
|
||||||
char buf[10] = { 0 };
|
|
||||||
sprintf(buf, "%.2f", num);
|
|
||||||
strcat(buf, "GB");
|
|
||||||
disk = buf;
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -146,8 +146,8 @@ public:
|
||||||
|
|
||||||
virtual int set_devs_time(string times); //设置设备时间 //3399设备支持
|
virtual int set_devs_time(string times); //设置设备时间 //3399设备支持
|
||||||
virtual int get_devs_time(string& times); //获取设备时间 //3399设备支持
|
virtual int get_devs_time(string& times); //获取设备时间 //3399设备支持
|
||||||
virtual int get_devs_cpu(string& cpu); //获取设备内存大小
|
virtual int get_devs_cpu(int& cpu); //获取设备内存大小(kb)
|
||||||
virtual int get_devs_disk(string& disk); //获取设备硬盘容量大小
|
virtual int get_devs_disk(int& disk); //获取设备硬盘容量大小(kb)
|
||||||
virtual int set_restore(); //还原文件
|
virtual int set_restore(); //还原文件
|
||||||
virtual int set_backup(); //备份文件
|
virtual int set_backup(); //备份文件
|
||||||
};
|
};
|
||||||
|
|
|
@ -89,7 +89,7 @@ hg_scanner_300::hg_scanner_300(const char* dev_name,int pid, usb_io* io) :
|
||||||
{
|
{
|
||||||
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "hg_scanner_300(%s) constructing ...\n", hg_log::format_ptr(this).c_str());
|
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "hg_scanner_300(%s) constructing ...\n", hg_log::format_ptr(this).c_str());
|
||||||
dsp_config.value = 0;
|
dsp_config.value = 0;
|
||||||
dsp_config.params_3288.enableLed = 1; //默认值
|
dsp_config.params_3288.enableLed = 1; //榛樿鍊?
|
||||||
dsp_config.params_3288.isCorrect = 1;
|
dsp_config.params_3288.isCorrect = 1;
|
||||||
|
|
||||||
int ret = initdevice();
|
int ret = initdevice();
|
||||||
|
@ -371,12 +371,15 @@ int hg_scanner_300::do_start(void)
|
||||||
|
|
||||||
return status_;
|
return status_;
|
||||||
}
|
}
|
||||||
ret = get_scanner_paperon(val);
|
if (!no_paper_check_)
|
||||||
if (!val && ret == SCANNER_ERR_OK)
|
|
||||||
{
|
{
|
||||||
status_ = SCANNER_ERR_DEVICE_NO_PAPER;
|
ret = get_scanner_paperon(val);
|
||||||
|
if (!val && ret == SCANNER_ERR_OK)
|
||||||
|
{
|
||||||
|
status_ = SCANNER_ERR_DEVICE_NO_PAPER;
|
||||||
|
|
||||||
return status_;
|
return status_;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (ret != SCANNER_ERR_OK)
|
if (ret != SCANNER_ERR_OK)
|
||||||
{
|
{
|
||||||
|
@ -1629,7 +1632,7 @@ int hg_scanner_300::set_updata0303(void)
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
int hg_scanner_300::get_devs_cpu(string& cpu)
|
int hg_scanner_300::get_devs_cpu(int& cpu)
|
||||||
{
|
{
|
||||||
std::string src_name = "/usr/local/huago/sysinfo.json";
|
std::string src_name = "/usr/local/huago/sysinfo.json";
|
||||||
std::string dst_name = "./sys.log";
|
std::string dst_name = "./sys.log";
|
||||||
|
@ -1670,15 +1673,11 @@ int hg_scanner_300::get_devs_cpu(string& cpu)
|
||||||
cpu_size = js["MemTotal"];
|
cpu_size = js["MemTotal"];
|
||||||
}
|
}
|
||||||
|
|
||||||
float num = (float)cpu_size / 1024 / 1024 / 1024;
|
cpu = cpu_size / 1024;
|
||||||
char buf[10] = { 0 };
|
|
||||||
sprintf(buf, "%.2f", num);
|
|
||||||
strcat(buf, "GB");
|
|
||||||
cpu = buf;
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
int hg_scanner_300::get_devs_disk(string& disk)
|
int hg_scanner_300::get_devs_disk(int& disk)
|
||||||
{
|
{
|
||||||
std::string src_name = "/usr/local/huago/sysinfo.json";
|
std::string src_name = "/usr/local/huago/sysinfo.json";
|
||||||
std::string dst_name = "./sys.log";
|
std::string dst_name = "./sys.log";
|
||||||
|
@ -1719,11 +1718,7 @@ int hg_scanner_300::get_devs_disk(string& disk)
|
||||||
disk_size = js["DiskTotal"];
|
disk_size = js["DiskTotal"];
|
||||||
}
|
}
|
||||||
|
|
||||||
float num = (float)disk_size / 1024 / 1024;
|
disk = disk_size;
|
||||||
char buf[10] = { 0 };
|
|
||||||
sprintf(buf, "%.2f", num);
|
|
||||||
strcat(buf, "GB");
|
|
||||||
disk = buf;
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -126,8 +126,8 @@ public:
|
||||||
virtual int set_auto_flat(int data)override; //设置自动平场校正
|
virtual int set_auto_flat(int data)override; //设置自动平场校正
|
||||||
// data:0(ALL) 1(200dpi、gray) 2(200dpi、color) 3(300dpi、gray) 4(300dpi、color) 5(600dpi、gray) 6(600dpi、color)
|
// data:0(ALL) 1(200dpi、gray) 2(200dpi、color) 3(300dpi、gray) 4(300dpi、color) 5(600dpi、gray) 6(600dpi、color)
|
||||||
virtual int set_updata0303(void)override;
|
virtual int set_updata0303(void)override;
|
||||||
virtual int get_devs_cpu(string& cpu); //获取设备内存大小
|
virtual int get_devs_cpu(int& cpu); //获取设备内存大小(kb)
|
||||||
virtual int get_devs_disk(string& disk); //获取设备硬盘容量大小
|
virtual int get_devs_disk(int& disk); //获取设备硬盘容量大小(kb)
|
||||||
virtual int set_restore(); //还原文件
|
virtual int set_restore(); //还原文件
|
||||||
virtual int set_backup(); //备份文件
|
virtual int set_backup(); //备份文件
|
||||||
};
|
};
|
||||||
|
|
|
@ -243,7 +243,7 @@ void hg_scanner_306::thread_handle_usb_read(void)
|
||||||
}
|
}
|
||||||
savestatus_.clear();
|
savestatus_.clear();
|
||||||
hg_log::log(LOG_LEVEL_WARNING, "MaxSize TimeOut,Get Image 130s\n");
|
hg_log::log(LOG_LEVEL_WARNING, "MaxSize TimeOut,Get Image 130s\n");
|
||||||
notify_ui_working_status(hg_log::lang_load(ID_STATU_DESC_SCANNER_ERR_DEVICE_GET_IMAGE_OUTTIME), SANE_EVENT_ERROR, status_); // 閸欐牕娴橀柅姘繆鐡掑懏妞?
|
notify_ui_working_status(hg_log::lang_load(ID_STATU_DESC_SCANNER_ERR_DEVICE_GET_IMAGE_OUTTIME), SANE_EVENT_ERROR, status_); // 闁告瑦鐗曞ù姗€鏌呭顐$箚閻℃帒鎳忓?
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (ret == SCANNER_ERR_OK && usb.u32_Count > 0)
|
if (ret == SCANNER_ERR_OK && usb.u32_Count > 0)
|
||||||
|
@ -327,13 +327,17 @@ int hg_scanner_306::do_start(void)
|
||||||
|
|
||||||
return status_;
|
return status_;
|
||||||
}
|
}
|
||||||
ret = get_scanner_paperon(val);
|
if (!no_paper_check_)
|
||||||
if (!val && ret == SCANNER_ERR_OK)
|
|
||||||
{
|
{
|
||||||
status_ = SCANNER_ERR_DEVICE_NO_PAPER;
|
ret = get_scanner_paperon(val);
|
||||||
|
if (!val && ret == SCANNER_ERR_OK)
|
||||||
|
{
|
||||||
|
status_ = SCANNER_ERR_DEVICE_NO_PAPER;
|
||||||
|
|
||||||
return status_;
|
return status_;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret != SCANNER_ERR_OK)
|
if (ret != SCANNER_ERR_OK)
|
||||||
{
|
{
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -1431,7 +1435,7 @@ int hg_scanner_306::set_firmware_upgrade(std::string str)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf("升级中\r\n");
|
printf("鍗囩骇涓璡r\n");
|
||||||
sw.reset();
|
sw.reset();
|
||||||
}
|
}
|
||||||
sw.reset();
|
sw.reset();
|
||||||
|
@ -1571,7 +1575,7 @@ int hg_scanner_306::set_updata0303(void)
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
int hg_scanner_306::get_devs_cpu(string& cpu)
|
int hg_scanner_306::get_devs_cpu(int& cpu)
|
||||||
{
|
{
|
||||||
std::string src_name = "/usr/local/huago/sysinfo.json";
|
std::string src_name = "/usr/local/huago/sysinfo.json";
|
||||||
std::string dst_name = "./sys.log";
|
std::string dst_name = "./sys.log";
|
||||||
|
@ -1612,15 +1616,11 @@ int hg_scanner_306::get_devs_cpu(string& cpu)
|
||||||
cpu_size = js["MemTotal"];
|
cpu_size = js["MemTotal"];
|
||||||
}
|
}
|
||||||
|
|
||||||
float num = (float)cpu_size / 1024 / 1024 / 1024;
|
cpu = cpu_size / 1024;
|
||||||
char buf[10] = { 0 };
|
|
||||||
sprintf(buf, "%.2f", num);
|
|
||||||
strcat(buf, "GB");
|
|
||||||
cpu = buf;
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
int hg_scanner_306::get_devs_disk(string& disk)
|
int hg_scanner_306::get_devs_disk(int& disk)
|
||||||
{
|
{
|
||||||
std::string src_name = "/usr/local/huago/sysinfo.json";
|
std::string src_name = "/usr/local/huago/sysinfo.json";
|
||||||
std::string dst_name = "./sys.log";
|
std::string dst_name = "./sys.log";
|
||||||
|
@ -1661,11 +1661,7 @@ int hg_scanner_306::get_devs_disk(string& disk)
|
||||||
disk_size = js["DiskTotal"];
|
disk_size = js["DiskTotal"];
|
||||||
}
|
}
|
||||||
|
|
||||||
float num = (float)disk_size / 1024 / 1024;
|
disk = disk_size;
|
||||||
char buf[10] = { 0 };
|
|
||||||
sprintf(buf, "%.2f", num);
|
|
||||||
strcat(buf, "GB");
|
|
||||||
disk = buf;
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -152,6 +152,6 @@ public:
|
||||||
virtual int set_auto_flat(int data)override; //设置自动平场校正
|
virtual int set_auto_flat(int data)override; //设置自动平场校正
|
||||||
// data:0(ALL) 1(200dpi、gray) 2(200dpi、color) 3(300dpi、gray) 4(300dpi、color) 5(600dpi、gray) 6(600dpi、color)
|
// data:0(ALL) 1(200dpi、gray) 2(200dpi、color) 3(300dpi、gray) 4(300dpi、color) 5(600dpi、gray) 6(600dpi、color)
|
||||||
virtual int set_updata0303(void)override;
|
virtual int set_updata0303(void)override;
|
||||||
virtual int get_devs_cpu(string& cpu); //获取设备内存大小
|
virtual int get_devs_cpu(int& cpu); //获取设备内存大小(kb)
|
||||||
virtual int get_devs_disk(string& disk); //获取设备硬盘容量大小
|
virtual int get_devs_disk(int& disk); //获取设备硬盘容量大小(kb)
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue