This commit is contained in:
modehua 2023-10-06 23:08:42 -07:00
parent 91997e2f80
commit 770c7233cf
14 changed files with 81 additions and 110 deletions

View File

@ -12,7 +12,6 @@ cv::Mat CImageMerge::MergeImage(cv::Mat &srcMat, int dstwidth, int dstheight, in
{ {
if (b7010) if (b7010)
{ {
//printf("7010 7010 10 7010 7010 7010 7010 7010 7010!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\r\n");
cv::Mat matdst; cv::Mat matdst;
if (!mode) // gray mode if (!mode) // gray mode
{ {

View File

@ -112,16 +112,16 @@ void CuoZhiMotor::speedRecover()
void CuoZhiMotor::speedConfig() void CuoZhiMotor::speedConfig()
{ {
printf("CuoZhiMotor speed=%d \n dpi=%d \n colormode=%d \n finalPeriod=%d \n Fmin=%d \n a=%.2f \n offset=%.2f \n stepnum=%.2f \n finalDelay=%.2f \n ", // printf("CuoZhiMotor speed=%d \n dpi=%d \n colormode=%d \n finalPeriod=%d \n Fmin=%d \n a=%.2f \n offset=%.2f \n stepnum=%.2f \n finalDelay=%.2f \n ",
m_cuoparamex.speed, // m_cuoparamex.speed,
m_cuoparamex.dpi, // m_cuoparamex.dpi,
m_cuoparamex.colormode, // m_cuoparamex.colormode,
m_cuoparamex.mt_param.finalPeriod, // m_cuoparamex.mt_param.finalPeriod,
m_cuoparamex.mt_param.Fmin, // m_cuoparamex.mt_param.Fmin,
m_cuoparamex.mt_param.a, // m_cuoparamex.mt_param.a,
m_cuoparamex.mt_param.offset, // m_cuoparamex.mt_param.offset,
m_cuoparamex.mt_param.stepnum, // m_cuoparamex.mt_param.stepnum,
m_cuoparamex.mt_param.finalDelay); // m_cuoparamex.mt_param.finalDelay);
delays_forward.clear(); delays_forward.clear();
delays_forward = speedup_cfg(m_cuoparamex.mt_param.finalPeriod, m_cuoparamex.mt_param.Fmin, m_cuoparamex.mt_param.stepnum, m_cuoparamex.mt_param.a, delays_forward = speedup_cfg(m_cuoparamex.mt_param.finalPeriod, m_cuoparamex.mt_param.Fmin, m_cuoparamex.mt_param.stepnum, m_cuoparamex.mt_param.a,

View File

@ -240,7 +240,6 @@ int HCamDevice::open_device(int width , int height)
} }
int HCamDevice::close_device() int HCamDevice::close_device()
{ {
printf("videofd:%d subDevicefd:%d\r\n",videofd,subDevicefd);
if (videofd == -1 || subDevicefd == -1) if (videofd == -1 || subDevicefd == -1)
{ {
return 0; return 0;
@ -1230,7 +1229,7 @@ void HCamDevice::HtCamSetDpi(int dpi)
{ {
CamZ_Reg_A_New rega; CamZ_Reg_A_New rega;
rega.value = HtCamReadFpgaRegs(0x0A); rega.value = HtCamReadFpgaRegs(0x0A);
printf("dpi:%d\r\n",dpi);
if (dpi == 1 ) if (dpi == 1 )
{ {
rega.dpi_200 = 1; rega.dpi_200 = 1;

View File

@ -43,4 +43,6 @@ protected:
BlockingQueue<HG_Msg> m_scannerEvents; BlockingQueue<HG_Msg> m_scannerEvents;
std::string m_serial; std::string m_serial;
std::string m_fwversion; std::string m_fwversion;
int vid_;
int pid_;
}; };

View File

@ -121,12 +121,9 @@ ScannerScanInfo JsonConfig::CreateDefaultScanInfo()
info.SpeedMode = 4; info.SpeedMode = 4;
l_it = mapFradme_SP.find(info.SpeedMode); l_it = mapFradme_SP.find(info.SpeedMode);
info.FWVersion = l_it->second.FWVERSIO; info.FWVersion = l_it->second.FWVERSIO;
info.VID = 0x3072; info.VID = 0x3072;
#ifdef G400 info.PID = 0x0300;
info.PID = 0x0400;
#else
info.PID = 0x0300;
#endif
return info; return info;
} }
@ -136,7 +133,7 @@ ScannerScanInfo JsonConfig::GetScanInfo()
ScannerScanInfo info; ScannerScanInfo info;
if (access(SCANNER_SCAN_INFO_PATH, F_OK) != 0) if (access(SCANNER_SCAN_INFO_PATH, F_OK) != 0)
{ {
printf("/usr/local/huago/jsonconfig.json do not exist!\n"); printf("/mnt/flash-disk/huago/jsonconfig.json do not exist!\n");
info = CreateDefaultScanInfo(); info = CreateDefaultScanInfo();
SaveScanInfo(info); SaveScanInfo(info);
return info; return info;
@ -146,7 +143,7 @@ ScannerScanInfo JsonConfig::GetScanInfo()
i.seekg(0, ios::end); i.seekg(0, ios::end);
if(i.tellg()<=2) if(i.tellg()<=2)
{ {
printf("/usr/local/huago/jsonconfig.json file size < 2!\n"); printf("/mnt/flash-disk/huago/jsonconfig.json file size < 2!\n");
info = CreateDefaultScanInfo(); info = CreateDefaultScanInfo();
SaveScanInfo(info); SaveScanInfo(info);
return info; return info;

View File

@ -47,7 +47,6 @@ MultiFrameCapture::MultiFrameCapture(ScannerGlue glue, CISVendor vendor)
#endif #endif
{ {
video.reset(new HCamDevice); video.reset(new HCamDevice);
reset_fpga();
m_snap_thread.reset(new std::thread(&MultiFrameCapture::snaprun, this)); m_snap_thread.reset(new std::thread(&MultiFrameCapture::snaprun, this));
m_imgproc_thread.reset(new std::thread(&MultiFrameCapture::procimage, this)); m_imgproc_thread.reset(new std::thread(&MultiFrameCapture::procimage, this));
@ -127,7 +126,7 @@ void MultiFrameCapture::stopsnap(bool autosize)
void MultiFrameCapture::close() void MultiFrameCapture::close()
{ {
printf("close close close\r\n"); printf("close close close\r\n");
if (video.get()) if (video.get())
video->close_device(); video->close_device();
} }
@ -222,16 +221,14 @@ void MultiFrameCapture::UpdateScanParam(HG_ScanConfiguration config)
printf(" -----------------------设置帧数:%d------------------\r\n",cnt); printf(" -----------------------设置帧数:%d------------------\r\n",cnt);
} }
printf("颜色模式:%s\r\n",color_mode_== COLOR ? "彩色":"灰色"); printf("颜色模式:%s\r\n",color_mode_== COLOR ? "彩色":"灰色");
printf("分辨率:%d\r\n",resolution_); printf("分辨率:%d\r\n",resolution_);
printf("V4L2宽%d 高:%d\r\n",v4l2_width_,v4l2_height_); printf("V4L2宽: %d 高:%d\r\n",v4l2_width_,v4l2_height_);
printf("像素宽:%d 高: %d\r\n",pixels_width_,pixels_height_); printf("像素宽:%d 高: %d\r\n",pixels_width_,pixels_height_);
printf("fpga_height_:%d\r\n", fpga_height_); printf("fpga_height_:%d\r\n", fpga_height_);
printf("color_mode_:%d\r\n", color_mode_); printf("color_mode_:%d\r\n", color_mode_);
printf("paper_size_:%d\r\n", paper_size_); printf("paper_size_:%d\r\n", paper_size_);
printf("paper_size_:%d\r\n", paper_size_);
} }
void MultiFrameCapture::createCorrect(int correctmode) void MultiFrameCapture::createCorrect(int correctmode)
@ -310,17 +307,6 @@ void MultiFrameCapture::setScanFlag(bool brun)
bScanning = brun; bScanning = brun;
} }
void MultiFrameCapture::reset_fpga()
{
}
void MultiFrameCapture::reload_fpga()
{
}
void MultiFrameCapture::configFPGAParam(int mode, int dpi) void MultiFrameCapture::configFPGAParam(int mode, int dpi)
{ {
FPGAConfigParam fpgaparam = GetFpgaparam(dpi, mode); FPGAConfigParam fpgaparam = GetFpgaparam(dpi, mode);
@ -342,14 +328,6 @@ void MultiFrameCapture::configFPGAParam(int mode, int dpi)
// //video->HtCamReadADCReg_ALL(i); // //video->HtCamReadADCReg_ALL(i);
// } // }
}; };
int MultiFrameCapture::width()
{
return 0;//dpi == 0x02 ? 864 * channel : (dpi == 0x03 ? (1728 * channel) : (864 * channel)); // we only sup dunnancis now
}
int MultiFrameCapture::color()
{
}
#include "bmp.h" #include "bmp.h"
@ -1003,8 +981,6 @@ void MultiFrameCapture::correctcolor(int correctmode)
void MultiFrameCapture::openDevice(int dpi, int mode) void MultiFrameCapture::openDevice(int dpi, int mode)
{ {
printf("openDevice dpi:%d mode:%d \r\n",dpi,mode);
reset_fpga();
bool dunnancis = true; bool dunnancis = true;
int channelwidth = dpi == 0x02 ? 864 : (dpi == 0x03 ? 1728 : 576); // 1296 2592 864 int channelwidth = dpi == 0x02 ? 864 : (dpi == 0x03 ? 1728 : 576); // 1296 2592 864
int channels = mode == 0x01 ? 3 : 1; int channels = mode == 0x01 ? 3 : 1;

View File

@ -67,12 +67,7 @@ private:
#endif #endif
CamZ_Reg_4 reg_; CamZ_Reg_4 reg_;
private: private:
void reset_fpga();
void reload_fpga();
void configFPGAParam(int mode,int dpi); void configFPGAParam(int mode,int dpi);
int color();
int width();
void snaprun(); void snaprun();
void updatesnapstatus(int papertype); void updatesnapstatus(int papertype);
void procimage(); void procimage();
@ -81,7 +76,7 @@ private:
void creatcorrectconfig(int dpi,int mode); void creatcorrectconfig(int dpi,int mode);
void correctcolor(int correctmode); void correctcolor(int correctmode);
void openDevice(int dpi,int mode); void openDevice(int dpi,int mode);
//void myFloodFill(cv::Mat& image, bool isTwoSide);
private: private:
unsigned int resolution_; // 分辨率 //3:600dpi 2:300dpi 1:200dpi unsigned int resolution_; // 分辨率 //3:600dpi 2:300dpi 1:200dpi

View File

@ -105,7 +105,7 @@ void Scanner::updateSpeedMode(int speed)
m_scaninfo = GetScanInfoFromJson(); m_scaninfo = GetScanInfoFromJson();
if(m_scaninfo.SpeedMode==0) if(m_scaninfo.SpeedMode==0)
m_scaninfo.SpeedMode=3; m_scaninfo.SpeedMode=3;
printf("速度模式:%d dpi:%d 颜色:%d \n",m_scaninfo.SpeedMode,m_config.params.dpi,m_config.params.isColor);
unsigned int t_dpi = m_config.params.dpi; unsigned int t_dpi = m_config.params.dpi;
if(typeid(*capturer)==typeid(MultiFrameCapture)) if(typeid(*capturer)==typeid(MultiFrameCapture))

View File

@ -94,20 +94,13 @@ int SysInforTool::get_fileSystem_info(const char *fileSystem_name, struct fileSy
break; break;
} }
// bzero(&fi->fileSystem_total_capacity,sizeof(fi->fileSystem_total_capacity));
// bzero(&fi->fileSystem_free_capacity,sizeof(fi->fileSystem_free_capacity));
printf("blocks %ld\n", buf.f_blocks);
printf("bfree %ld\n", buf.f_bfree);
printf("bsize %ld\n", buf.f_bsize);
fileSystem_total_size = fileSystem_total_size =
(float)(kscale(buf.f_blocks, buf.f_bsize)); (float)(kscale(buf.f_blocks, buf.f_bsize));
fileSystem_free_size = fileSystem_free_size =
(float)(kscale(buf.f_bfree, buf.f_bsize)); (float)(kscale(buf.f_bfree, buf.f_bsize));
printf("total %f\n", fileSystem_total_size);
printf("free %f\n", fileSystem_free_size);
fi->fileSystem_total_capacity = fileSystem_total_size; fi->fileSystem_total_capacity = fileSystem_total_size;
fi->fileSystem_free_capacity = fileSystem_free_size; fi->fileSystem_free_capacity = fileSystem_free_size;
@ -159,28 +152,28 @@ std::string SysInforTool::GetSysInfo()
if (uname(&t_uname) != 0) if (uname(&t_uname) != 0)
perror("uname doesn't return 0, so there is an error"); perror("uname doesn't return 0, so there is an error");
printf("System Name = %s\n", t_uname.sysname); // printf("System Name = %s\n", t_uname.sysname);
printf("Node Name = %s\n", t_uname.nodename); // printf("Node Name = %s\n", t_uname.nodename);
printf("Version = %s\n", t_uname.version); // printf("Version = %s\n", t_uname.version);
printf("Release = %s\n", t_uname.release); // printf("Release = %s\n", t_uname.release);
printf("Machine = %s\n", t_uname.machine); // printf("Machine = %s\n", t_uname.machine);
if (strcmp(t_uname.nodename, "linaro-alip") == 0 && strcmp(t_uname.machine, "armv7l") == 0) if (strcmp(t_uname.nodename, "linaro-alip") == 0 && strcmp(t_uname.machine, "armv7l") == 0)
{ {
m_sysinfo.Systype = SysType::Sys_Linux_Debian; m_sysinfo.Systype = SysType::Sys_Linux_Debian;
m_sysinfo.CPU = SCPU::CPU_3288; m_sysinfo.CPU = SCPU::CPU_3288;
printf("Machine = %s CPU = %s \n", "Sys_Linux_Debian", "CPU_3288"); //printf("Machine = %s CPU = %s \n", "Sys_Linux_Debian", "CPU_3288");
} }
else if (strcmp(t_uname.nodename, "linaro-alip") == 0 && strcmp(t_uname.machine, "aarch64") == 0) else if (strcmp(t_uname.nodename, "linaro-alip") == 0 && strcmp(t_uname.machine, "aarch64") == 0)
{ {
m_sysinfo.Systype = SysType::Sys_Linux_Debian; m_sysinfo.Systype = SysType::Sys_Linux_Debian;
m_sysinfo.CPU = SCPU::CPU_3399; m_sysinfo.CPU = SCPU::CPU_3399;
printf("Machine = %s CPU = %s \n", "Sys_Linux_Debian", "CPU_3399"); //printf("Machine = %s CPU = %s \n", "Sys_Linux_Debian", "CPU_3399");
} }
char output[512]; char output[512];
get_system_output("uname -a", output, sizeof(output)); get_system_output("uname -a", output, sizeof(output));
std::string ver(output); std::string ver(output);
m_sysinfo.KernelVersion = ver; m_sysinfo.KernelVersion = ver;
printf("system version = %s \n", ver.c_str()); //printf("system version = %s \n", ver.c_str());
json j; json j;
struct2json(j, m_sysinfo); struct2json(j, m_sysinfo);
std::ofstream o("/usr/local/huago/sysinfo.json"); std::ofstream o("/usr/local/huago/sysinfo.json");

View File

@ -4,6 +4,7 @@
#include "USBProtocol.h" #include "USBProtocol.h"
#include "filetools.h" #include "filetools.h"
#include "logs_out.h" #include "logs_out.h"
#include "JsonConfig.h"
#define USB_REQ_GET_FPGA_REGS 0x40 #define USB_REQ_GET_FPGA_REGS 0x40
#define USB_REQ_SET_FPGA_REGS 0x41 #define USB_REQ_SET_FPGA_REGS 0x41
@ -20,10 +21,6 @@
#define USB_REQ_GET_DEV_LOG 0x65 #define USB_REQ_GET_DEV_LOG 0x65
#define USB_REQ_SET_DEV_LOG 0x66 #define USB_REQ_SET_DEV_LOG 0x66
static int enqueueindex = 0;
const int SPEED_MODE_MAX = 5; const int SPEED_MODE_MAX = 5;
UsbScanner::UsbScanner() : m_startscan(false), UsbScanner::UsbScanner() : m_startscan(false),
@ -31,8 +28,18 @@ UsbScanner::UsbScanner() : m_startscan(false),
eventsramain(0) eventsramain(0)
{ {
DeviceExport(); DeviceExport();
m_serial = ("G20018000298OO"); JsonConfig js;
m_fwversion = ("1234561300"); ScannerScanInfo info = js.GetScanInfo();
pid_ = info.PID;
vid_ = info.VID;
m_serial = info.SerialNum;
m_fwversion = info.FWVersion;
printf("VID:%0x\r\n",vid_);
printf("PID:%0x\r\n",pid_);
printf("SerialNum:%s\r\n",m_serial.c_str());
printf("FWVersion:%s\r\n",m_fwversion.c_str());
mount_usb_device(); mount_usb_device();
auto ctrl_req_handler = [&](int fd, struct usb_ctrlrequest *setup, unsigned char *buffer) -> bool auto ctrl_req_handler = [&](int fd, struct usb_ctrlrequest *setup, unsigned char *buffer) -> bool
{ {
@ -121,19 +128,17 @@ UsbScanner::UsbScanner() : m_startscan(false),
std::this_thread::sleep_for(std::chrono::milliseconds(2)); std::this_thread::sleep_for(std::chrono::milliseconds(2));
} }
PRINT_MSG("!!!!!!!!!!time eplased :%.2f ",sw.elapsed_ms());
auto imageready = [this](const HG_JpegCompressInfo &imageinfo) auto imageready = [this](const HG_JpegCompressInfo &imageinfo)
{ {
imageremain++; imageremain++;
m_images.Put(imageinfo); m_images.Put(imageinfo);
printf("队列缓存张数 :%d\r\n",m_images.Size()); printf("队列缓存张数 :%d\r\n",m_images.Size());
// LOG("Enqueue image index :%d ptr:%p length:%d\n", ++enqueueindex,imageinfo.pJpegData, imageinfo.DataLength);
}; };
auto deviceevent = [this](const int eventID, std::string capmsg) auto deviceevent = [this](const int eventID, std::string capmsg)
{ {
{ {
LOG("\n 222222222 Enqueue event %d \n", eventID);
eventsramain++; eventsramain++;
m_scannerEvents.Put({eventID, capmsg}); m_scannerEvents.Put({eventID, capmsg});
if (eventID == (int)HG_ScannerStatus::STOP_SCAN) if (eventID == (int)HG_ScannerStatus::STOP_SCAN)
@ -173,20 +178,14 @@ UsbScanner::~UsbScanner()
void UsbScanner::StartScan(int scancount) void UsbScanner::StartScan(int scancount)
{ {
ClearImages(); ClearImages();
LOG("m_scannerEvents size %d\n", m_scannerEvents.Size());
ClearErrorEvents(); ClearErrorEvents();
LOG("m_images size %d\n", m_images.Size());
m_hgScanner->SetDstScanNum(9999);//scancount <= 0 ? 1 : scancount); m_hgScanner->SetDstScanNum(9999);//scancount <= 0 ? 1 : scancount);
printf("1111111111111111111 %d \r\n", scancount);
m_hgScanner->put(S_EVT_START_SCAN); m_hgScanner->put(S_EVT_START_SCAN);
// m_hgScanner->startScan();
LOG("Put Event S_EVT_START_SCAN\n");
} }
void UsbScanner::StopScan() void UsbScanner::StopScan()
{ {
m_hgScanner->put(S_EVT_STOP_SCAN); m_hgScanner->put(S_EVT_STOP_SCAN);
LOG("Put Event S_EVT_STOP_SCAN\n");
} }
void UsbScanner::ConfigScanParam(HG_ScanConfiguration config) void UsbScanner::ConfigScanParam(HG_ScanConfiguration config)
@ -480,10 +479,21 @@ bool UsbScanner::is_connect()
void UsbScanner::mount_usb_device() void UsbScanner::mount_usb_device()
{ {
/////没用到
if ((access("/dev/ffs-camtp/ep0", F_OK)) != -1) if ((access("/dev/ffs-camtp/ep0", F_OK)) != -1)
return; {
printf("exit mount_usb_device !!!\r\n");
int result = system("modprobe libcomposite\n \ return;
}
char p[12];
sprintf(p,"%0x",pid_);
char v[12];
sprintf(v,"%0x",vid_);
std::string pid = p;
std::string vid = v;
std::string str = "modprobe libcomposite\n \
mkdir /var/cfg\n \ mkdir /var/cfg\n \
mount none /var/cfg -t configfs\n \ mount none /var/cfg -t configfs\n \
mkdir /var/cfg/usb_gadget/g1\n \ mkdir /var/cfg/usb_gadget/g1\n \
@ -492,8 +502,8 @@ void UsbScanner::mount_usb_device()
mkdir functions/ffs.camtp\n \ mkdir functions/ffs.camtp\n \
mkdir strings/0x409\n \ mkdir strings/0x409\n \
mkdir configs/c.1/strings/0x409\n \ mkdir configs/c.1/strings/0x409\n \
echo 0x0300 > idProduct\n \ echo" + pid +"> idProduct\n \
echo 0x3072 > idVendor\n \ echo" + vid +"> idVendor\n \
echo \"01234567AABBCCDDEE\" > strings/0x409/serialnumber\n \ echo \"01234567AABBCCDDEE\" > strings/0x409/serialnumber\n \
echo \"Holdtecs Technologies\" > strings/0x409/manufacturer\n \ echo \"Holdtecs Technologies\" > strings/0x409/manufacturer\n \
echo \"The Holdtecs Product !\" > strings/0x409/product\n \ echo \"The Holdtecs Product !\" > strings/0x409/product\n \
@ -501,7 +511,6 @@ void UsbScanner::mount_usb_device()
echo 120 > configs/c.1/MaxPower\n \ echo 120 > configs/c.1/MaxPower\n \
ln -s functions/ffs.camtp configs/c.1\n \ ln -s functions/ffs.camtp configs/c.1\n \
mkdir /dev/ffs-camtp\n \ mkdir /dev/ffs-camtp\n \
mount -t functionfs camtp /dev/ffs-camtp"); mount -t functionfs camtp /dev/ffs-camtp";
int result = system(str.c_str());
//printf("!!!!!!!!!!!!!!!!!!!modprobe libcomposite done \n");
} }

View File

@ -32,16 +32,16 @@ void ZouZhiMotor::speedRecover()
void ZouZhiMotor::speedConfig() void ZouZhiMotor::speedConfig()
{ {
printf("ZouZhiMotor speed=%d \n dpi=%d \n colormode=%d \n finalPeriod=%d \n Fmin=%d \n a=%.2f \n offset=%.2f \n stepnum=%.2f \n finalDelay=%.2f \n ", // printf("ZouZhiMotor speed=%d \n dpi=%d \n colormode=%d \n finalPeriod=%d \n Fmin=%d \n a=%.2f \n offset=%.2f \n stepnum=%.2f \n finalDelay=%.2f \n ",
m_zouparamex.speed, // m_zouparamex.speed,
m_zouparamex.dpi, // m_zouparamex.dpi,
m_zouparamex.colormode, // m_zouparamex.colormode,
m_zouparamex.mt_param.finalPeriod, // m_zouparamex.mt_param.finalPeriod,
m_zouparamex.mt_param.Fmin, // m_zouparamex.mt_param.Fmin,
m_zouparamex.mt_param.a, // m_zouparamex.mt_param.a,
m_zouparamex.mt_param.offset, // m_zouparamex.mt_param.offset,
m_zouparamex.mt_param.stepnum, // m_zouparamex.mt_param.stepnum,
m_zouparamex.mt_param.finalDelay); // m_zouparamex.mt_param.finalDelay);
delays.clear(); delays.clear();

View File

@ -299,9 +299,7 @@ int main(int argc, char *argv[])
int evt = m_scanner->GetEventFront().code; int evt = m_scanner->GetEventFront().code;
if (evt != (int)HG_ScannerStatus::NORMAL && evt != (int)HG_ScannerStatus::STOP_SCAN) if (evt != (int)HG_ScannerStatus::NORMAL && evt != (int)HG_ScannerStatus::STOP_SCAN)
{ {
sts.Data = m_scanner->GetEvent().code; // 扫描中途的事件能够被通知 sts.Data = m_scanner->GetEvent().code; // 扫描中途的事件能够被通知
// printf("关闭V4L2 333\r\n");
// m_scanner->close_v4l2();
} }
else else
{ {
@ -338,8 +336,7 @@ int main(int argc, char *argv[])
m_scanner->write_bulk(&sts, sizeof(sts)); m_scanner->write_bulk(&sts, sizeof(sts));
auto msg = data.msg; auto msg = data.msg;
m_scanner->write_bulk(&msg[0], msg.length()); m_scanner->write_bulk(&msg[0], msg.length());
//printf("关闭V4L2 111\r\n");
//m_scanner->close_v4l2();
break; break;
} }
} }
@ -401,7 +398,6 @@ int main(int argc, char *argv[])
//LOG("Free info.pJpegData done\n"); //LOG("Free info.pJpegData done\n");
if (info.dpi) if (info.dpi)
{ {
//printf("111111111111111111111111111111111\r\n");
free(info.pJpegData); free(info.pJpegData);
} }

View File

@ -51,6 +51,8 @@ const int UsbDevice::cacheSize = 3*1024*1024;
int camtp_load_config_file(camtp_ctx * context, const char * conffile) int camtp_load_config_file(camtp_ctx * context, const char * conffile)
{ {
JsonConfig js;
ScannerScanInfo info = js.GetScanInfo();
int err = 0; int err = 0;
FILE * f; FILE * f;
char line[MAX_CFG_STRING_SIZE]; char line[MAX_CFG_STRING_SIZE];
@ -68,8 +70,8 @@ int camtp_load_config_file(camtp_ctx * context, const char * conffile)
strncpy(context->usb_cfg.usb_string_version, "Rev A", MAX_CFG_STRING_SIZE); strncpy(context->usb_cfg.usb_string_version, "Rev A", MAX_CFG_STRING_SIZE);
strncpy(context->usb_cfg.usb_string_interface, "Ht UsbCam", MAX_CFG_STRING_SIZE); strncpy(context->usb_cfg.usb_string_interface, "Ht UsbCam", MAX_CFG_STRING_SIZE);
context->usb_cfg.usb_vendor_id = USB_DEV_VENDOR_ID; context->usb_cfg.usb_vendor_id = info.VID;
context->usb_cfg.usb_product_id = USB_DEV_PRODUCT_ID; context->usb_cfg.usb_product_id = info.PID;
context->usb_cfg.usb_class = USB_DEV_CLASS; context->usb_cfg.usb_class = USB_DEV_CLASS;
context->usb_cfg.usb_subclass = USB_DEV_SUBCLASS; context->usb_cfg.usb_subclass = USB_DEV_SUBCLASS;
context->usb_cfg.usb_protocol = USB_DEV_PROTOCOL; context->usb_cfg.usb_protocol = USB_DEV_PROTOCOL;

View File

@ -14,7 +14,7 @@
#include "camtp.h" #include "camtp.h"
#include "buildconf.h" #include "buildconf.h"
#include "usb_gadget.h" #include "usb_gadget.h"
#include "JsonConfig.h"
//#define AIO_BULK_TRANSFER //#define AIO_BULK_TRANSFER
#ifdef AIO_BULK_TRANSFER #ifdef AIO_BULK_TRANSFER
@ -86,6 +86,8 @@ private:
std::shared_ptr<ThreadPool> intPointPool ; std::shared_ptr<ThreadPool> intPointPool ;
int loop_continue = 0 ; int loop_continue = 0 ;
int vid_;
int pid_;
#ifdef AIO_BULK_TRANSFER #ifdef AIO_BULK_TRANSFER
// int handle_ffs_aio_ep0(usb_gadget * ctx); // int handle_ffs_aio_ep0(usb_gadget * ctx);
io_context_t aio_ctx = 0; io_context_t aio_ctx = 0;
@ -94,5 +96,6 @@ private:
std::thread aio_event_thread; std::thread aio_event_thread;
int aio_event_poll(); int aio_event_poll();
std::mutex mx; std::mutex mx;
#endif #endif
}; };