Commit 323b29fd by lenz su

设备拔出 退出程序

parent a504ee70
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject> <!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.10.2, 2020-01-01T22:26:53. --> <!-- Written by QtCreator 4.10.2, 2020-01-02T10:53:03. -->
<qtcreator> <qtcreator>
<data> <data>
<variable>EnvironmentId</variable> <variable>EnvironmentId</variable>
...@@ -306,8 +306,8 @@ ...@@ -306,8 +306,8 @@
<value type="int" key="PE.EnvironmentAspect.Base">2</value> <value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/> <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">VideoDecode</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">VideoDecode</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">VideoDecode2</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:C:/Users/sulin/Documents/QT_PAIR_RECEIVE2/VideoDecode.pro</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:C:/Users/sulin/Documents/QT_PAIR_RECEIVE/VideoDecode.pro</value>
<value type="QString" key="RunConfiguration.Arguments"></value> <value type="QString" key="RunConfiguration.Arguments"></value>
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value> <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value> <value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
...@@ -317,7 +317,7 @@ ...@@ -317,7 +317,7 @@
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value> <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value> <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
<value type="QString" key="RunConfiguration.WorkingDirectory"></value> <value type="QString" key="RunConfiguration.WorkingDirectory"></value>
<value type="QString" key="RunConfiguration.WorkingDirectory.default">C:/Users/sulin/Documents/QT_PAIR_RECEIVE2/bin32</value> <value type="QString" key="RunConfiguration.WorkingDirectory.default">C:/Users/sulin/Documents/QT_PAIR_RECEIVE/bin32</value>
</valuemap> </valuemap>
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value> <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
</valuemap> </valuemap>
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
#include <QDebug> #include <QDebug>
#include "usb/USBOperator.h" #include "usb/USBOperator.h"
#include<QApplication>
#define MAX_PAYLOAD 1012 #define MAX_PAYLOAD 1012
typedef struct USB_FRAM_S{ typedef struct USB_FRAM_S{
int head; int head;
...@@ -27,19 +27,20 @@ void hid_thread::run() ...@@ -27,19 +27,20 @@ void hid_thread::run()
int res = hid_read(hid_fd,buffer, 2048); int res = hid_read(hid_fd,buffer, 2048);
qDebug("res = %d", res); qDebug("res = %d", res);
// FILE *h264Fp = fopen("out.log","wb"); // FILE *h264Fp = fopen("out.log","wb");
char buff[2048]; char buff[2048];
while(true) { while(true) {
//memset(buffer, 0, 2048); //memset(buffer, 0, 2048);
res = hid_read(hid_fd,buffer, 2048); res = hid_read(hid_fd,buffer, 2048);
if (res <=0) { if (res ==-1) {
//qDebug("res error "); QApplication* app;
//cout<<"error"<<endl; app->exit(0);
}
if(res<4){
msleep(100); msleep(100);
continue; continue;
} }
cout<<"youle"<<endl; cout<<"youle"<<endl;
cout<<"pUsbFram1:"<<pUsbFram1->id<<endl; cout<<"pUsbFram1:"<<pUsbFram1->id<<endl;
cout<<"pUsbFram1->buff[0]"<<pUsbFram1->head<<endl; cout<<"pUsbFram1->buff[0]"<<pUsbFram1->head<<endl;
...@@ -125,9 +126,9 @@ void hid_thread::run() ...@@ -125,9 +126,9 @@ void hid_thread::run()
qDebug("fram id:%d %d ", pUsbFram1->id, pUsbFram1->length); qDebug("fram id:%d %d ", pUsbFram1->id, pUsbFram1->length);
memset(buff, 0x00, sizeof (buff)); memset(buff, 0x00, sizeof (buff));
sprintf(buff, "fram id:%d %d\n", pUsbFram1->id, pUsbFram1->length); sprintf(buff, "fram id:%d %d\n", pUsbFram1->id, pUsbFram1->length);
// fwrite(buff, 1, strlen(buff), h264Fp); // fwrite(buff, 1, strlen(buff), h264Fp);
if((frameId+1)!=pUsbFram1->id){ if((frameId+1)!=pUsbFram1->id){
qDebug("fram id error current id %d real id %d",frameId, pUsbFram1->id); qDebug("fram id error current id %d real id %d",frameId, pUsbFram1->id);
} }
frameId=pUsbFram1->id; frameId=pUsbFram1->id;
} }
...@@ -141,9 +142,9 @@ void hid_thread::run() ...@@ -141,9 +142,9 @@ void hid_thread::run()
qDebug("fram id:%d %d ", pUsbFram2->id, pUsbFram2->length); qDebug("fram id:%d %d ", pUsbFram2->id, pUsbFram2->length);
memset(buff, 0x00, sizeof (buff)); memset(buff, 0x00, sizeof (buff));
sprintf(buff, "fram id:%d %d\n", pUsbFram2->id, pUsbFram2->length); sprintf(buff, "fram id:%d %d\n", pUsbFram2->id, pUsbFram2->length);
// fwrite(buff, 1, strlen(buff), h264Fp); // fwrite(buff, 1, strlen(buff), h264Fp);
if((frameId+1)!=pUsbFram2->id){ if((frameId+1)!=pUsbFram2->id){
qDebug("fram id error current id %d real id %d",frameId, pUsbFram2->id); qDebug("fram id error current id %d real id %d",frameId, pUsbFram2->id);
} }
frameId=pUsbFram2->id; frameId=pUsbFram2->id;
} }
......
No preview for this file type
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment