From: Gerhard Sittig Date: Sun, 9 Jun 2019 16:28:48 +0000 (+0200) Subject: uni-t-ut32x: don't provide a default conn= spec in the driver source X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=a89884c16c0ce6a00a5108c9e7c289dbc282f996;p=libsigrok.git uni-t-ut32x: don't provide a default conn= spec in the driver source This undoes the essence of commit bf700f679af2, which introduced the default conn= spec. Which improved usability: Users just select the device and need not specify the connection. But also resulted in the UT32x thermometer driver's probe to "succeed" as soon as the WCH CH9325 chip was found, no data check was involved in the scan. Unfortunately this chip is also used in the popular UT-D04 cable, and thus there were many false positives. --- diff --git a/src/hardware/uni-t-ut32x/api.c b/src/hardware/uni-t-ut32x/api.c index 199fe473..21e5be7d 100644 --- a/src/hardware/uni-t-ut32x/api.c +++ b/src/hardware/uni-t-ut32x/api.c @@ -65,7 +65,13 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) struct dev_context *devc; size_t i; - conn = "hid/ch9325"; + /* + * Implementor's note: Do _not_ add a default conn value here, + * always expect users to specify the connection. Otherwise the + * UT32x driver's scan routine results in false positives, will + * match _any_ UT-D04 cable which uses the same USB HID chip. + */ + conn = NULL; serialcomm = "2400/8n1"; for (l = options; l; l = l->next) { src = l->data; @@ -78,6 +84,8 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) break; } } + if (!conn) + return NULL; devices = NULL; serial = sr_serial_dev_inst_new(conn, serialcomm);