From 4e1c4ca3b214445c4b0b4a35f77daf81bb8691cb Mon Sep 17 00:00:00 2001 From: DreamSourceLab Date: Sun, 3 Nov 2019 18:21:46 -0800 Subject: [PATCH] Add tool button of device type --- DSView/DSView.qrc | 4 +++ DSView/icons/data.png | Bin 0 -> 1114 bytes DSView/icons/demo.png | Bin 0 -> 2013 bytes DSView/icons/usb2.png | Bin 0 -> 2199 bytes DSView/icons/usb3.png | Bin 0 -> 2409 bytes DSView/pv/mainwindow.cpp | 33 +++++++++++++++++-- DSView/pv/mainwindow.h | 4 ++- DSView/pv/toolbars/samplingbar.cpp | 47 ++++++++++++++++++++++++++- DSView/pv/toolbars/samplingbar.h | 2 ++ libsigrok4DSL/hardware/DSL/dsl.c | 22 +++++++++---- libsigrok4DSL/hardware/DSL/dsl.h | 31 +++++++++--------- libsigrok4DSL/hardware/DSL/dslogic.c | 29 +++++++++++------ libsigrok4DSL/libsigrok.h | 2 ++ 13 files changed, 139 insertions(+), 35 deletions(-) create mode 100644 DSView/icons/data.png create mode 100644 DSView/icons/demo.png create mode 100644 DSView/icons/usb2.png create mode 100644 DSView/icons/usb3.png diff --git a/DSView/DSView.qrc b/DSView/DSView.qrc index a50ef6b9..d3012dbb 100755 --- a/DSView/DSView.qrc +++ b/DSView/DSView.qrc @@ -133,5 +133,9 @@ icons/dark/osc.png icons/showDoc25.png icons/showDoc31.png + icons/usb2.png + icons/usb3.png + icons/data.png + icons/demo.png diff --git a/DSView/icons/data.png b/DSView/icons/data.png new file mode 100644 index 0000000000000000000000000000000000000000..532fb4ebc2020c363bd088cedda7279b66a9bcdc GIT binary patch literal 1114 zcmV-g1f~0lP)&pw4e{-o1iaE z(ty-H#Ox+E*&!%`KKM`&Ybrq!W>?Mb#9ND1D=i3W(L(jbLdfo>Teg8bBs(%EPH*5kEc>H*K12`E}{I$ZmThzlQ5P^k^J0@_)O3qbuV-Pij zML;u9n?Y_`$(a)U^9&>6zpx>(Ktp1IhQtC5SsMaXCqV8**ff8i3ZKqw^Qeg2`}ZOA zHYgQ1fr|dANK2`ny8v9U)9xYQ-DQRyEY+Tz0I*ZT?P^(P1c~fgGFpKueWiNtEI{v$ z@)p2ZevH1}m#)-?>iKV+@$RqfO!*m*V&KItLX-lJmg>1T0D86+ueXxc3E+n128l?M zr<|~N9og-S?w@vQT_ro?W`T~N3;s7E5~$~{h}S*4E!K7J2(W#{!-cJS_43=Gtspwx zl;~-?)Yu`A4W!&92wk8mQ^|zYQXb3y4p7L9JS#~1wZ;*VJ$8EJX{XMs?|jv9xhL(m zS}-QU&Hh)tIH3wu@C4mAIF|bkW?pZqa%lCp!}>~ZwlYzw=D&EYp8KJY8hISNQ-~z| zt9og|oq@_>r=C9r(6{rg8$BBD8@(qHNm$C!uI%uZa<%(nalG?%AyXL;c+R()mmySv z0(Gfu4eI9@KAYTaIDj(X0&=D5hy}ZR6elpD`%aFt{;ozou>!yA$f?-;`7a7tcCr1!!ivYX~jgTMh0Rot4uk^)sY3!(rUy+je=!BC1_ zgyv|vD$6@8%^7Aj0d gT|-PvOw4-YFU|*CUjhZY7ytkO07*qoM6N<$f`Bgz#Q*>R literal 0 HcmV?d00001 diff --git a/DSView/icons/demo.png b/DSView/icons/demo.png new file mode 100644 index 0000000000000000000000000000000000000000..76e49311980351d5b9e71a56ee508c25920ab6b0 GIT binary patch literal 2013 zcmV<32O{{1P)^}RP=XuUQ_nv$9oRdI_5;KWrx`2GxcW}C{ zn^Ox={bF~!cHz%-O%pL|1U&mx?KPpn!A9U?z>OI5rJ?%FFhm>h7mPoIoq=Su;oONC zEqIt27ciA{Ka8;*u}0ubrj3CQw3@Howd=e;2VCMsnK1$F5hC6~_gjb^g3y#=7zRAx zM$+4y)$|p(#7QwD0-i}Os;aQwqY@u2L_9N&^{Qg^;>Op{7b4!}P;>$9AZ6)_*kRC3 zg$-=axNl?{^kuRIje7~g#Y_f}u83_NFP<5FV1EVm3HuPzoCzD7btC>{Mg`K1g0j)i zq?^5k?j4Zc6KoI0Qq(Ij-4b1D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?7(A?b?^^Nw%(}__`dMy zxHd`57?A9Mp>n|&rj^|6(Rfp4)1@7!PT&H*{!HDRvcCQoH11?p&={PJkbU>O#;*1t z^AzP|LR+$CxnuruiFh&cVb*JCRZUa+c+jbecC;hi8vVF$&ToQV!!yG$K3B6Y{aBEB zMkwkLUoRQ!4EzheS!cW{6Ad&+4zpuL`U<8b;4~=-I8A1ifM%o(-QwUcM=Ul|HGpJY z7-xK(SA;!Y%oXQLF{=aw25OtUXMtz)IiwQqKoRS?B(qJxD~^(Y)1;^ZYS6Az#Pa@8 vwT}ib86#vLaIn0Sam&ume+^KgL@@jxi*vHN=VR=c00000NkvXXu0mjfo1x(8 literal 0 HcmV?d00001 diff --git a/DSView/icons/usb2.png b/DSView/icons/usb2.png new file mode 100644 index 0000000000000000000000000000000000000000..d0b705989fa3c2aafeebaf431e4b2ce43ccb31d3 GIT binary patch literal 2199 zcmZ|Qc{mjM8VB&nzKi1sb2WqPOU9D57)A(@A^S1NGGT_9L6%W+teJ~AvPNWN%~B*; zldYjI9U!=f?Bz#tr;PMBoKQlVdp@%K56 zf^o=De}FDcn3px-J)OYO0k|k1j6c9DjCmU8|8+SM>lfm~iedn5Jufm@%yY^vJ{S}d z6$t17eobK+_kZ>yFn<1k17_m-e`Dt8&`^IA4sb}y>t-3(Y0L?U3-Jd$+oCA4_I#~j zP^UY^n}x9%p3c&PCf$sD%cw&#@ui(ZIYhMLs!A6d^h9K4ah8opzG@K)S#-Od!~uk= zSAG<4gk{S{g78n&74D%LBctZdJ}U&sLkMXiL2>fs#COESNNNQ2O8g0=V|^=<$auxb zC+t}(%#wbVV7q7?wBluhZlm&=iTo=Aar~~|CIkemM|-mVUrWy>%8aZ&j3-xx)b*}vu-RGIcjOGd)7)@+LH)#Dg}Mb9Y>4(^^r~we+>K;)E{tc za#IQKBVqGObIcgv-KzyyRqbJBCQxz~tQMA_3#dMR6%GQuVA(W@Lm^ zn?M<-vrG9E4MneTW<^1djMBALLN+RtJd>0apaqgBN$_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)&Va&nPgtzxi=g(vU)yNM||)SK?AgA-9Qa9JUen9?fY>}Rz$fo;=yd@(1~-$ zEoKePtMv);+;F?+A$xlxy(We)^J=aY7fn)&l;)KUjMcaH+bNVTEp3q7Qm7{u@ zk1-&q9r5U>tc;?IjN#a%v{-=;_oLZT$OOw}z*e5R$DhJKeI(!Y$a-shWCD`^E=sq) zmFybEB~&rrrn+;za-GtylFq@brFw}1o+WD-Yq+v2_UH1Pu`uNs$+c$VklB}QM>L1M pY%Y6frR%7zc|n)m{C~DxZ#aV?qqk@Fob~?#tSzp?8q5&){|!+y2PFUi literal 0 HcmV?d00001 diff --git a/DSView/icons/usb3.png b/DSView/icons/usb3.png new file mode 100644 index 0000000000000000000000000000000000000000..3a2b1d1abe48cecc3f95f36b4c9b3f0586d8752b GIT binary patch literal 2409 zcmZ{mc|6p67sr1SnK5HuBFZw^g)+%H(-_8D!nnvXOpLJ%#u$<^hPXwxawA)o=$7r$ z2yKk&8oDCc5?QV#4f{)4dY zH1jB0U^o?cQrl(2LqaqjvLr_OQG+P7pztt2Qc(E>k3$c*ML6XuHHZ{Q1FA*4On6k} zA4(+>4y;PFpim-UupuhQ%LpE1aNz;8D+DSL@TTk^*kS)P4~q076L?lC(8OxU?r%`3^=Ko)3Sf>6EPHm~1z9^RCq0_KZF={)WGudX2cV;>S(DjUnv2($w5C?uUR@iykHD2FcCc{eR;0&4YCh zU9fR2owZFzv*MH*^eHwS?=P|kn_4}t=&UZDJjOBh4Q^Sci>F3WP=}+*S%$!4IV0ps zVA-{Zi^%meg$Z|x;$g$aBNq6p^>wuMOlzhh?hUL}vu_DhvN|L!J^jNXpk`+9QGw{7 zeYnL*0)o!jEq^i&n$k^PT#(99kWxRhQn-5&W}ww~qPfEippaRAfGSrEfcjo+LVdYwT7@?VYWaQ<$r_T@q9 zy^Pg-BA2$CwpR)=csfDI+gUn1uHP}mC-cd-%xBPi&v^D78bL3|C3(CwF6KWh)Zz7a zL=`hGR3{Es@lNeT#aMZg%xL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p*wZ8OG3-abUmO>9g?DCs{ z*QpKzLDvN>K=l9zhiZOD)O4z!= znnX)h;Qn%$c$l~9s%_RR_!|z}xpM{X)iA6E5m325sb1E|)XP=>^C1J&t-hi1B8+-( zQa)DD$EK`mcQ2>rZMemHwE1KF%HcR@3O1Ymcf^s)zi*Y%p{uoOtL #include #include +#include using boost::shared_ptr; using boost::dynamic_pointer_cast; @@ -99,7 +99,8 @@ MainWindow::MainWindow(DeviceManager &device_manager, QWidget *parent) : QMainWindow(parent), _device_manager(device_manager), - _session(device_manager) + _session(device_manager), + _msg(NULL) { setup_ui(); if (open_file_name) { @@ -346,6 +347,9 @@ void MainWindow::update_device_list() { assert(_sampling_bar); + if (_msg) + _msg->close(); + switchLanguage(_language); _session.stop_capture(); _view->reload(); @@ -434,6 +438,29 @@ void MainWindow::update_device_list() _trigger_widget->init(); _dso_trigger_widget->init(); _measure_widget->reload(); + + // USB device speed check + if (!selected_device->name().contains("virtual")) { + int usb_speed; + GVariant *gvar = selected_device->get_config(NULL, NULL, SR_CONF_USB_SPEED); + if (gvar != NULL) { + usb_speed = g_variant_get_int32(gvar); + g_variant_unref(gvar); + } + + bool usb30_support = false; + gvar = selected_device->get_config(NULL, NULL, SR_CONF_USB30_SUPPORT); + if (gvar != NULL) { + usb30_support = g_variant_get_boolean(gvar); + g_variant_unref(gvar); + + if (usb30_support && usb_speed == LIBUSB_SPEED_HIGH) + show_session_error(tr("Speed limited"), tr("This is a super-speed usb device(USB 3.0). " + "Plug it into a USB 2.0 port will seriously affect its performance." + "Please replug it into a USB 3.0 port.")); + } + } + } void MainWindow::reload() @@ -464,11 +491,13 @@ void MainWindow::show_session_error( const QString text, const QString info_text) { dialogs::DSMessageBox msg(this); + _msg = &msg; msg.mBox()->setText(text); msg.mBox()->setInformativeText(info_text); msg.mBox()->setStandardButtons(QMessageBox::Ok); msg.mBox()->setIcon(QMessageBox::Warning); msg.exec(); + _msg = NULL; } void MainWindow::device_attach() diff --git a/DSView/pv/mainwindow.h b/DSView/pv/mainwindow.h index 16272baf..14c96fdb 100755 --- a/DSView/pv/mainwindow.h +++ b/DSView/pv/mainwindow.h @@ -29,6 +29,7 @@ #include #include "sigsession.h" +#include "dialogs/dsmessagebox.h" class QAction; class QMenuBar; @@ -106,7 +107,7 @@ private slots: void reload(); - void show_session_error( + void show_session_error( const QString text, const QString info_text); void run_stop(); @@ -161,6 +162,7 @@ private: SigSession _session; pv::view::View *_view; + dialogs::DSMessageBox *_msg; QMenuBar *_menu_bar; QMenu *_menu_file; diff --git a/DSView/pv/toolbars/samplingbar.cpp b/DSView/pv/toolbars/samplingbar.cpp index 8cebb45b..2a2c9027 100755 --- a/DSView/pv/toolbars/samplingbar.cpp +++ b/DSView/pv/toolbars/samplingbar.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include #include @@ -30,7 +31,6 @@ #include #include "samplingbar.h" - #include "../devicemanager.h" #include "../device/devinst.h" #include "../dialogs/deviceoptions.h" @@ -57,6 +57,7 @@ SamplingBar::SamplingBar(SigSession &session, QWidget *parent) : _session(session), _enable(true), _sampling(false), + _device_type(this), _device_selector(this), _updating_device_selector(false), _configure_button(this), @@ -104,6 +105,8 @@ SamplingBar::SamplingBar(SigSession &session, QWidget *parent) : leftMargin->setFixedWidth(4); addWidget(leftMargin); + _device_type.setToolButtonStyle(Qt::ToolButtonTextUnderIcon); + addWidget(&_device_type); addWidget(&_device_selector); _configure_button.setToolButtonStyle(Qt::ToolButtonTextUnderIcon); addWidget(&_configure_button); @@ -146,6 +149,27 @@ void SamplingBar::changeEvent(QEvent *event) void SamplingBar::retranslateUi() { + shared_ptr dev_inst = get_selected_device(); + if (dev_inst && dev_inst->dev_inst()) { + if (dev_inst->name().contains("virtual-demo")) + _device_type.setText(tr("Demo")); + else if (dev_inst->name().contains("virtual")) + _device_type.setText(tr("File")); + else { + int usb_speed; + GVariant *gvar = dev_inst->get_config(NULL, NULL, SR_CONF_USB_SPEED); + if (gvar != NULL) { + usb_speed = g_variant_get_int32(gvar); + g_variant_unref(gvar); + } + if (usb_speed == LIBUSB_SPEED_HIGH) + _device_type.setText(tr("USB 2.0")); + else if (usb_speed == LIBUSB_SPEED_SUPER) + _device_type.setText(tr("USB 3.0")); + else + _device_type.setText(tr("USB UNKNOWN")); + } + } _configure_button.setText(tr("Options")); _mode_button.setText(tr("Mode")); if (_instant) { @@ -172,6 +196,26 @@ void SamplingBar::reStyle() { QString iconPath = ":/icons/" + qApp->property("Style").toString(); + shared_ptr dev_inst = get_selected_device(); + if (dev_inst && dev_inst->dev_inst()) { + if (dev_inst->name().contains("virtual-demo")) + _device_type.setIcon(QIcon(":/icons/demo.png")); + else if (dev_inst->name().contains("virtual")) + _device_type.setIcon(QIcon(":/icons/data.png")); + else { + int usb_speed; + GVariant *gvar = dev_inst->get_config(NULL, NULL, SR_CONF_USB_SPEED); + if (gvar != NULL) { + usb_speed = g_variant_get_int32(gvar); + g_variant_unref(gvar); + } + if (usb_speed == LIBUSB_SPEED_SUPER) + _device_type.setIcon(QIcon(":/icons/usb3.png")); + else + _device_type.setIcon(QIcon(":/icons/usb2.png")); + + } + } _configure_button.setIcon(QIcon(iconPath+"/params.png")); _mode_button.setIcon(_session.get_run_mode() == pv::SigSession::Single ? QIcon(iconPath+"/modes.png") : QIcon(iconPath+"/moder.png")); @@ -964,6 +1008,7 @@ void SamplingBar::reload() enable_toggle(true); } retranslateUi(); + reStyle(); update(); } diff --git a/DSView/pv/toolbars/samplingbar.h b/DSView/pv/toolbars/samplingbar.h index b1bd9b31..c023d7b8 100755 --- a/DSView/pv/toolbars/samplingbar.h +++ b/DSView/pv/toolbars/samplingbar.h @@ -139,6 +139,8 @@ private: bool _enable; bool _sampling; + QToolButton _device_type; + QComboBox _device_selector; std::map > _device_selector_map; diff --git a/libsigrok4DSL/hardware/DSL/dsl.c b/libsigrok4DSL/hardware/DSL/dsl.c index e6d97786..63276f0b 100755 --- a/libsigrok4DSL/hardware/DSL/dsl.c +++ b/libsigrok4DSL/hardware/DSL/dsl.c @@ -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); diff --git a/libsigrok4DSL/hardware/DSL/dsl.h b/libsigrok4DSL/hardware/DSL/dsl.h index cbe3bb4d..9b2376ac 100755 --- a/libsigrok4DSL/hardware/DSL/dsl.h +++ b/libsigrok4DSL/hardware/DSL/dsl.h @@ -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[] = { diff --git a/libsigrok4DSL/hardware/DSL/dslogic.c b/libsigrok4DSL/hardware/DSL/dslogic.c index 3d3dd015..b786abae 100755 --- a/libsigrok4DSL/hardware/DSL/dslogic.c +++ b/libsigrok4DSL/hardware/DSL/dslogic.c @@ -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; + } } } } diff --git a/libsigrok4DSL/libsigrok.h b/libsigrok4DSL/libsigrok.h index 872f53e7..8bb0955d 100755 --- a/libsigrok4DSL/libsigrok.h +++ b/libsigrok4DSL/libsigrok.h @@ -801,6 +801,8 @@ enum { SR_CONF_CAPTURE_RATIO, /** */ + SR_CONF_USB_SPEED, + SR_CONF_USB30_SUPPORT, SR_CONF_DEVICE_MODE, SR_CONF_INSTANT, SR_CONF_STATUS,