2
0
forked from Ivasoft/DSView

Add tool button of device type

This commit is contained in:
DreamSourceLab
2019-11-03 18:21:46 -08:00
parent d33bb18350
commit 4e1c4ca3b2
13 changed files with 139 additions and 35 deletions

View File

@@ -921,7 +921,7 @@ SR_PRIV int dsl_fpga_arm(const struct sr_dev_inst *sdi)
}
}
if (!(devc->profile->dev_caps.feature_caps & CAPS_FEATURE_USB30)) {
if (!(devc->profile->usb_speed == LIBUSB_SPEED_SUPER)) {
// set GPIF to be wordwide
wr_cmd.header.dest = DSL_CTL_WORDWIDE;
wr_cmd.header.size = 1;
@@ -1173,6 +1173,16 @@ SR_PRIV int dsl_config_get(int id, GVariant **data, const struct sr_dev_inst *sd
snprintf(str, 128, "%d.%d", usb->bus, usb->address);
*data = g_variant_new_string(str);
break;
case SR_CONF_USB_SPEED:
if (!sdi)
return SR_ERR;
*data = g_variant_new_int32(devc->profile->usb_speed);
break;
case SR_CONF_USB30_SUPPORT:
if (!sdi)
return SR_ERR;
*data = g_variant_new_boolean(devc->profile->dev_caps.feature_caps & CAPS_FEATURE_USB30);
break;
case SR_CONF_LIMIT_SAMPLES:
if (!sdi)
return SR_ERR;
@@ -1612,16 +1622,16 @@ SR_PRIV int dsl_dev_status_get(const struct sr_dev_inst *sdi, struct sr_status *
static unsigned int get_single_buffer_time(const struct DSL_context *devc)
{
if (devc->profile->dev_caps.feature_caps & CAPS_FEATURE_USB30)
return 100;
if (devc->profile->usb_speed == LIBUSB_SPEED_SUPER)
return 10;
else
return 20;
}
static unsigned int get_total_buffer_time(const struct DSL_context *devc)
{
if (devc->profile->dev_caps.feature_caps & CAPS_FEATURE_USB30)
return 500;
if (devc->profile->usb_speed == LIBUSB_SPEED_SUPER)
return 40;
else
return 100;
}
@@ -1643,7 +1653,7 @@ SR_PRIV int dsl_header_size(const struct DSL_context *devc)
{
int size;
if (devc->profile->dev_caps.feature_caps & CAPS_FEATURE_USB30)
if (devc->profile->usb_speed == LIBUSB_SPEED_SUPER)
size = SR_KB(1);
else
size = SR_B(512);

View File

@@ -175,6 +175,7 @@ struct DSL_caps {
struct DSL_profile {
uint16_t vid;
uint16_t pid;
enum libusb_speed usb_speed;
const char *vendor;
const char *model;
@@ -431,7 +432,7 @@ static const struct DSL_profile supported_DSLogic[] = {
/*
* DSLogic
*/
{0x2A0E, 0x0001, "DreamSourceLab", "DSLogic", NULL,
{0x2A0E, 0x0001, LIBUSB_SPEED_HIGH, "DreamSourceLab", "DSLogic", NULL,
"DSLogic.fw",
"DSLogic33.bin",
"DSLogic50.bin",
@@ -457,7 +458,7 @@ static const struct DSL_profile supported_DSLogic[] = {
0}
},
{0x2A0E, 0x0003, "DreamSourceLab", "DSLogic Pro", NULL,
{0x2A0E, 0x0003, LIBUSB_SPEED_HIGH, "DreamSourceLab", "DSLogic Pro", NULL,
"DSLogicPro.fw",
"DSLogicPro.bin",
"DSLogicPro.bin",
@@ -481,7 +482,7 @@ static const struct DSL_profile supported_DSLogic[] = {
0}
},
{0x2A0E, 0x0020, "DreamSourceLab", "DSLogic PLus", NULL,
{0x2A0E, 0x0020, LIBUSB_SPEED_HIGH, "DreamSourceLab", "DSLogic PLus", NULL,
"DSLogicPlus.fw",
"DSLogicPlus.bin",
"DSLogicPlus.bin",
@@ -505,7 +506,7 @@ static const struct DSL_profile supported_DSLogic[] = {
0}
},
{0x2A0E, 0x0021, "DreamSourceLab", "DSLogic Basic", NULL,
{0x2A0E, 0x0021, LIBUSB_SPEED_HIGH, "DreamSourceLab", "DSLogic Basic", NULL,
"DSLogicBasic.fw",
"DSLogicBasic.bin",
"DSLogicBasic.bin",
@@ -529,7 +530,7 @@ static const struct DSL_profile supported_DSLogic[] = {
0}
},
{0x2A0E, 0x0029, "DreamSourceLab", "DSLogic U2Basic", NULL,
{0x2A0E, 0x0029, LIBUSB_SPEED_HIGH, "DreamSourceLab", "DSLogic U2Basic", NULL,
"DSLogicU2Basic.fw",
"DSLogicU2Basic.bin",
"DSLogicU2Basic.bin",
@@ -553,14 +554,14 @@ static const struct DSL_profile supported_DSLogic[] = {
0}
},
{ 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}
};
static const struct DSL_profile supported_DSCope[] = {
/*
* DSCope
*/
{0x2A0E, 0x0002, "DreamSourceLab", "DSCope", NULL,
{0x2A0E, 0x0002, LIBUSB_SPEED_HIGH, "DreamSourceLab", "DSCope", NULL,
"DSCope.fw",
"DSCope.bin",
"DSCope.bin",
@@ -584,7 +585,7 @@ static const struct DSL_profile supported_DSCope[] = {
0}
},
{0x2A0E, 0x0004, "DreamSourceLab", "DSCope20", NULL,
{0x2A0E, 0x0004, LIBUSB_SPEED_HIGH, "DreamSourceLab", "DSCope20", NULL,
"DSCope20.fw",
"DSCope20.bin",
"DSCope20.bin",
@@ -608,7 +609,7 @@ static const struct DSL_profile supported_DSCope[] = {
0}
},
{0x2A0E, 0x0022, "DreamSourceLab", "DSCope B20", NULL,
{0x2A0E, 0x0022, LIBUSB_SPEED_HIGH, "DreamSourceLab", "DSCope B20", NULL,
"DSCopeB20.fw",
"DSCope20.bin",
"DSCope20.bin",
@@ -632,7 +633,7 @@ static const struct DSL_profile supported_DSCope[] = {
0}
},
{0x2A0E, 0x0023, "DreamSourceLab", "DSCope C20", NULL,
{0x2A0E, 0x0023, LIBUSB_SPEED_HIGH, "DreamSourceLab", "DSCope C20", NULL,
"DSCopeC20.fw",
"DSCopeC20P.bin",
"DSCopeC20P.bin",
@@ -657,7 +658,7 @@ static const struct DSL_profile supported_DSCope[] = {
},
{0x2A0E, 0x0024, "DreamSourceLab", "DSCope C20P", NULL,
{0x2A0E, 0x0024, LIBUSB_SPEED_HIGH, "DreamSourceLab", "DSCope C20P", NULL,
"DSCopeC20P.fw",
"DSCopeC20P.bin",
"DSCopeC20P.bin",
@@ -681,7 +682,7 @@ static const struct DSL_profile supported_DSCope[] = {
0}
},
{0x2A0E, 0x0025, "DreamSourceLab", "DSCope C20", NULL,
{0x2A0E, 0x0025, LIBUSB_SPEED_HIGH, "DreamSourceLab", "DSCope C20", NULL,
"DSCopeC20B.fw",
"DSCopeC20B.bin",
"DSCopeC20B.bin",
@@ -705,7 +706,7 @@ static const struct DSL_profile supported_DSCope[] = {
0}
},
{0x2A0E, 0x0026, "DreamSourceLab", "DSCope U2B20", NULL,
{0x2A0E, 0x0026, LIBUSB_SPEED_HIGH, "DreamSourceLab", "DSCope U2B20", NULL,
"DSCopeU2B20.fw",
"DSCopeU2B20.bin",
"DSCopeU2B20.bin",
@@ -729,7 +730,7 @@ static const struct DSL_profile supported_DSCope[] = {
22}
},
{0x2A0E, 0x0027, "DreamSourceLab", "DSCope U2P20", NULL,
{0x2A0E, 0x0027, LIBUSB_SPEED_HIGH, "DreamSourceLab", "DSCope U2P20", NULL,
"DSCopeU2P20.fw",
"DSCopeU2P20.bin",
"DSCopeU2P20.bin",
@@ -754,7 +755,7 @@ static const struct DSL_profile supported_DSCope[] = {
},
{ 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}
};
static const gboolean default_ms_en[] = {

View File

@@ -264,6 +264,7 @@ static GSList *scan(GSList *options)
libusb_device **devlist;
int devcnt, ret, i, j;
const char *conn;
enum libusb_speed usb_speed;
drvc = di->priv;
@@ -305,10 +306,16 @@ static GSList *scan(GSList *options)
continue;
}
usb_speed = libusb_get_device_speed( devlist[i]);
if ((usb_speed != LIBUSB_SPEED_HIGH) &&
(usb_speed != LIBUSB_SPEED_SUPER))
continue;
prof = NULL;
for (j = 0; supported_DSLogic[j].vid; j++) {
if (des.idVendor == supported_DSLogic[j].vid &&
des.idProduct == supported_DSLogic[j].pid) {
des.idProduct == supported_DSLogic[j].pid &&
usb_speed == supported_DSLogic[j].usb_speed) {
prof = &supported_DSLogic[j];
}
}
@@ -939,15 +946,17 @@ static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi,
stropt = g_variant_get_string(data, NULL);
if (sdi->mode == LOGIC) {
for (i = 0; i < ARRAY_SIZE(channel_modes); i++) {
if (devc->language == LANGUAGE_CN) {
if (!strcmp(stropt, channel_modes[i].descr_cn)) {
devc->ch_mode = channel_modes[i].id;
break;
}
} else {
if (!strcmp(stropt, channel_modes[i].descr)) {
devc->ch_mode = channel_modes[i].id;
break;
if (devc->profile->dev_caps.channels & (1 << i)) {
if (devc->language == LANGUAGE_CN) {
if (!strcmp(stropt, channel_modes[i].descr_cn)) {
devc->ch_mode = channel_modes[i].id;
break;
}
} else {
if (!strcmp(stropt, channel_modes[i].descr)) {
devc->ch_mode = channel_modes[i].id;
break;
}
}
}
}