修改USB数据包与纸张关系判断

This commit is contained in:
gb 2022-09-21 16:43:42 +08:00
parent c2fd87cdc5
commit c234e0158b
2 changed files with 5 additions and 3 deletions

View File

@ -87,7 +87,7 @@ static std::string bmp_821(unsigned char* bits/*bits data*/, int w, int h, int*
// hg_scanner
hg_scanner::hg_scanner(ScannerSerial serial
, const char* dev_name, usb_io* io)
: name_(dev_name ? dev_name : ""), io_(io), status_(SCANNER_ERR_NOT_START)
: name_(dev_name ? dev_name : ""), io_(io), status_(SCANNER_ERR_NOT_START), serial_(serial)
, scan_count_(-1), run_(true), paper_size_(TwSS::A4), erase_bkg_range_(10)
, noise_range_(30), omit_empty_level_(50), resolution_(200), rid_hole_range_(10.0f)
, bright_(128), contrast_(4), gamma_(1.0f), threshold_(40), anti_noise_(8), margin_(5)
@ -2289,9 +2289,10 @@ int hg_scanner::save_usb_data(std::shared_ptr<tiny_buffer> data)
wait_img_.notify();
}
unsigned int bytes = data->size();
int type = io_->get_pid() & 0x0ff;
//int type = io_->get_pid() & 0x0ff;
if(type != 0x39 || (usb_img_index_ & 1))
//if(type != 0x39 || (usb_img_index_ & 1))
if((serial_ != G10039Serial && serial_ != G20039Serial) || (usb_img_index_ & 1))
ui_ev_cb_((scanner_handle)this, SANE_EVENT_USB_DATA_RECEIVED, NULL, &bytes, NULL);
return ret;

View File

@ -196,6 +196,7 @@ protected:
SANE_Image_Statu last_usb_image_statu(int err);
protected:
ScannerSerial serial_;
volatile bool run_;
volatile bool user_cancel_;
platform_event wait_usb_;