forked from Ivasoft/DSView
add: usb hotplug event define
This commit is contained in:
@@ -30,6 +30,7 @@
|
||||
#define LAN_EN 31
|
||||
|
||||
//#define DARK_STYLE "dark"
|
||||
#define APP_NAME "DSView"
|
||||
|
||||
//--------------------api---
|
||||
|
||||
|
||||
@@ -881,7 +881,7 @@ void MainWindow::on_search(bool visible)
|
||||
void MainWindow::on_screenShot()
|
||||
{
|
||||
AppConfig &app = AppConfig::Instance();
|
||||
QString default_name = app._userHistory.screenShotPath + "/DSView" + QDateTime::currentDateTime().toString("-yyMMdd-hhmmss");
|
||||
QString default_name = app._userHistory.screenShotPath + "/" + APP_NAME + QDateTime::currentDateTime().toString("-yyMMdd-hhmmss");
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
QScreen *scr = QGuiApplication::primaryScreen();
|
||||
|
||||
@@ -1212,10 +1212,10 @@ void SigSession::hotplug_callback(void *ctx, void *dev, int event, void *user_da
|
||||
(void)dev;
|
||||
(void)user_data;
|
||||
|
||||
if (1 == event) {
|
||||
if (USB_EV_HOTPLUG_ATTACH == event) {
|
||||
_session->_hot_attach = true;
|
||||
qDebug("receive event:DreamSourceLab Hardware attached!");
|
||||
}else if (2 == event) {
|
||||
}else if (USB_EV_HOTPLUG_DETTACH == event) {
|
||||
_session->_hot_detach = true;
|
||||
qDebug("receive event:DreamSourceLab Hardware detached!");
|
||||
}else{
|
||||
|
||||
@@ -416,9 +416,15 @@ LIBUSB_CALL int sr_hotplug_callback(struct libusb_context *ctx, struct libusb_de
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ev = USB_EV_HOTPLUG_UNKNOW;
|
||||
if (event == (int)LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED)
|
||||
ev = USB_EV_HOTPLUG_ATTACH;
|
||||
else if (event == (int)LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT)
|
||||
ev = USB_EV_HOTPLUG_DETTACH;
|
||||
|
||||
struct sr_context *user_ctx = (struct sr_context*)user_data;
|
||||
if (user_ctx->hotplug_callback != NULL){
|
||||
user_ctx->hotplug_callback(ctx, dev, (int)event, user_ctx->hotplug_user_data);
|
||||
user_ctx->hotplug_callback(ctx, dev, ev, user_ctx->hotplug_user_data);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -174,6 +174,11 @@ enum {
|
||||
#define SR_PRIV
|
||||
#endif
|
||||
|
||||
|
||||
#define USB_EV_HOTPLUG_UNKNOW 0
|
||||
#define USB_EV_HOTPLUG_ATTACH 1
|
||||
#define USB_EV_HOTPLUG_DETTACH 2
|
||||
|
||||
|
||||
/** Data types used by sr_config_info(). */
|
||||
enum {
|
||||
|
||||
Reference in New Issue
Block a user