forked from Ivasoft/DSView
Prompt for user if the device linked to a too low speed USB port
This commit is contained in:
@@ -40,6 +40,7 @@ void DeviceAgent::update()
|
||||
_path = "";
|
||||
_di = NULL;
|
||||
_dev_type = 0;
|
||||
_is_new_device = false;
|
||||
|
||||
struct ds_device_full_info info;
|
||||
|
||||
@@ -48,19 +49,14 @@ void DeviceAgent::update()
|
||||
_dev_handle = info.handle;
|
||||
_dev_type = info.dev_type;
|
||||
_di = info.di;
|
||||
_is_new_device = info.actived_times == 1;
|
||||
|
||||
_dev_name = QString::fromLocal8Bit(info.name);
|
||||
_driver_name = QString::fromLocal8Bit(info.driver_name);
|
||||
|
||||
if (info.path[0] != '\0'){
|
||||
_path = QString::fromLocal8Bit(info.path);
|
||||
}
|
||||
|
||||
if (is_in_history(_dev_handle) == false){
|
||||
_is_new_device = true;
|
||||
}
|
||||
else{
|
||||
_is_new_device = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -288,17 +284,6 @@ GSList *DeviceAgent::get_channels()
|
||||
return ds_get_actived_device_channels();
|
||||
}
|
||||
|
||||
bool DeviceAgent::is_in_history(ds_device_handle dev_handle)
|
||||
{
|
||||
for(ds_device_handle h : _history_handles){
|
||||
if (h == dev_handle){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
_history_handles.push_back(dev_handle);
|
||||
return false;
|
||||
}
|
||||
|
||||
int DeviceAgent::get_hardware_operation_mode()
|
||||
{
|
||||
assert(_dev_handle);
|
||||
|
||||
@@ -175,8 +175,9 @@ public:
|
||||
|
||||
bool check_firmware_version();
|
||||
|
||||
QString get_demo_operation_mode();
|
||||
QString get_demo_operation_mode();
|
||||
|
||||
public:
|
||||
GVariant* get_config_list(const sr_channel_group *group, int key);
|
||||
|
||||
GVariant* get_config(int key, const sr_channel *ch = NULL, const sr_channel_group *cg = NULL);
|
||||
@@ -211,8 +212,7 @@ public:
|
||||
bool set_config_double(int key, double value, const sr_channel *ch = NULL, const sr_channel_group *cg = NULL);
|
||||
|
||||
private:
|
||||
void config_changed();
|
||||
bool is_in_history(ds_device_handle dev_handle);
|
||||
void config_changed();
|
||||
|
||||
//---------------device config-----------/
|
||||
public:
|
||||
@@ -233,8 +233,7 @@ private:
|
||||
QString _driver_name;
|
||||
QString _path;
|
||||
bool _is_new_device;
|
||||
struct sr_dev_inst *_di;
|
||||
std::vector<ds_device_handle> _history_handles;
|
||||
struct sr_dev_inst *_di;
|
||||
IDeviceAgentCallback *_callback;
|
||||
};
|
||||
|
||||
|
||||
@@ -207,6 +207,7 @@ SR_PRIV struct sr_dev_inst *sr_dev_inst_new(int mode, int status,
|
||||
sdi->status = status;
|
||||
sdi->handle = (ds_device_handle)sdi;
|
||||
sdi->dev_type = DEV_TYPE_UNKOWN;
|
||||
sdi->actived_times = 0;
|
||||
|
||||
if (vendor != NULL){
|
||||
sdi->vendor = g_strdup(vendor);
|
||||
|
||||
@@ -400,6 +400,7 @@ SR_API int ds_active_device(ds_device_handle handle)
|
||||
if (ret == SR_OK)
|
||||
{
|
||||
lib_ctx.actived_device_instance = dev;
|
||||
dev->actived_times++;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -646,6 +647,7 @@ SR_API int ds_get_actived_device_info(struct ds_device_full_info *fill_info)
|
||||
p->driver_name[0] = '\0';
|
||||
p->dev_type = DEV_TYPE_UNKOWN;
|
||||
p->di = NULL;
|
||||
p->actived_times = 0;
|
||||
|
||||
pthread_mutex_lock(&lib_ctx.mutext);
|
||||
|
||||
@@ -655,6 +657,7 @@ SR_API int ds_get_actived_device_info(struct ds_device_full_info *fill_info)
|
||||
p->handle = dev->handle;
|
||||
p->dev_type = dev->dev_type;
|
||||
p->di = dev;
|
||||
p->actived_times = dev->actived_times;
|
||||
strncpy(p->name, dev->name, sizeof(p->name) - 1);
|
||||
|
||||
if (dev->driver && dev->driver->name)
|
||||
|
||||
@@ -175,6 +175,8 @@ struct sr_dev_inst {
|
||||
|
||||
/** Device instance private data (used?) */
|
||||
void *priv;
|
||||
|
||||
int actived_times;
|
||||
};
|
||||
|
||||
struct sr_session
|
||||
|
||||
@@ -1334,6 +1334,7 @@ struct ds_device_full_info
|
||||
char path[256]; //file path
|
||||
char driver_name[20];
|
||||
int dev_type; // enum sr_device_type
|
||||
int actived_times;
|
||||
struct sr_dev_inst *di;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user